]> granicus.if.org Git - apache/commitdiff
mod_cache: correctly parse quoted strings in cache headers.
authorNick Kew <niq@apache.org>
Wed, 3 Nov 2010 00:16:47 +0000 (00:16 +0000)
committerNick Kew <niq@apache.org>
Wed, 3 Nov 2010 00:16:47 +0000 (00:16 +0000)
PR 50199

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1030299 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/cache/cache_util.c

diff --git a/CHANGES b/CHANGES
index be3fc8bffbf2574a076ced207fcddbf117a1e5e1..6e6420fdcfc3e66f733ccc8c636b518fba175333 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -58,6 +58,9 @@ Changes with Apache 2.3.9
      the option to list entry metadata such as sizes and times. [Graham
      Leggett]
 
+  *) mod_cache: correctly parse quoted strings in cache headers.
+     PR 50199 [Nick Kew]
+
   *) mod_cache: Allow control over the base URL of reverse proxied requests
      using the CacheKeyBaseURL directive, so that the cache key can be
      calculated from the endpoint URL instead of the server URL. [Graham
index 6520665b3aee2c62bad43d839f1c929b4f4b110a..9f3b72b37cbfd3305185f38ca8936f31f3c81fe8 100644 (file)
@@ -761,6 +761,18 @@ CACHE_DECLARE(int) ap_cache_liststr(apr_pool_t *p, const char *list,
                             const char *val_start = next;
                             while (*next && !apr_isspace(*next) &&
                                    (*next != ',')) {
+                                /* EAT QUOTED STRING */
+                                if (*next == '"' || *next == '\'') {
+                                    char delim = *next;
+                                    while (*++next != delim) {
+                                        if (!*next) {
+                                            return 0;
+                                        }
+                                        else if (*next == '\\') {
+                                            ++next;
+                                        }
+                                    }
+                                }
                                 next++;
                             }
                             *val = apr_pstrmemdup(p, val_start,
@@ -777,6 +789,18 @@ CACHE_DECLARE(int) ap_cache_liststr(apr_pool_t *p, const char *list,
 
         /* skip to the next field */
         do {
+            /* EAT QUOTED STRING */
+            if (*next == '"' || *next == '\'') {
+                char delim = *next;
+                while (*++next != delim) {
+                    if (!*next) {
+                        return 0;
+                    }
+                    else if (*next == '\\') {
+                        ++next;
+                    }
+                }
+            }
             next++;
             if (!*next) {
                 return 0;