comparison src/http/modules/ngx_http_range_filter_module.c @ 8031:d26db4f82d7d

All known output headers can be linked lists now. The h->next pointer properly provided as NULL in all cases where known output headers are added. Note that there are 3rd party modules which might not do this, and it might be risky to rely on this for arbitrary headers.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 30 May 2022 21:25:45 +0300
parents c30a20e06c21
children ae2d62bb12c0
comparison
equal deleted inserted replaced
8030:cdc2724858ca 8031:d26db4f82d7d
256 if (r->headers_out.accept_ranges == NULL) { 256 if (r->headers_out.accept_ranges == NULL) {
257 return NGX_ERROR; 257 return NGX_ERROR;
258 } 258 }
259 259
260 r->headers_out.accept_ranges->hash = 1; 260 r->headers_out.accept_ranges->hash = 1;
261 r->headers_out.accept_ranges->next = NULL;
261 ngx_str_set(&r->headers_out.accept_ranges->key, "Accept-Ranges"); 262 ngx_str_set(&r->headers_out.accept_ranges->key, "Accept-Ranges");
262 ngx_str_set(&r->headers_out.accept_ranges->value, "bytes"); 263 ngx_str_set(&r->headers_out.accept_ranges->value, "bytes");
263 264
264 return ngx_http_next_header_filter(r); 265 return ngx_http_next_header_filter(r);
265 } 266 }
425 } 426 }
426 427
427 r->headers_out.content_range = content_range; 428 r->headers_out.content_range = content_range;
428 429
429 content_range->hash = 1; 430 content_range->hash = 1;
431 content_range->next = NULL;
430 ngx_str_set(&content_range->key, "Content-Range"); 432 ngx_str_set(&content_range->key, "Content-Range");
431 433
432 content_range->value.data = ngx_pnalloc(r->pool, 434 content_range->value.data = ngx_pnalloc(r->pool,
433 sizeof("bytes -/") - 1 + 3 * NGX_OFF_T_LEN); 435 sizeof("bytes -/") - 1 + 3 * NGX_OFF_T_LEN);
434 if (content_range->value.data == NULL) { 436 if (content_range->value.data == NULL) {
597 } 599 }
598 600
599 r->headers_out.content_range = content_range; 601 r->headers_out.content_range = content_range;
600 602
601 content_range->hash = 1; 603 content_range->hash = 1;
604 content_range->next = NULL;
602 ngx_str_set(&content_range->key, "Content-Range"); 605 ngx_str_set(&content_range->key, "Content-Range");
603 606
604 content_range->value.data = ngx_pnalloc(r->pool, 607 content_range->value.data = ngx_pnalloc(r->pool,
605 sizeof("bytes */") - 1 + NGX_OFF_T_LEN); 608 sizeof("bytes */") - 1 + NGX_OFF_T_LEN);
606 if (content_range->value.data == NULL) { 609 if (content_range->value.data == NULL) {