summaryrefslogtreecommitdiff
path: root/src/mod_userdir.c
diff options
context:
space:
mode:
authorArno Töll <arno@debian.org>2012-11-21 23:03:52 +0100
committerArno Töll <arno@debian.org>2012-11-21 23:03:52 +0100
commit36c2c9520cdf4e725d0597eaa28c350087f1d3c0 (patch)
tree9337d6a9fac555f4391cf529a6a3c805db0b6d3a /src/mod_userdir.c
parentf1532bfdd56dc641ae366f6ecd4c490c11117aac (diff)
downloadlighttpd-36c2c9520cdf4e725d0597eaa28c350087f1d3c0.tar.gz
Imported Upstream version 1.4.22upstream/1.4.22
Diffstat (limited to 'src/mod_userdir.c')
-rw-r--r--src/mod_userdir.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/mod_userdir.c b/src/mod_userdir.c
index e664bf2..7ac5cc1 100644
--- a/src/mod_userdir.c
+++ b/src/mod_userdir.c
@@ -262,6 +262,9 @@ URIHANDLER_FUNC(mod_userdir_docroot_handler) {
return HANDLER_GO_ON;
}
}
+ if (con->conf.force_lowercase_filenames) {
+ buffer_to_lower(p->username);
+ }
buffer_copy_string_buffer(p->temp_path, p->conf.basepath);
BUFFER_APPEND_SLASH(p->temp_path);
@@ -284,8 +287,24 @@ URIHANDLER_FUNC(mod_userdir_docroot_handler) {
}
}
+ /* the physical rel_path is basically the same as uri.path;
+ * but it is converted to lowercase in case of force_lowercase_filenames and some special handling
+ * for trailing '.', ' ' and '/' on windows
+ * we assume that no docroot/physical handler changed this
+ * (docroot should only set the docroot/server name, phyiscal should only change the phyiscal.path;
+ * the exception mod_secure_download doesn't work with userdir anyway)
+ */
BUFFER_APPEND_SLASH(p->temp_path);
- buffer_append_string(p->temp_path, rel_url + 1); /* skip the / */
+ /* if no second '/' is found, we assume that it was stripped from the uri.path for the special handling
+ * on windows.
+ * we do not care about the trailing slash here on windows, as we already ensured it is a directory
+ *
+ * TODO: what to do with trailing dots in usernames on windows? they may result in the same directory
+ * as a username without them.
+ */
+ if (NULL != (rel_url = strchr(con->physical.rel_path->ptr + 2, '/'))) {
+ buffer_append_string(p->temp_path, rel_url + 1); /* skip the / */
+ }
buffer_copy_string_buffer(con->physical.path, p->temp_path);
buffer_reset(p->temp_path);