diff options
author | Jan Kneschke <jan@kneschke.de> | 2007-04-10 07:52:58 +0000 |
---|---|---|
committer | Jan Kneschke <jan@kneschke.de> | 2007-04-10 07:52:58 +0000 |
commit | 5bd7d268e3bb8d896657bc66e1cd6dce6f99a7f6 (patch) | |
tree | b7be98ac319ad49f0ece4cccc68fcb445629400a | |
parent | 79339e6543e903226e62f2823de42cb219018a32 (diff) | |
download | lighttpd-git-5bd7d268e3bb8d896657bc66e1cd6dce6f99a7f6.tar.gz |
- fixed crash on url.redirect and url.rewrite if %0 is used in a
global context (fixes #800)
git-svn-id: svn+ssh://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@1735 152afb58-edef-0310-8abb-c4023f1b3aa9
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | src/mod_redirect.c | 6 | ||||
-rw-r--r-- | src/mod_rewrite.c | 8 |
3 files changed, 17 insertions, 1 deletions
@@ -32,7 +32,9 @@ NEWS * fixed handling of %% in accesslog.format * fixed conditional dir-listing.exclude (#930) * reduced default PATH_MAX to 255 (#826) - * ECONNABORTED is not known on cygwin (fixes #863) + * ECONNABORTED is not known on cygwin (#863) + * fixed crash on url.redirect and url.rewrite if %0 is used in a global context + (#800) - 1.4.13 - 2006-10-09 diff --git a/src/mod_redirect.c b/src/mod_redirect.c index 7a4f3ebe..24523cae 100644 --- a/src/mod_redirect.c +++ b/src/mod_redirect.c @@ -140,6 +140,7 @@ static int mod_redirect_patch_connection(server *srv, connection *con, plugin_da plugin_config *s = p->config_storage[0]; p->conf.redirect = s->redirect; + p->conf.context = NULL; /* skip the first, the global context */ for (i = 1; i < srv->config_context->used; i++) { @@ -229,6 +230,11 @@ static handler_t mod_redirect_uri_handler(server *srv, connection *con, void *p_ if (num < (size_t)n) { buffer_append_string(p->location, list[num]); } + } else if (p->conf.context == NULL) { + /* we have no context, we are global */ + log_error_write(srv, __FILE__, __LINE__, "sb", + "used a rewrite containing a %[0-9]+ in the global scope, ignored:", + kv->value); } else { config_append_cond_match_buffer(con, p->conf.context, p->location, num); } diff --git a/src/mod_rewrite.c b/src/mod_rewrite.c index 4a9d3eae..b27361a1 100644 --- a/src/mod_rewrite.c +++ b/src/mod_rewrite.c @@ -270,7 +270,9 @@ SETDEFAULTS_FUNC(mod_rewrite_set_defaults) { static int mod_rewrite_patch_connection(server *srv, connection *con, plugin_data *p) { size_t i, j; plugin_config *s = p->config_storage[0]; + p->conf.rewrite = s->rewrite; + p->conf.context = NULL; /* skip the first, the global context */ for (i = 1; i < srv->config_context->used; i++) { @@ -398,6 +400,12 @@ URIHANDLER_FUNC(mod_rewrite_uri_handler) { if (num < (size_t)n) { buffer_append_string(con->request.uri, list[num]); } + } else if (p->conf.context == NULL) { + /* we have no context, we are global */ + log_error_write(srv, __FILE__, __LINE__, "sb", + "used a redirect containing a %[0-9]+ in the global scope, ignored:", + rule->value); + } else { config_append_cond_match_buffer(con, p->conf.context, con->request.uri, num); } |