Browse Source

renamed server.force-lower-case-files to server.force-lowercase-filenams

- use case-insensitive matches for mod_auth too if the FS is lower-case


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@939 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.11
Jan Kneschke 17 years ago
parent
commit
4afd2ae2af
  1. 2
      src/base.h
  2. 17
      src/configfile.c
  3. 22
      src/mod_auth.c
  4. 2
      src/mod_webdav.c
  5. 2
      src/response.c

2
src/base.h

@ -260,7 +260,7 @@ typedef struct {
unsigned short use_ipv6;
unsigned short is_ssl;
unsigned short allow_http11;
unsigned short force_lower_case; /* if the FS is case-insensitive, force all files to lower-case */
unsigned short force_lowercase_filenames; /* if the FS is case-insensitive, force all files to lower-case */
unsigned short max_request_size;
unsigned short kbytes_per_second; /* connection kb/s limit */

17
src/configfile.c

@ -44,7 +44,7 @@ static int config_insert(server *srv) {
{ "server.max-request-size", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 12 */
{ "server.max-worker", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_SERVER }, /* 13 */
{ "server.document-root", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 14 */
{ "server.force-lower-case-files", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 15 */
{ "server.force-lowercase-filenames", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 15 */
{ "debug.log-condition-handling", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 16 */
{ "server.max-keep-alive-requests", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 17 */
{ "server.name", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 18 */
@ -89,6 +89,7 @@ static int config_insert(server *srv) {
{ "server.userid", "use server.username instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET },
{ "server.groupid", "use server.groupname instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET },
{ "server.use-keep-alive", "use server.max-keep-alive-requests = 0 instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET },
{ "server.force-lower-case-files", "use server.force-lowercase-filenames instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET },
{ NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
};
@ -149,7 +150,7 @@ static int config_insert(server *srv) {
s->kbytes_per_second = 0;
s->allow_http11 = 1;
s->range_requests = 1;
s->force_lower_case = 0;
s->force_lowercase_filenames = 0;
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;
@ -162,7 +163,7 @@ static int config_insert(server *srv) {
/* 13 max-worker */
cv[14].destination = s->document_root;
cv[15].destination = &(s->force_lower_case);
cv[15].destination = &(s->force_lowercase_filenames);
cv[16].destination = &(s->log_condition_handling);
cv[17].destination = &(s->max_keep_alive_requests);
cv[18].destination = s->server_name;
@ -246,7 +247,7 @@ int config_setup_connection(server *srv, connection *con) {
PATCH(log_file_not_found);
PATCH(range_requests);
PATCH(force_lower_case);
PATCH(force_lowercase_filenames);
PATCH(is_ssl);
PATCH(ssl_pemfile);
@ -318,8 +319,8 @@ int config_patch_connection(server *srv, connection *con, comp_key_t comp) {
PATCH(log_file_not_found);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("server.protocol-http11"))) {
PATCH(allow_http11);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("server.force-lower-case-files"))) {
PATCH(force_lower_case);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("server.force-lowercase-filenames"))) {
PATCH(force_lowercase_filenames);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("server.kbytes-per-second"))) {
PATCH(global_kbytes_per_second);
PATCH(global_bytes_per_second_cnt);
@ -1087,7 +1088,7 @@ int config_set_defaults(server *srv) {
* an other filename, no need to stat(),
* just assume it is case-sensitive. */
s->force_lower_case = 0;
s->force_lowercase_filenames = 0;
} else if (0 == stat(srv->tmp_buf->ptr, &st2)) {
/* upper case exists too, doesn't the FS handle this ? */
@ -1097,7 +1098,7 @@ int config_set_defaults(server *srv) {
if (st1.st_ino == st2.st_ino) {
/* upper and lower have the same inode -> case-insensitve FS */
s->force_lower_case = 1;
s->force_lowercase_filenames = 1;
}
}
}

22
src/mod_auth.c

@ -193,11 +193,23 @@ static handler_t mod_auth_uri_handler(server *srv, connection *con, void *p_d) {
/* search auth-directives for path */
for (k = 0; k < p->conf.auth_require->used; k++) {
if (p->conf.auth_require->data[k]->key->used == 0) continue;
if (0 == strncmp(con->uri.path->ptr, p->conf.auth_require->data[k]->key->ptr, p->conf.auth_require->data[k]->key->used - 1)) {
auth_required = 1;
break;
buffer *req = p->conf.auth_require->data[k]->key;
if (req->used == 0) continue;
if (con->uri.path->used < req->used) continue;
/* if we have a case-insensitive FS we have to lower-case the URI here too */
if (con->conf.force_lowercase_filenames) {
if (0 == strncasecmp(con->uri.path->ptr, req->ptr, req->used - 1)) {
auth_required = 1;
break;
}
} else {
if (0 == strncmp(con->uri.path->ptr, req->ptr, req->used - 1)) {
auth_required = 1;
break;
}
}
}

2
src/mod_webdav.c

@ -1542,7 +1542,7 @@ URIHANDLER_FUNC(mod_webdav_subrequest_handler) {
buffer_copy_string_buffer(p->physical.doc_root, con->physical.doc_root);
buffer_copy_string_buffer(p->physical.rel_path, p->uri.path);
if (con->conf.force_lower_case) {
if (con->conf.force_lowercase_filenames) {
buffer_to_lower(p->physical.rel_path);
}

2
src/response.c

@ -334,7 +334,7 @@ handler_t http_response_prepare(server *srv, connection *con) {
*
* convert to lower-case
*/
if (con->conf.force_lower_case) {
if (con->conf.force_lowercase_filenames) {
buffer_to_lower(con->physical.rel_path);
}

Loading…
Cancel
Save