Fix workaround for incorrect path info/scriptname if scgi prefix is "/" (fixes #729)

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2498 152afb58-edef-0310-8abb-c4023f1b3aa9
This commit is contained in:
Stefan Bühler 2009-04-29 14:51:35 +00:00
parent a78acf99a1
commit 9c53e2ef80
2 changed files with 6 additions and 5 deletions

1
NEWS
View File

@ -38,6 +38,7 @@ NEWS
* Fix SERVER_NAME port stripping (fixes #1968)
* Fix x-sendfile 2gb limiting (fixes #1970)
* Fix mod_cgi environment keys mangling (fixes #1969)
* Fix workaround for incorrect path info/scriptname if scgi prefix is "/" (fixes #729)
- 1.4.22 - 2009-03-07
* Fix wrong lua type for CACHE_MISS/CACHE_HIT in mod_cml (fixes #533)

View File

@ -2838,7 +2838,11 @@ static handler_t scgi_check_extension(server *srv, connection *con, void *p_d, i
*/
/* the rewrite is only done for /prefix/? matches */
if (extension->key->ptr[0] == '/' &&
if (host->fix_root_path_name && extension->key->ptr[0] == '/' && extension->key->ptr[1] == '\0') {
buffer_copy_string(con->request.pathinfo, con->uri.path->ptr);
con->uri.path->used = 1;
con->uri.path->ptr[con->uri.path->used - 1] = '\0';
} else if (extension->key->ptr[0] == '/' &&
con->uri.path->used > extension->key->used &&
NULL != (pathinfo = strchr(con->uri.path->ptr + extension->key->used - 1, '/'))) {
/* rewrite uri.path and pathinfo */
@ -2847,10 +2851,6 @@ static handler_t scgi_check_extension(server *srv, connection *con, void *p_d, i
con->uri.path->used -= con->request.pathinfo->used - 1;
con->uri.path->ptr[con->uri.path->used - 1] = '\0';
} else if (host->fix_root_path_name && extension->key->ptr[0] == '/' && extension->key->ptr[1] == '\0') {
buffer_copy_string(con->request.pathinfo, con->uri.path->ptr);
con->uri.path->used = 1;
con->uri.path->ptr[con->uri.path->used - 1] = '\0';
}
}
} else {