ðòïåëôù 


  áòèé÷ 


Apache-Talk @lexa.ru 

Inet-Admins @info.east.ru 

Filmscanners @halftone.co.uk 

Security-alerts @yandex-team.ru 

nginx-ru @sysoev.ru 


  óôáôøé 


  ðåòóïîáìøîïå 


  ðòïçòáííù 



ðéûéôå
ðéóøíá












     áòèé÷ :: nginx-ru
Nginx-ru mailing list archive (nginx-ru@sysoev.ru)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: captures in regex location



On Sat, Mar 07, 2009 at 02:22:43PM +0300, Vladimir Sopot wrote:

> ÷ÒÏÄÅ ×ÏÔ ÔÁË -

äÏÐÏÌÎÉÔÅÌØÎÙÊ ÐÁÔÞ.


-- 
éÇÏÒØ óÙÓÏÅ×
http://sysoev.ru
Index: src/http/ngx_http_request.c
===================================================================
--- src/http/ngx_http_request.c (revision 1871)
+++ src/http/ngx_http_request.c (working copy)
@@ -1611,6 +1611,7 @@
 ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, size_t len)
 {
     u_char                    *server;
+    size_t                     clen;
     ngx_uint_t                 hash;
     ngx_http_virtual_names_t  *vn;
     ngx_http_core_loc_conf_t  *clcf;
@@ -1653,7 +1654,7 @@
         name.len = len;
         name.data = server;
 
-        len = 0;
+        clen = 0;
 
         sn = vn->regex;
 
@@ -1661,9 +1662,9 @@
 
             if (sn[i].captures && r->captures == NULL) {
 
-                len = (NGX_HTTP_MAX_CAPTURES + 1) * 3 * sizeof(int);
+                clen = (NGX_HTTP_MAX_CAPTURES + 1) * 3 * sizeof(int);
 
-                r->captures = ngx_palloc(r->pool, len);
+                r->captures = ngx_palloc(r->pool, clen);
                 if (r->captures == NULL) {
                     return NGX_ERROR;
                 }
@@ -1679,7 +1680,7 @@
                 }
             }
 
-            n = ngx_regex_exec(sn[i].regex, &name, r->captures, len);
+            n = ngx_regex_exec(sn[i].regex, &name, r->captures, clen);
 
             if (n == NGX_REGEX_NO_MATCHED) {
                 continue;
@@ -1697,7 +1698,7 @@
 
             cscf = sn[i].core_srv_conf;
 
-            r->ncaptures = len;
+            r->ncaptures = clen;
             r->captures_data = server;
 
             goto found;


 




Copyright © Lexa Software, 1996-2009.