Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(724)

Unified Diff: net/http/http_response_headers.cc

Issue 12224008: Add to the list of HTTP headers that don't overwrite in 304 responses. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/http/http_response_headers_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_response_headers.cc
diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc
index 4cbe03c0ef3801afb429f5c55f57dce5a8a2a96c..824cfd09ecd99aefe455484418a2d0ddee669375 100644
--- a/net/http/http_response_headers.cc
+++ b/net/http/http_response_headers.cc
@@ -78,16 +78,18 @@ const char* const kNonUpdatedHeaders[] = {
"trailer",
"transfer-encoding",
"upgrade",
- // these should never change:
- "content-location",
- "content-md5",
"etag",
- // assume cache-control: no-transform
- "content-encoding",
- "content-range",
- "content-type",
- // some broken microsoft servers send 'content-length: 0' with 304s
- "content-length"
+ "x-frame-options",
+ "x-xss-protection",
+};
+
+// Some header prefixes mean "Don't copy this header from a 304 response.".
+// Rather than listing all the relevant headers, we can consolidate them into
+// this list:
+const char* const kNonUpdatedHeaderPrefixes[] = {
agl 2013/02/05 14:41:55 Minor sadness at the extra indirection and relocat
Mike West 2013/02/05 15:59:39 Filed https://code.google.com/p/chromium/issues/de
+ "content-",
+ "x-content-",
+ "x-webkit-"
};
bool ShouldUpdateHeader(const std::string::const_iterator& name_begin,
@@ -96,6 +98,11 @@ bool ShouldUpdateHeader(const std::string::const_iterator& name_begin,
if (LowerCaseEqualsASCII(name_begin, name_end, kNonUpdatedHeaders[i]))
return false;
}
+ for (size_t i = 0; i < arraysize(kNonUpdatedHeaderPrefixes); ++i) {
+ if (StartsWithASCII(std::string(name_begin, name_end),
agl 2013/02/05 14:41:55 Yet more sadness for there not being a StartsWithA
Mike West 2013/02/05 15:59:39 Indeed. I looked briefly at adding such a beast, b
+ kNonUpdatedHeaderPrefixes[i], false))
+ return false;
+ }
return true;
}
« no previous file with comments | « no previous file | net/http/http_response_headers_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698