Mercurial > hg > nginx
comparison src/http/modules/ngx_http_realip_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 | 06b01840bd42 |
children |
comparison
equal
deleted
inserted
replaced
8023:08b3ea81ff5f | 8024:ef6a3a99a81a |
---|---|
132 u_char *p; | 132 u_char *p; |
133 size_t len; | 133 size_t len; |
134 ngx_str_t *value; | 134 ngx_str_t *value; |
135 ngx_uint_t i, hash; | 135 ngx_uint_t i, hash; |
136 ngx_addr_t addr; | 136 ngx_addr_t addr; |
137 ngx_array_t *xfwd; | |
138 ngx_list_part_t *part; | 137 ngx_list_part_t *part; |
139 ngx_table_elt_t *header; | 138 ngx_table_elt_t *header, *xfwd; |
140 ngx_connection_t *c; | 139 ngx_connection_t *c; |
141 ngx_http_realip_ctx_t *ctx; | 140 ngx_http_realip_ctx_t *ctx; |
142 ngx_http_realip_loc_conf_t *rlcf; | 141 ngx_http_realip_loc_conf_t *rlcf; |
143 | 142 |
144 rlcf = ngx_http_get_module_loc_conf(r, ngx_http_realip_module); | 143 rlcf = ngx_http_get_module_loc_conf(r, ngx_http_realip_module); |
166 | 165 |
167 break; | 166 break; |
168 | 167 |
169 case NGX_HTTP_REALIP_XFWD: | 168 case NGX_HTTP_REALIP_XFWD: |
170 | 169 |
171 xfwd = &r->headers_in.x_forwarded_for; | 170 xfwd = r->headers_in.x_forwarded_for; |
172 | 171 |
173 if (xfwd->elts == NULL) { | 172 if (xfwd == NULL) { |
174 return NGX_DECLINED; | 173 return NGX_DECLINED; |
175 } | 174 } |
176 | 175 |
177 value = NULL; | 176 value = NULL; |
178 | 177 |