summaryrefslogtreecommitdiffstats
path: root/net/http/http_response_headers_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'net/http/http_response_headers_unittest.cc')
-rw-r--r--net/http/http_response_headers_unittest.cc20
1 files changed, 19 insertions, 1 deletions
diff --git a/net/http/http_response_headers_unittest.cc b/net/http/http_response_headers_unittest.cc
index 8892682..e403a86 100644
--- a/net/http/http_response_headers_unittest.cc
+++ b/net/http/http_response_headers_unittest.cc
@@ -68,7 +68,7 @@ void TestCommon(const TestData& test) {
TEST(HttpResponseHeadersTest, NormalizeHeadersWhitespace) {
TestData test = {
"HTTP/1.1 202 Accepted \n"
- " Content-TYPE : text/html; charset=utf-8 \n"
+ "Content-TYPE : text/html; charset=utf-8 \n"
"Set-Cookie: a \n"
"Set-Cookie: b \n",
@@ -81,6 +81,24 @@ TEST(HttpResponseHeadersTest, NormalizeHeadersWhitespace) {
TestCommon(test);
}
+// Check that we normalize headers properly (header name is invalid if starts
+// with LWS).
+TEST(HttpResponseHeadersTest, NormalizeHeadersLeadingWhitespace) {
+ TestData test = {
+ "HTTP/1.1 202 Accepted \n"
+ // Starts with space -- will be skipped as invalid.
+ " Content-TYPE : text/html; charset=utf-8 \n"
+ "Set-Cookie: a \n"
+ "Set-Cookie: b \n",
+
+ "HTTP/1.1 202 Accepted\n"
+ "Set-Cookie: a, b\n",
+
+ 202
+ };
+ TestCommon(test);
+}
+
TEST(HttpResponseHeadersTest, BlankHeaders) {
TestData test = {
"HTTP/1.1 200 OK\n"