comparison src/http/modules/ngx_http_geo_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 286ae954009d
children
comparison
equal deleted inserted replaced
8023:08b3ea81ff5f 8024:ef6a3a99a81a
325 325
326 static ngx_int_t 326 static ngx_int_t
327 ngx_http_geo_addr(ngx_http_request_t *r, ngx_http_geo_ctx_t *ctx, 327 ngx_http_geo_addr(ngx_http_request_t *r, ngx_http_geo_ctx_t *ctx,
328 ngx_addr_t *addr) 328 ngx_addr_t *addr)
329 { 329 {
330 ngx_array_t *xfwd; 330 ngx_table_elt_t *xfwd;
331 331
332 if (ngx_http_geo_real_addr(r, ctx, addr) != NGX_OK) { 332 if (ngx_http_geo_real_addr(r, ctx, addr) != NGX_OK) {
333 return NGX_ERROR; 333 return NGX_ERROR;
334 } 334 }
335 335
336 xfwd = &r->headers_in.x_forwarded_for; 336 xfwd = r->headers_in.x_forwarded_for;
337 337
338 if (xfwd->nelts > 0 && ctx->proxies != NULL) { 338 if (xfwd != NULL && ctx->proxies != NULL) {
339 (void) ngx_http_get_forwarded_addr(r, addr, xfwd, NULL, 339 (void) ngx_http_get_forwarded_addr(r, addr, xfwd, NULL,
340 ctx->proxies, ctx->proxy_recursive); 340 ctx->proxies, ctx->proxy_recursive);
341 } 341 }
342 342
343 return NGX_OK; 343 return NGX_OK;