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

Unified Diff: net/http/http_stream_parser.cc

Issue 9757002: Allow multiple identical Location and Content-Disposition headers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix comments, update strings Created 8 years, 9 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 | « net/http/http_network_transaction_spdy3_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_stream_parser.cc
===================================================================
--- net/http/http_stream_parser.cc (revision 127472)
+++ net/http/http_stream_parser.cc (working copy)
@@ -37,13 +37,10 @@
return cr_separated_headers;
}
-// Return true if |headers| contain multiple |field_name| fields. If
-// |count_same_value| is false, returns false if all copies of the field have
-// the same value.
+// Return true if |headers| contain multiple |field_name| fields.
bool HeadersContainMultipleCopiesOfField(
const net::HttpResponseHeaders& headers,
- const std::string& field_name,
- bool count_same_value) {
+ const std::string& field_name) {
void* it = NULL;
std::string field_value;
if (!headers.EnumerateHeader(&it, field_name, &field_value))
@@ -53,7 +50,7 @@
// |count_same_value| is true.
std::string field_value2;
while (headers.EnumerateHeader(&it, field_name, &field_value2)) {
- if (count_same_value || field_value != field_value2)
+ if (field_value != field_value2)
return true;
}
return false;
@@ -777,21 +774,15 @@
// If they exist, and have distinct values, it's a potential response
// smuggling attack.
if (!headers->HasHeader("Transfer-Encoding")) {
- if (HeadersContainMultipleCopiesOfField(*headers,
- "Content-Length",
- false)) {
+ if (HeadersContainMultipleCopiesOfField(*headers, "Content-Length"))
return ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_LENGTH;
- }
}
// Check for multiple Content-Disposition or Location headers. If they exist,
// it's also a potential response smuggling attack.
- if (HeadersContainMultipleCopiesOfField(*headers,
- "Content-Disposition",
- true)) {
+ if (HeadersContainMultipleCopiesOfField(*headers, "Content-Disposition"))
return ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION;
- }
- if (HeadersContainMultipleCopiesOfField(*headers, "Location", true))
+ if (HeadersContainMultipleCopiesOfField(*headers, "Location"))
return ERR_RESPONSE_HEADERS_MULTIPLE_LOCATION;
response_->headers = headers;
« no previous file with comments | « net/http/http_network_transaction_spdy3_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698