Skip to content

Commit 64cb615

Browse files
QUICHE teamcopybara-github
authored andcommitted
No public description
PiperOrigin-RevId: 866558814
1 parent 49ab5a8 commit 64cb615

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

quiche/balsa/balsa_frame.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,6 +1568,7 @@ bool BalsaFrame::IsValidChunkExtensionCharacter(char c, const char* current,
15681568
return false;
15691569
}
15701570
}
1571+
15711572
return true;
15721573
}
15731574

quiche/balsa/balsa_frame_test.cc

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1921,6 +1921,43 @@ TEST_F(HTTPBalsaFrameTest,
19211921
EXPECT_EQ(BalsaFrameEnums::BALSA_NO_ERROR, balsa_frame_.ErrorCode());
19221922
}
19231923

1924+
TEST_F(HTTPBalsaFrameTest, ChunkExtensionWithThreeExtensionsAndDquote) {
1925+
std::string headers =
1926+
"POST / HTTP/1.1\r\n"
1927+
"Transfer-Encoding: chunked\r\n"
1928+
"\r\n";
1929+
1930+
std::string chunks =
1931+
"8" // chunk-size
1932+
";foo" // chunk-ext-name alone
1933+
";bar=baz" // chunk-ext-name=token
1934+
";baz=\"za\\\"quote-ception\\\"p\"" // chunk-ext-name=quoted-string
1935+
"\r\n" // done with extensions
1936+
"deadbeef\r\n" // chunk-data
1937+
"0\r\n" // last-chunk
1938+
"\r\n";
1939+
1940+
ASSERT_EQ(headers.size(),
1941+
balsa_frame_.ProcessInput(headers.data(), headers.size()));
1942+
1943+
balsa_frame_.set_balsa_visitor(&visitor_mock_);
1944+
{
1945+
InSequence s1;
1946+
EXPECT_CALL(visitor_mock_, OnChunkLength(8));
1947+
EXPECT_CALL(
1948+
visitor_mock_,
1949+
OnChunkExtensionInput(";foo;bar=baz;baz=\"za\\\"quote-ception\\\"p\""));
1950+
EXPECT_CALL(visitor_mock_, OnBodyChunkInput("deadbeef"));
1951+
EXPECT_CALL(visitor_mock_, OnChunkLength(0));
1952+
EXPECT_CALL(visitor_mock_, OnChunkExtensionInput(""));
1953+
}
1954+
1955+
EXPECT_EQ(chunks.size(),
1956+
balsa_frame_.ProcessInput(chunks.data(), chunks.size()));
1957+
EXPECT_TRUE(balsa_frame_.MessageFullyRead());
1958+
EXPECT_FALSE(balsa_frame_.Error());
1959+
}
1960+
19241961
TEST_F(HTTPBalsaFrameTest, InvalidChunkExtensionWithCarriageReturn) {
19251962
balsa_frame_.set_http_validation_policy(
19261963
HttpValidationPolicy{.disallow_lone_cr_in_chunk_extension = true});

0 commit comments

Comments
 (0)