summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2010-08-07 11:56:09 +0000
committerStefan Bühler <stbuehler@web.de>2010-08-07 11:56:09 +0000
commitb7cc84abc83fbc62c26596db742efd4995354214 (patch)
treeac6d59e14db796979af8a3db4ee21cf89179b137
parent00265fbdb3f7129a4588eeb1a5ada66623260f54 (diff)
downloadlighttpd-git-b7cc84abc83fbc62c26596db742efd4995354214.tar.gz
don't overwrite global server.force-lowercase-filenames setting (fixes #2042)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2757 152afb58-edef-0310-8abb-c4023f1b3aa9
-rw-r--r--NEWS1
-rw-r--r--src/configfile.c42
2 files changed, 24 insertions, 19 deletions
diff --git a/NEWS b/NEWS
index c95f713a..dfe2ebcc 100644
--- a/NEWS
+++ b/NEWS
@@ -31,6 +31,7 @@ NEWS
* only require FDEVENT_IN bit to be set for listening connections (fixes #2227)
* add libev fdevent handler: server.event-handler = "libev"
* mod_proxy: return response as soon as it is available (fixes #2196)
+ * don't overwrite global server.force-lowercase-filenames setting (fixes #2042)
- 1.4.26 - 2010-02-07
* Fix request parser to handle packets with splitted \r\n\r\n (fixes #2105)
diff --git a/src/configfile.c b/src/configfile.c
index bfd5b55c..cecef076 100644
--- a/src/configfile.c
+++ b/src/configfile.c
@@ -180,7 +180,7 @@ static int config_insert(server *srv) {
s->etag_use_mtime = 1;
s->etag_use_size = 1;
s->range_requests = 1;
- s->force_lowercase_filenames = 0;
+ s->force_lowercase_filenames = (i == 0) ? 2 : 0; /* we wan't to detect later if user changed this for global section */
s->global_kbytes_per_second = 0;
s->global_bytes_per_second_cnt = 0;
s->global_bytes_per_second_cnt_ptr = &s->global_bytes_per_second_cnt;
@@ -1229,35 +1229,39 @@ int config_set_defaults(server *srv) {
buffer_to_lower(srv->tmp_buf);
- if (0 == stat(srv->tmp_buf->ptr, &st1)) {
- int is_lower = 0;
+ if (2 == s->force_lowercase_filenames) { /* user didn't configure it in global section? */
+ s->force_lowercase_filenames = 0; /* default to 0 */
- is_lower = buffer_is_equal(srv->tmp_buf, s->document_root);
+ if (0 == stat(srv->tmp_buf->ptr, &st1)) {
+ int is_lower = 0;
- /* lower-case existed, check upper-case */
- buffer_copy_string_buffer(srv->tmp_buf, s->document_root);
+ is_lower = buffer_is_equal(srv->tmp_buf, s->document_root);
- buffer_to_upper(srv->tmp_buf);
+ /* lower-case existed, check upper-case */
+ buffer_copy_string_buffer(srv->tmp_buf, s->document_root);
- /* we have to handle the special case that upper and lower-casing results in the same filename
- * as in server.document-root = "/" or "/12345/" */
+ buffer_to_upper(srv->tmp_buf);
- if (is_lower && buffer_is_equal(srv->tmp_buf, s->document_root)) {
- /* lower-casing and upper-casing didn't result in
- * an other filename, no need to stat(),
- * just assume it is case-sensitive. */
+ /* we have to handle the special case that upper and lower-casing results in the same filename
+ * as in server.document-root = "/" or "/12345/" */
- s->force_lowercase_filenames = 0;
- } else if (0 == stat(srv->tmp_buf->ptr, &st2)) {
+ if (is_lower && buffer_is_equal(srv->tmp_buf, s->document_root)) {
+ /* lower-casing and upper-casing didn't result in
+ * an other filename, no need to stat(),
+ * just assume it is case-sensitive. */
- /* upper case exists too, doesn't the FS handle this ? */
+ s->force_lowercase_filenames = 0;
+ } else if (0 == stat(srv->tmp_buf->ptr, &st2)) {
- /* upper and lower have the same inode -> case-insensitve FS */
+ /* upper case exists too, doesn't the FS handle this ? */
- if (st1.st_ino == st2.st_ino) {
/* upper and lower have the same inode -> case-insensitve FS */
- s->force_lowercase_filenames = 1;
+ if (st1.st_ino == st2.st_ino) {
+ /* upper and lower have the same inode -> case-insensitve FS */
+
+ s->force_lowercase_filenames = 1;
+ }
}
}
}