# --- SDE-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: package/.../lighttpd/fix-fastcgi.patch # Copyright (C) 2006 The OpenSDE Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # --- SDE-COPYRIGHT-NOTE-END --- from http://trac.lighttpd.net/trac/ticket/729 Incorrect PATH_INFO when FastCGI is serving "/" --- ./src/mod_fastcgi.c (revision 1632) +++ ./src/mod_fastcgi.c (local) @@ -3480,13 +3480,22 @@ * * SCRIPT_NAME = /fcgi-bin/foo * PATH_INFO = /bar + * + * if prefix = / + * + * /foo/bar + * + * SCRIPT_NAME = + * PATH_INFO = /foo/bar * */ /* the rewrite is only done for /prefix/? matches */ if (extension->key->ptr[0] == '/' && - con->uri.path->used > extension->key->used && - NULL != (pathinfo = strchr(con->uri.path->ptr + extension->key->used - 1, '/'))) { + /* Special case for "/" */ + ((extension->key->ptr[1] == '\0' && (pathinfo = con->uri.path->ptr)) + || (con->uri.path->used > extension->key->used && + NULL != (pathinfo = strchr(con->uri.path->ptr + extension->key->used - 1, '/'))))) { /* rewrite uri.path and pathinfo */ buffer_copy_string(con->request.pathinfo, pathinfo);