comparison src/http/v2/ngx_http_v2_filter_module.c @ 8024:ef6a3a99a81a

Reworked multi headers to use linked lists. Multi headers are now using linked lists instead of arrays. Notably, the following fields were changed: r->headers_in.cookies (renamed to r->headers_in.cookie), r->headers_in.x_forwarded_for, r->headers_out.cache_control, r->headers_out.link, u->headers_in.cache_control u->headers_in.cookies (renamed to u->headers_in.set_cookie). The r->headers_in.cookies and u->headers_in.cookies fields were renamed to r->headers_in.cookie and u->headers_in.set_cookie to match header names. The ngx_http_parse_multi_header_lines() and ngx_http_parse_set_cookie_lines() functions were changed accordingly. With this change, multi headers are now essentially equivalent to normal headers, and following changes will further make them equivalent.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 30 May 2022 21:25:33 +0300
parents 32b0ba4855a6
children 262c01782566
comparison
equal deleted inserted replaced
8023:08b3ea81ff5f 8024:ef6a3a99a81a
672 672
673 673
674 static ngx_int_t 674 static ngx_int_t
675 ngx_http_v2_push_resources(ngx_http_request_t *r) 675 ngx_http_v2_push_resources(ngx_http_request_t *r)
676 { 676 {
677 u_char *start, *end, *last; 677 u_char *start, *end, *last;
678 ngx_int_t rc; 678 ngx_int_t rc;
679 ngx_str_t path; 679 ngx_str_t path;
680 ngx_uint_t i, push; 680 ngx_uint_t i, push;
681 ngx_table_elt_t **h; 681 ngx_table_elt_t *h;
682 ngx_http_v2_loc_conf_t *h2lcf; 682 ngx_http_v2_loc_conf_t *h2lcf;
683 ngx_http_complex_value_t *pushes; 683 ngx_http_complex_value_t *pushes;
684 ngx_str_t binary[NGX_HTTP_V2_PUSH_HEADERS]; 684 ngx_str_t binary[NGX_HTTP_V2_PUSH_HEADERS];
685 685
686 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 686 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
687 "http2 push resources"); 687 "http2 push resources");
688 688
689 ngx_memzero(binary, NGX_HTTP_V2_PUSH_HEADERS * sizeof(ngx_str_t)); 689 ngx_memzero(binary, NGX_HTTP_V2_PUSH_HEADERS * sizeof(ngx_str_t));
723 723
724 if (!h2lcf->push_preload) { 724 if (!h2lcf->push_preload) {
725 return NGX_OK; 725 return NGX_OK;
726 } 726 }
727 727
728 h = r->headers_out.link.elts; 728 for (h = r->headers_out.link; h; h = h->next) {
729
730 for (i = 0; i < r->headers_out.link.nelts; i++) {
731 729
732 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 730 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
733 "http2 parse link: \"%V\"", &h[i]->value); 731 "http2 parse link: \"%V\"", &h->value);
734 732
735 start = h[i]->value.data; 733 start = h->value.data;
736 end = h[i]->value.data + h[i]->value.len; 734 end = h->value.data + h->value.len;
737 735
738 next_link: 736 next_link:
739 737
740 while (start < end && *start == ' ') { start++; } 738 while (start < end && *start == ' ') { start++; }
741 739