Project

General

Profile

Actions

Bug #2861

closed

Regression: PHP URLs return 404 from lighttpd when they contain PATH_INFO ending in a trailing slash.

Added by ReimuHakurei about 6 years ago. Updated about 6 years ago.

Status:
Fixed
Priority:
Normal
Category:
core
Target version:
ASK QUESTIONS IN Forums:

Description

Sometime between 1.4.48 and latest Git master, this bug has been introduced.

http://someserver/index.php/whatever <- works, gets passed along to PHP properly
http://someserver/index.php/whatever/ <- lighttpd returns 404, doesn't get passed along to PHP.

Actions #1

Updated by gstrauss about 6 years ago

  • Category set to core
  • Target version changed from 1.4.x to 1.4.49

Thanks for reporting this. Bug would probably be in commit ec9e6abc I will look further later today.

Actions #2

Updated by gstrauss about 6 years ago

Looks like 'pathinfo' variable was incorrectly overloaded in the code and I need to add back 'found' flag.

Actions #3

Updated by gstrauss about 6 years ago

--- a/src/response.c
+++ b/src/response.c
@@ -184,12 +184,14 @@ static handler_t http_response_physical_path_check(server *srv, connection *con)
                        if ('/' != *pathinfo) pathinfo = NULL;
                }

-               for (; pathinfo; pathinfo = strchr(pathinfo+1, '/')) {
-                       handler_t rc;
-                       *pathinfo = '\0';
-                       rc = stat_cache_get_entry(srv, con, con->physical.path, &sce);
-                       *pathinfo = '/';
-                       if (HANDLER_ERROR == rc) { pathinfo = NULL; break; }
+               for (char *pprev = pathinfo; pathinfo; pprev = pathinfo, pathinfo = strchr(pathinfo+1, '/')) {
+                       stat_cache_entry *nsce = NULL;
+                       buffer_copy_string_len(srv->tmp_buf, con->physical.path->ptr, pathinfo - con->physical.path->ptr);
+                       if (HANDLER_ERROR == stat_cache_get_entry(srv, con, srv->tmp_buf, &nsce)) {
+                               pathinfo = pathinfo != pprev ? pprev : NULL;
+                               break;
+                       }
+                       sce = nsce;
                        if (!S_ISDIR(sce->st.st_mode)) break;
                }

Actions #4

Updated by gstrauss about 6 years ago

  • Status changed from New to Patch Pending
Actions #5

Updated by gstrauss about 6 years ago

  • Status changed from Patch Pending to Fixed
  • % Done changed from 0 to 100
Actions

Also available in: Atom