[core] PATH_INFO calculation when basedir is "/" (fixes #2911)

PATH_INFO calculation when basedir is "/" or empty

x-ref:
  "pathinfo not recognized if basedir is empty"
  https://redmine.lighttpd.net/issues/2911
personal/stbuehler/fix-fdevent
Glenn Strauss 2018-10-04 23:32:41 -04:00
parent e3c39f5cbc
commit 7af5ba92ed
1 changed files with 6 additions and 1 deletions

View File

@ -171,7 +171,12 @@ static handler_t http_response_physical_path_check(server *srv, connection *con)
size_t len = buffer_string_length(con->physical.basedir);
if (len > 0 && '/' == con->physical.basedir->ptr[len-1]) --len;
pathinfo = con->physical.path->ptr + len;
if ('/' != *pathinfo) pathinfo = NULL;
if ('/' != *pathinfo) {
pathinfo = NULL;
}
else if (pathinfo == con->physical.path->ptr) { /*(basedir is "/")*/
pathinfo = strchr(pathinfo+1, '/');
}
}
for (char *pprev = pathinfo; pathinfo; pprev = pathinfo, pathinfo = strchr(pathinfo+1, '/')) {