[PATCH 16 of 20] Upstream: duplicate headers ignored or properly linked
Maxim Dounin
mdounin at mdounin.ru
Fri May 13 00:34:16 UTC 2022
Hello!
On Thu, May 12, 2022 at 12:33:53AM +0400, Sergey Kandaurov wrote:
> On Thu, Apr 21, 2022 at 01:18:56AM +0300, Maxim Dounin wrote:
> > # HG changeset patch
> > # User Maxim Dounin <mdounin at mdounin.ru>
> > # Date 1650492338 -10800
> > # Thu Apr 21 01:05:38 2022 +0300
> > # Node ID f460a2f9f88d264ef6c8588eb37bcb85c48010db
> > # Parent ab424b5e32405aeec54ccdfe38e9408209209e0a
> > Upstream: duplicate headers ignored or properly linked.
> >
> > Most of the known duplicate upstream response headers are now ignored
> > with a warning.
> >
> > If syntax permits multiple headers, these are now properly linked to
> > the lists, notably Vary and WWW-Authenticate. This makes it possible
> > to further handle such lists where it makes sense.
>
> This reminds me of curl deficiency to handle WWW-Authenticate
> as a comma-separate multi-value header (which nginx doesn't emit though):
> https://curl.se/mail/lib-2020-01/0064.html
> https://curl.se/docs/knownbugs.html
>
> >
> > diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
> > --- a/src/http/ngx_http_upstream.c
> > +++ b/src/http/ngx_http_upstream.c
> > @@ -101,6 +101,9 @@ static void ngx_http_upstream_finalize_r
> >
> > static ngx_int_t ngx_http_upstream_process_header_line(ngx_http_request_t *r,
> > ngx_table_elt_t *h, ngx_uint_t offset);
> > +static ngx_int_t
> > + ngx_http_upstream_process_multi_header_lines(ngx_http_request_t *r,
> > + ngx_table_elt_t *h, ngx_uint_t offset);
>
> I'd suggest renaming this pair to ngx_http_upstream_process_header_line /
> ngx_http_upstream_process_unique_header_line to be on par with functions
> in ngx_http_request.c (and after the 7th renaming patch of this series).
The ngx_http_upstream_process_unique_header_line() implies that an
attempt to provide a duplicate header will result in an error. In
contrast, ngx_http_upstream_process_header_line() simply ignores
extra header lines (with a warning), so the name is intentionally
preserved as is.
--
Maxim Dounin
http://mdounin.ru/
More information about the nginx-devel
mailing list