summaryrefslogtreecommitdiffstats
path: root/net/http/http_stream_parser.cc
diff options
context:
space:
mode:
authormmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-21 20:10:59 +0000
committermmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-21 20:10:59 +0000
commit54a9c6e510c97663fa8b4246e6bb32f6a6b9dd4f (patch)
treec3e3494a1e5989f61011a245ebb72f7c84d34f59 /net/http/http_stream_parser.cc
parent5ca93bef094ace0fcc1856437776d95c9809157d (diff)
downloadchromium_src-54a9c6e510c97663fa8b4246e6bb32f6a6b9dd4f.zip
chromium_src-54a9c6e510c97663fa8b4246e6bb32f6a6b9dd4f.tar.gz
chromium_src-54a9c6e510c97663fa8b4246e6bb32f6a6b9dd4f.tar.bz2
Allow broken servers to send us multiple identical Location and
Content-Disposition headers. R=willchan@chromium.org BUG=103618 Review URL: http://codereview.chromium.org/9757002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128041 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_stream_parser.cc')
-rw-r--r--net/http/http_stream_parser.cc21
1 files changed, 6 insertions, 15 deletions
diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc
index 6b81a66..8098a18 100644
--- a/net/http/http_stream_parser.cc
+++ b/net/http/http_stream_parser.cc
@@ -37,13 +37,10 @@ std::string GetResponseHeaderLines(const net::HttpResponseHeaders& headers) {
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 @@ bool HeadersContainMultipleCopiesOfField(
// |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 @@ int HttpStreamParser::DoParseResponseHeaders(int end_offset) {
// 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;