Fix the incorrect value of $host when IPv6 in Host header

Speed First speedfirst at gmail.com
Wed Aug 31 07:46:50 UTC 2011


This is the diff to fix the problem of
http://forum.nginx.org/read.php?2,214541

Can this be integrated into main branch? Thanks.


--- ngx_http_request.c 2011-08-24 05:21:59.354049000 -0700
+++ ngx_http_request.c.backup 2011-08-24 05:05:33.244048997 -0700
@@ -1658,20 +1658,10 @@
     size_t       i, last;
     ngx_uint_t   dot;

-#if (NGX_HAVE_INET6)
-    ngx_uint_t   ipv6 = 0;
-#endif
-
     last = len;
     h = *host;
     dot = 0;

-#if (NGX_HAVE_INET6)
-    if (len > 0 && h[0] == '[') {
-        ipv6 = 1;
-    }
-#endif
-
     for (i = 0; i < len; i++) {
         ch = h[i];

@@ -1687,13 +1677,7 @@
         dot = 0;

         if (ch == ':') {
-#if (NGX_HAVE_INET6)
-            if (!ipv6) {
-                last = i;
-            }
-#else
             last = i;
-#endif
             continue;
         }

@@ -1704,11 +1688,6 @@
         if (ch >= 'A' || ch < 'Z') {
             alloc = 1;
         }
-#if (NGX_HAVE_INET6)
-        if (ch == ']') {
-            ipv6 = 0;
-        }
-#endif
     }

     if (dot) {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20110831/3e68b7e1/attachment.html>


More information about the nginx-devel mailing list