[PATCH 08 of 20] Perl: all known input headers are handled identically

Maxim Dounin mdounin at mdounin.ru
Wed Apr 20 22:18:48 UTC 2022


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1650492326 -10800
#      Thu Apr 21 01:05:26 2022 +0300
# Node ID bf163552d6a9919f3c614aeb975202eda35c07c0
# Parent  238d1f5f438735432822689605fa37b1b0e01517
Perl: all known input headers are handled identically.

As all known input headers are now linked lists, these are now handled
identically.  In particular, this makes it possible to access properly
combined values of headers not specifically handled previously, such
as "Via" or "Connection".

diff --git a/src/http/modules/perl/nginx.xs b/src/http/modules/perl/nginx.xs
--- a/src/http/modules/perl/nginx.xs
+++ b/src/http/modules/perl/nginx.xs
@@ -304,28 +304,10 @@ header_in(r, key)
 
         if (hh->offset == offsetof(ngx_http_headers_in_t, cookie)) {
             sep = ';';
-            goto multi;
-        }
-#if (NGX_HTTP_X_FORWARDED_FOR)
-        if (hh->offset == offsetof(ngx_http_headers_in_t, x_forwarded_for)) {
+
+        } else {
             sep = ',';
-            goto multi;
         }
-#endif
-
-        ph = (ngx_table_elt_t **) ((char *) &r->headers_in + hh->offset);
-
-        if (*ph) {
-            ngx_http_perl_set_targ((*ph)->value.data, (*ph)->value.len);
-
-            goto done;
-        }
-
-        XSRETURN_UNDEF;
-
-    multi:
-
-        /* Cookie, X-Forwarded-For */
 
         ph = (ngx_table_elt_t **) ((char *) &r->headers_in + hh->offset);
 



More information about the nginx-devel mailing list