issue with capturing server name

Igor Sysoev igor at sysoev.ru
Sun Dec 12 23:45:38 MSK 2010


On Sun, Dec 12, 2010 at 09:05:49PM +0100, Sven 'Darkman' Michels wrote:

> Hi,
> 
> Am 12.12.2010 20:59, schrieb Igor Sysoev:
> >> plenty but i got it. You're right with the v4/v6 thing. It works if i use v4
> >> only (e.g. just a "listen 80;" in the config). So i would say its a bug?
> > 
> > Do you have "listen" directives with specific addresses ?
> > How do other "listen" directives look ?
> 
> nope, its just a very small test config.
> 
> works:
>   server {
>     listen 80;
>     server_name ~^(?<domain>.+)\.internal\.mydomain\.tld$;
>   ...
>   }
> 
> doesn't:
>   server {
>   listen  [::]:80 default ipv6only=off;
>     server_name ~^(?<domain>.+)\.internal\.mydomain\.tld$;
>   ...
>   }
> 
> nothing else changed.

The attached patch should fix the bug.


-- 
Igor Sysoev
http://sysoev.ru/en/
-------------- next part --------------
Index: src/http/ngx_http.c
===================================================================
--- src/http/ngx_http.c	(revision 3143)
+++ src/http/ngx_http.c	(working copy)
@@ -1870,8 +1870,12 @@
         if (addr[i].hash.buckets == NULL
             && (addr[i].wc_head == NULL
                 || addr[i].wc_head->hash.buckets == NULL)
-            && (addr[i].wc_head == NULL
-                || addr[i].wc_head->hash.buckets == NULL))
+            && (addr[i].wc_tail == NULL
+                || addr[i].wc_tail->hash.buckets == NULL)
+#if (NGX_PCRE)
+            && addr[i].nregex == 0
+#endif
+            )
         {
             continue;
         }


More information about the nginx mailing list