diff options
author | battre@chromium.org <battre@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-24 11:15:01 +0000 |
---|---|---|
committer | battre@chromium.org <battre@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-24 11:15:01 +0000 |
commit | 97ce1ae59952f2fc30cef5e5f2d02322c4dd056e (patch) | |
tree | 54f369ced9d44414719f34f9d0bb713aae4b2d06 /net/http/http_response_headers_unittest.cc | |
parent | a0a2d853b2ce026e193c46c16aa323fe0c888325 (diff) | |
download | chromium_src-97ce1ae59952f2fc30cef5e5f2d02322c4dd056e.zip chromium_src-97ce1ae59952f2fc30cef5e5f2d02322c4dd056e.tar.gz chromium_src-97ce1ae59952f2fc30cef5e5f2d02322c4dd056e.tar.bz2 |
Fix removal of headers
HttpResponseHeaders::RemoveHeaderWithValue did not correctly remove headers if the passed value contained a comma. For a header "Foo: bar, baz", RemoveHeaderWithValue("Foo", "bar, baz") would be be a non-op. This CL fixes that. As the web request API is the only consumer of this function, there will be no side effects on other code due to the changed behavior.
BUG=137396
TEST=no
Review URL: https://chromiumcodereview.appspot.com/10809011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148078 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_response_headers_unittest.cc')
-rw-r--r-- | net/http/http_response_headers_unittest.cc | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/net/http/http_response_headers_unittest.cc b/net/http/http_response_headers_unittest.cc index 00608e2..981fa10 100644 --- a/net/http/http_response_headers_unittest.cc +++ b/net/http/http_response_headers_unittest.cc @@ -1685,7 +1685,35 @@ TEST(HttpResponseHeadersTest, RemoveIndividualHeader) { "Content-Length: 450\n" "Cache-control: max-age=10000\n" }, + { "HTTP/1.1 200 OK\n" + "connection: keep-alive \n" + "Foo: bar, baz\n" + "Foo: bar\n" + "Cache-control: max-age=10000\n", + + "Foo", + + "bar, baz", // Space in value. + "HTTP/1.1 200 OK\n" + "connection: keep-alive\n" + "Foo: bar\n" + "Cache-control: max-age=10000\n" + }, + { "HTTP/1.1 200 OK\n" + "connection: keep-alive \n" + "Foo: bar, baz\n" + "Cache-control: max-age=10000\n", + + "Foo", + + "baz", // Only partial match -> ignored. + + "HTTP/1.1 200 OK\n" + "connection: keep-alive\n" + "Foo: bar, baz\n" + "Cache-control: max-age=10000\n" + }, }; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { @@ -1696,7 +1724,7 @@ TEST(HttpResponseHeadersTest, RemoveIndividualHeader) { std::string name(tests[i].to_remove_name); std::string value(tests[i].to_remove_value); - parsed->RemoveHeaderWithValue(name, value); + parsed->RemoveHeaderLine(name, value); std::string resulting_headers; parsed->GetNormalizedHeaders(&resulting_headers); |