summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Stoddard <stoddard@apache.org>2002-03-13 22:47:03 +0100
committerBill Stoddard <stoddard@apache.org>2002-03-13 22:47:03 +0100
commit0a6227109622535cba2f710d99f1875d35e4a053 (patch)
treef6ce40f962c465571faf7fae57857bd27e8cc004
parentUpdate our copyright for this year. (diff)
downloadapache2-0a6227109622535cba2f710d99f1875d35e4a053.tar.xz
apache2-0a6227109622535cba2f710d99f1875d35e4a053.zip
Decline urls ending with /
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93920 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--modules/experimental/mod_cache.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/modules/experimental/mod_cache.c b/modules/experimental/mod_cache.c
index 1e3109a96c..964950fd67 100644
--- a/modules/experimental/mod_cache.c
+++ b/modules/experimental/mod_cache.c
@@ -88,6 +88,7 @@ static int cache_url_handler(request_rec *r)
const char *cc_in, *pragma, *auth;
apr_uri_t uri = r->parsed_uri;
char *url = r->unparsed_uri;
+ apr_size_t urllen;
char *path = uri.path;
const char *types;
cache_info *info = NULL;
@@ -108,6 +109,17 @@ static int cache_url_handler(request_rec *r)
ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, 0, r->server,
"cache: URL %s is being handled by %s", path, types);
+ urllen = strlen(url);
+ if (urllen > MAX_URL_LENGTH) {
+ ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, 0, r->server,
+ "cache: URL exceeds length threshold: %s", url);
+ return DECLINED;
+ }
+ /* DECLINE urls ending in / */
+ if (url[urllen-1] == '/') {
+ return DECLINED;
+ }
+
/* make space for the per request config */
cache = (cache_request_rec *) ap_get_module_config(r->request_config,
&cache_module);
@@ -143,11 +155,6 @@ static int cache_url_handler(request_rec *r)
* - Any URLs whose length exceeds MAX_URL_LENGTH
* - TODO: Make MAX_URL_LENGTH a config directive?
*/
- if (strlen(url) > MAX_URL_LENGTH) {
- ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, 0, r->server,
- "cache: URL exceeds length threshold: %s", url);
- return DECLINED;
- }
if (conf->ignorecachecontrol_set == 1 && conf->ignorecachecontrol == 1 && auth == NULL) {
ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, 0, r->server,
"incoming request is asking for a uncached version of %s, but we know better and are ignoring it", url);