From 8b659b457c8925501c09c1b1235b96dc942ec6aa Mon Sep 17 00:00:00 2001 From: Nick Kew Date: Wed, 3 Nov 2010 00:16:47 +0000 Subject: [PATCH] mod_cache: correctly parse quoted strings in cache headers. PR 50199 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1030299 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ modules/cache/cache_util.c | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/CHANGES b/CHANGES index be3fc8bffb..6e6420fdcf 100644 --- 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 diff --git a/modules/cache/cache_util.c b/modules/cache/cache_util.c index 6520665b3a..9f3b72b37c 100644 --- a/modules/cache/cache_util.c +++ b/modules/cache/cache_util.c @@ -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; -- 2.40.0