| Index: net/http/http_util_unittest.cc
|
| diff --git a/net/http/http_util_unittest.cc b/net/http/http_util_unittest.cc
|
| index f2c2146215ecc645bbea998d1cd7cd8002b82d0f..699739ff0f3634525922c928ff82372d12835e76 100644
|
| --- a/net/http/http_util_unittest.cc
|
| +++ b/net/http/http_util_unittest.cc
|
| @@ -378,6 +378,7 @@ TEST(HttpUtilTest, LocateEndOfAdditionalHeaders) {
|
| }
|
| }
|
| TEST(HttpUtilTest, AssembleRawHeaders) {
|
| + // clang-format off
|
| struct {
|
| const char* const input; // with '|' representing '\0'
|
| const char* const expected_result; // with '\0' changed to '|'
|
| @@ -679,7 +680,19 @@ TEST(HttpUtilTest, AssembleRawHeaders) {
|
| "HTTP/1.0 200 OK\nFoo: 1|Foo2: 3\nBar: 2\n\n",
|
| "HTTP/1.0 200 OK|Foo: 1Foo2: 3|Bar: 2||"
|
| },
|
| +
|
| + // The embedded NUL at the start of the line (before "Blah:") should not be
|
| + // interpreted as LWS (as that would mistake it for a header line
|
| + // continuation).
|
| + {
|
| + "HTTP/1.0 200 OK\n"
|
| + "Foo: 1\n"
|
| + "|Blah: 3\n"
|
| + "Bar: 2\n\n",
|
| + "HTTP/1.0 200 OK|Foo: 1|Blah: 3|Bar: 2||"
|
| + },
|
| };
|
| + // clang-format on
|
| for (size_t i = 0; i < arraysize(tests); ++i) {
|
| std::string input = tests[i].input;
|
| std::replace(input.begin(), input.end(), '|', '\0');
|
| @@ -1408,4 +1421,17 @@ TEST(HttpUtilTest, IsToken) {
|
| EXPECT_FALSE(HttpUtil::IsToken("\xff"));
|
| }
|
|
|
| +TEST(HttpUtilTest, IsLWS) {
|
| + EXPECT_FALSE(HttpUtil::IsLWS('\v'));
|
| + EXPECT_FALSE(HttpUtil::IsLWS('\0'));
|
| + EXPECT_FALSE(HttpUtil::IsLWS('1'));
|
| + EXPECT_FALSE(HttpUtil::IsLWS('a'));
|
| + EXPECT_FALSE(HttpUtil::IsLWS('.'));
|
| + EXPECT_FALSE(HttpUtil::IsLWS('\n'));
|
| + EXPECT_FALSE(HttpUtil::IsLWS('\r'));
|
| +
|
| + EXPECT_TRUE(HttpUtil::IsLWS('\t'));
|
| + EXPECT_TRUE(HttpUtil::IsLWS(' '));
|
| +}
|
| +
|
| } // namespace net
|
|
|