summaryrefslogtreecommitdiff
path: root/src/mod_staticfile.c
diff options
context:
space:
mode:
authorArno Töll <arno@debian.org>2012-11-21 23:04:01 +0100
committerArno Töll <arno@debian.org>2012-11-21 23:04:01 +0100
commit7074704eb0b50f755f30ef21bbeb8fa064e2df5d (patch)
treeb84509f1b2ac0b565b03914c4fd4f907d9d4cefc /src/mod_staticfile.c
parentc0f89a02702b44a811cac511838cbd217ee5dd82 (diff)
downloadlighttpd-7074704eb0b50f755f30ef21bbeb8fa064e2df5d.tar.gz
Imported Upstream version 1.4.30upstream/1.4.30
Diffstat (limited to 'src/mod_staticfile.c')
-rw-r--r--src/mod_staticfile.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/mod_staticfile.c b/src/mod_staticfile.c
index 9b937ce..f5114dd 100644
--- a/src/mod_staticfile.c
+++ b/src/mod_staticfile.c
@@ -26,6 +26,7 @@
typedef struct {
array *exclude_ext;
unsigned short etags_used;
+ unsigned short disable_pathinfo;
} plugin_config;
typedef struct {
@@ -84,6 +85,7 @@ SETDEFAULTS_FUNC(mod_staticfile_set_defaults) {
config_values_t cv[] = {
{ "static-file.exclude-extensions", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION }, /* 0 */
{ "static-file.etags", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 1 */
+ { "static-file.disable-pathinfo", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 2 */
{ NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
};
@@ -97,9 +99,11 @@ SETDEFAULTS_FUNC(mod_staticfile_set_defaults) {
s = calloc(1, sizeof(plugin_config));
s->exclude_ext = array_init();
s->etags_used = 1;
+ s->disable_pathinfo = 0;
cv[0].destination = s->exclude_ext;
cv[1].destination = &(s->etags_used);
+ cv[2].destination = &(s->disable_pathinfo);
p->config_storage[i] = s;
@@ -119,6 +123,7 @@ static int mod_staticfile_patch_connection(server *srv, connection *con, plugin_
PATCH(exclude_ext);
PATCH(etags_used);
+ PATCH(disable_pathinfo);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
@@ -136,7 +141,9 @@ static int mod_staticfile_patch_connection(server *srv, connection *con, plugin_
PATCH(exclude_ext);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("static-file.etags"))) {
PATCH(etags_used);
- }
+ } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("static-file.disable-pathinfo"))) {
+ PATCH(disable_pathinfo);
+ }
}
}
@@ -350,7 +357,6 @@ static int http_response_parse_range(server *srv, connection *con, plugin_data *
URIHANDLER_FUNC(mod_staticfile_subrequest) {
plugin_data *p = p_d;
size_t k;
- int s_len;
stat_cache_entry *sce = NULL;
buffer *mtime = NULL;
data_string *ds;
@@ -376,7 +382,12 @@ URIHANDLER_FUNC(mod_staticfile_subrequest) {
mod_staticfile_patch_connection(srv, con, p);
- s_len = con->uri.path->used - 1;
+ if (p->conf.disable_pathinfo && 0 != con->request.pathinfo->used) {
+ if (con->conf.log_request_handling) {
+ log_error_write(srv, __FILE__, __LINE__, "s", "-- NOT handling file as static file, pathinfo forbidden");
+ }
+ return HANDLER_GO_ON;
+ }
/* ignore certain extensions */
for (k = 0; k < p->conf.exclude_ext->used; k++) {