]> granicus.if.org Git - apache/commitdiff
Decline urls ending with /
authorBill Stoddard <stoddard@apache.org>
Wed, 13 Mar 2002 21:47:03 +0000 (21:47 +0000)
committerBill Stoddard <stoddard@apache.org>
Wed, 13 Mar 2002 21:47:03 +0000 (21:47 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93920 13f79535-47bb-0310-9956-ffa450edef68

modules/experimental/mod_cache.c

index 1e3109a96c2152196d5924dbc1e5f860d05f9884..964950fd6710cfc59d1f01310bd260ac1affac0c 100644 (file)
@@ -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);