You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by mi...@apache.org on 2013/05/28 22:55:01 UTC
svn commit: r1487114 - in /httpd/httpd/branches/2.4.x: ./ CHANGES STATUS
modules/cache/cache_storage.c modules/cache/cache_util.c
modules/cache/cache_util.h
Author: minfrin
Date: Tue May 28 20:55:01 2013
New Revision: 1487114
URL: http://svn.apache.org/r1487114
Log:
mod_cache: Make sure Vary processing handles multivalued Vary headers and
multivalued headers referred to via Vary.
trunk patch: http://svn.apache.org/r1478748
Submitted by: minfrin
Reviewed by: jim, wrowe
Modified:
httpd/httpd/branches/2.4.x/ (props changed)
httpd/httpd/branches/2.4.x/CHANGES
httpd/httpd/branches/2.4.x/STATUS
httpd/httpd/branches/2.4.x/modules/cache/cache_storage.c
httpd/httpd/branches/2.4.x/modules/cache/cache_util.c
httpd/httpd/branches/2.4.x/modules/cache/cache_util.h
Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
Merged /httpd/httpd/trunk:r1478748
Modified: httpd/httpd/branches/2.4.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/CHANGES?rev=1487114&r1=1487113&r2=1487114&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.4.x/CHANGES [utf-8] Tue May 28 20:55:01 2013
@@ -2,6 +2,9 @@
Changes with Apache 2.4.5
+ *) mod_cache: Make sure Vary processing handles multivalued Vary headers and
+ multivalued headers referred to via Vary. [Graham Leggett]
+
*) mod_cache: When serving from cache, only the last header of a multivalued
header was taken into account. Fixed. Ensure that Warning headers are
correctly handled as per RFC2616. [Graham Leggett]
Modified: httpd/httpd/branches/2.4.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/STATUS?rev=1487114&r1=1487113&r2=1487114&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/STATUS (original)
+++ httpd/httpd/branches/2.4.x/STATUS Tue May 28 20:55:01 2013
@@ -90,13 +90,6 @@ RELEASE SHOWSTOPPERS:
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
[ start all new proposals below, under PATCHES PROPOSED. ]
- * mod_cache: Make sure Vary processing handles multivalued Vary headers and
- multivalued headers referred to via Vary.
- trunk patch: http://svn.apache.org/r1478748
- 2.4.x patch: trunk patch works (minus CHANGES, on condition above backports are
- done first)
- +1: minfrin, jim, wrowe
-
* mod_cache: Make sure that contradictory entity headers present in a 304
Not Modified response are caught and cause the entity to be removed.
trunk patch: http://svn.apache.org/r1479117
Modified: httpd/httpd/branches/2.4.x/modules/cache/cache_storage.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/cache/cache_storage.c?rev=1487114&r1=1487113&r2=1487114&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/cache/cache_storage.c (original)
+++ httpd/httpd/branches/2.4.x/modules/cache/cache_storage.c Tue May 28 20:55:01 2013
@@ -246,6 +246,7 @@ int cache_select(cache_request_rec *cach
case OK: {
char *vary = NULL;
int fresh, mismatch = 0;
+ char *last = NULL;
if (list->provider->recall_headers(h, r) != APR_SUCCESS) {
/* try again with next cache type */
@@ -271,25 +272,19 @@ int cache_select(cache_request_rec *cach
*
* RFC2616 13.6 and 14.44 describe the Vary mechanism.
*/
- vary = apr_pstrdup(r->pool, apr_table_get(h->resp_hdrs, "Vary"));
- while (vary && *vary) {
- char *name = vary;
+ vary = cache_strqtok(
+ apr_pstrdup(r->pool,
+ cache_table_getm(r->pool, h->resp_hdrs, "Vary")),
+ CACHE_SEPARATOR, &last);
+ while (vary) {
const char *h1, *h2;
- /* isolate header name */
- while (*vary && !apr_isspace(*vary) && (*vary != ','))
- ++vary;
- while (apr_isspace(*vary) || (*vary == ',')) {
- *vary = '\0';
- ++vary;
- }
-
/*
* is this header in the request and the header in the cached
* request identical? If not, we give up and do a straight get
*/
- h1 = apr_table_get(r->headers_in, name);
- h2 = apr_table_get(h->req_hdrs, name);
+ h1 = cache_table_getm(r->pool, r->headers_in, vary);
+ h2 = cache_table_getm(r->pool, h->req_hdrs, vary);
if (h1 == h2) {
/* both headers NULL, so a match - do nothing */
}
@@ -303,6 +298,7 @@ int cache_select(cache_request_rec *cach
mismatch = 1;
break;
}
+ vary = cache_strqtok(NULL, CACHE_SEPARATOR, &last);
}
/* no vary match, try next provider */
Modified: httpd/httpd/branches/2.4.x/modules/cache/cache_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/cache/cache_util.c?rev=1487114&r1=1487113&r2=1487114&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/cache/cache_util.c (original)
+++ httpd/httpd/branches/2.4.x/modules/cache/cache_util.c Tue May 28 20:55:01 2013
@@ -27,8 +27,6 @@ extern APR_OPTIONAL_FN_TYPE(ap_cache_gen
extern module AP_MODULE_DECLARE_DATA cache_module;
-#define CACHE_SEPARATOR ", "
-
/* Determine if "url" matches the hostname, scheme and port and path
* in "filter". All but the path comparisons are case-insensitive.
*/
@@ -862,7 +860,7 @@ CACHE_DECLARE(char *)ap_cache_generate_n
* String tokenizer that ignores separator characters within quoted strings
* and escaped characters, as per RFC2616 section 2.2.
*/
-static char *cache_strqtok(char *str, const char *sep, char **last)
+char *cache_strqtok(char *str, const char *sep, char **last)
{
char *token;
int quoted = 0;
@@ -871,6 +869,10 @@ static char *cache_strqtok(char *str, co
str = *last; /* start where we left off */
}
+ if (!str) { /* no more tokens */
+ return NULL;
+ }
+
/* skip characters in sep (will terminate at '\0') */
while (*str && ap_strchr_c(sep, *str)) {
++str;
Modified: httpd/httpd/branches/2.4.x/modules/cache/cache_util.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/cache/cache_util.h?rev=1487114&r1=1487113&r2=1487114&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/cache/cache_util.h (original)
+++ httpd/httpd/branches/2.4.x/modules/cache/cache_util.h Tue May 28 20:55:01 2013
@@ -99,6 +99,7 @@ extern "C" {
#define CACHE_LOCKNAME_KEY "mod_cache-lockname"
#define CACHE_LOCKFILE_KEY "mod_cache-lockfile"
#define CACHE_CTX_KEY "mod_cache-ctx"
+#define CACHE_SEPARATOR ", "
/**
* cache_util.c
@@ -305,6 +306,12 @@ cache_provider_list *cache_get_providers
const char *cache_table_getm(apr_pool_t *p, const apr_table_t *t,
const char *key);
+/**
+ * String tokenizer that ignores separator characters within quoted strings
+ * and escaped characters, as per RFC2616 section 2.2.
+ */
+char *cache_strqtok(char *str, const char *sep, char **last);
+
#ifdef __cplusplus
}
#endif