mirror of
https://github.com/nginx/nginx.git
synced 2025-07-25 06:37:58 +08:00
Perl: combining unknown headers during $r->header_in() lookup.
This commit is contained in:
parent
dab1b086ef
commit
1d22d0f56b
@ -272,7 +272,7 @@ header_in(r, key)
|
||||
ngx_uint_t i, n, hash;
|
||||
ngx_array_t *a;
|
||||
ngx_list_part_t *part;
|
||||
ngx_table_elt_t *h, **ph;
|
||||
ngx_table_elt_t *h, *header, **ph;
|
||||
ngx_http_header_t *hh;
|
||||
ngx_http_core_main_conf_t *cmcf;
|
||||
|
||||
@ -311,13 +311,50 @@ header_in(r, key)
|
||||
|
||||
ph = (ngx_table_elt_t **) ((char *) &r->headers_in + hh->offset);
|
||||
|
||||
goto found;
|
||||
}
|
||||
|
||||
/* iterate over all headers */
|
||||
|
||||
sep = ',';
|
||||
ph = &header;
|
||||
|
||||
part = &r->headers_in.headers.part;
|
||||
h = part->elts;
|
||||
|
||||
for (i = 0; /* void */ ; i++) {
|
||||
|
||||
if (i >= part->nelts) {
|
||||
if (part->next == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
part = part->next;
|
||||
h = part->elts;
|
||||
i = 0;
|
||||
}
|
||||
|
||||
if (len != h[i].key.len
|
||||
|| ngx_strcasecmp(p, h[i].key.data) != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
*ph = &h[i];
|
||||
ph = &h[i].next;
|
||||
}
|
||||
|
||||
*ph = NULL;
|
||||
ph = &header;
|
||||
|
||||
found:
|
||||
|
||||
if (*ph == NULL) {
|
||||
XSRETURN_UNDEF;
|
||||
}
|
||||
|
||||
if ((*ph)->next == NULL) {
|
||||
ngx_http_perl_set_targ((*ph)->value.data, (*ph)->value.len);
|
||||
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -347,39 +384,6 @@ header_in(r, key)
|
||||
|
||||
ngx_http_perl_set_targ(value, size);
|
||||
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* iterate over all headers */
|
||||
|
||||
part = &r->headers_in.headers.part;
|
||||
h = part->elts;
|
||||
|
||||
for (i = 0; /* void */ ; i++) {
|
||||
|
||||
if (i >= part->nelts) {
|
||||
if (part->next == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
part = part->next;
|
||||
h = part->elts;
|
||||
i = 0;
|
||||
}
|
||||
|
||||
if (len != h[i].key.len
|
||||
|| ngx_strcasecmp(p, h[i].key.data) != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ngx_http_perl_set_targ(h[i].value.data, h[i].value.len);
|
||||
|
||||
goto done;
|
||||
}
|
||||
|
||||
XSRETURN_UNDEF;
|
||||
|
||||
done:
|
||||
|
||||
ST(0) = TARG;
|
||||
|
Loading…
Reference in New Issue
Block a user