Browse Source

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
svn/tags/lighttpd-1.4.27
Stefan Bühler 11 years ago
parent
commit
b7cc84abc8
  1. 1
      NEWS
  2. 42
      src/configfile.c

1
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)

42
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;
}
}
}
}

Loading…
Cancel
Save