summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstbuehler <stbuehler@152afb58-edef-0310-8abb-c4023f1b3aa9>2013-08-30 15:02:44 +0000
committerstbuehler <stbuehler@152afb58-edef-0310-8abb-c4023f1b3aa9>2013-08-30 15:02:44 +0000
commit3b615e03df538c26110cfe07885d4634ad7894e6 (patch)
treeb0b892aae1043e252a8726a526910a66ac555317
parent83d4a0f189fde51f3b19c1e90a391d69c0702cac (diff)
downloadlighttpd-3b615e03df538c26110cfe07885d4634ad7894e6.tar.gz
[core] allow files to be used as document-root (fixes #2475)
From: Stefan Bühler <stbuehler@web.de> git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2900 152afb58-edef-0310-8abb-c4023f1b3aa9
-rw-r--r--NEWS1
-rw-r--r--src/mod_alias.c3
-rw-r--r--src/response.c2
3 files changed, 4 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index df6652fd..ed7c03a5 100644
--- a/NEWS
+++ b/NEWS
@@ -32,6 +32,7 @@ NEWS
* [core] check whether server.chroot exists
* [mod_simple_vhost] fix cache; skip module if simple-vhost.server-root is empty (thx rm for reporting)
* [mod_accesslog] add accesslog.syslog-level option (fixes #2480)
+ * [core] allow files to be used as document-root (fixes #2475)
- 1.4.32 - 2012-11-21
* Code cleanup with clang/sparse (fixes #2437, thx kibi)
diff --git a/src/mod_alias.c b/src/mod_alias.c
index 5b7b5107..0bac56b1 100644
--- a/src/mod_alias.c
+++ b/src/mod_alias.c
@@ -156,7 +156,8 @@ PHYSICALPATH_FUNC(mod_alias_physical_handler) {
mod_alias_patch_connection(srv, con, p);
/* not to include the tailing slash */
- basedir_len = (con->physical.basedir->used - 1) - 1;
+ basedir_len = (con->physical.basedir->used - 1);
+ if ('/' == con->physical.basedir->ptr[basedir_len-1]) --basedir_len;
uri_len = con->physical.path->used - 1 - basedir_len;
uri_ptr = con->physical.path->ptr + basedir_len;
diff --git a/src/response.c b/src/response.c
index 0875efd8..1198d491 100644
--- a/src/response.c
+++ b/src/response.c
@@ -517,8 +517,8 @@ handler_t http_response_prepare(server *srv, connection *con) {
*/
buffer_copy_string_buffer(con->physical.path, con->physical.doc_root);
- BUFFER_APPEND_SLASH(con->physical.path);
buffer_copy_string_buffer(con->physical.basedir, con->physical.path);
+ BUFFER_APPEND_SLASH(con->physical.path);
if (con->physical.rel_path->used &&
con->physical.rel_path->ptr[0] == '/') {
buffer_append_string_len(con->physical.path, con->physical.rel_path->ptr + 1, con->physical.rel_path->used - 2);