[PATCH] Bugfix fastcgi_split_path_info

Frank Enderle frank.enderle at anamica.de
Thu Jul 22 23:12:22 MSD 2010


hi,

the following regex won't split correctly for nginx 0.8.46 due to a bug
in the capture offset processing. The problem occurs when the URI is not
fully captured but contains elements which should not be subject to the
split.

fastcgi_split_path_info ^/services(/[^/]+)(/?.*)$;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;

the following patch fixes the problem. it would be great if it could be
integrated in upcoming releases.

cheers,

frank.

--- ngx_http_fastcgi_module.c   2010-07-22 21:03:19.000000000 +0200
+++ ngx_http_fastcgi_module.c.orig      2010-07-22 21:03:01.000000000 +0200
@@ -2558,10 +2558,10 @@

     if (n >= 0) { /* match */
         f->script_name.len = captures[3] - captures[2];
-        f->script_name.data = r->uri.data + captures[2];
+        f->script_name.data = r->uri.data;

         f->path_info.len = captures[5] - captures[4];
-        f->path_info.data = r->uri.data + captures[4];
+        f->path_info.data = r->uri.data + f->script_name.len;

         return f;
     }



More information about the nginx-devel mailing list