Migrates all users of spdy::Http2HeaderBlock to quiche::HttpHeaderBlock.
The former is merely an alias for the latter, so this is not a functional change.
Tested:
TAP for global presubmit queue
http://test/OCL:651173232:BASE:651768217:1720794780746:94973f06
Protected by refactoring, no functional change, not protected.
PiperOrigin-RevId: 652504330
diff --git a/quiche/quic/core/http/end_to_end_test.cc b/quiche/quic/core/http/end_to_end_test.cc
index b7dd0ec..f0a9d86 100644
--- a/quiche/quic/core/http/end_to_end_test.cc
+++ b/quiche/quic/core/http/end_to_end_test.cc
@@ -77,12 +77,12 @@
#include "quiche/quic/tools/quic_server.h"
#include "quiche/quic/tools/quic_simple_client_stream.h"
#include "quiche/quic/tools/quic_simple_server_stream.h"
+#include "quiche/common/http/http_header_block.h"
#include "quiche/common/platform/api/quiche_test.h"
#include "quiche/common/quiche_stream.h"
#include "quiche/common/test_tools/quiche_test_utils.h"
-#include "quiche/spdy/core/http2_header_block.h"
-using spdy::Http2HeaderBlock;
+using quiche::HttpHeaderBlock;
using spdy::kV3LowestPriority;
using spdy::SpdyFramer;
using spdy::SpdySerializedFrame;
@@ -183,7 +183,7 @@
void WriteHeadersOnStream(QuicSpdyStream* stream) {
// Since QuicSpdyStream uses QuicHeaderList::empty() to detect too large
// headers, it also fails when receiving empty headers.
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":authority"] = "test.example.com:443";
headers[":path"] = "/path";
headers[":method"] = "GET";
@@ -723,7 +723,8 @@
bool CheckResponseHeaders(QuicTestClient* client,
const std::string& expected_status) {
- const spdy::Http2HeaderBlock* response_headers = client->response_headers();
+ const quiche::HttpHeaderBlock* response_headers =
+ client->response_headers();
auto it = response_headers->find(":status");
if (it == response_headers->end()) {
ADD_FAILURE() << "Did not find :status header in response";
@@ -811,7 +812,7 @@
return nullptr;
}
- spdy::Http2HeaderBlock headers;
+ quiche::HttpHeaderBlock headers;
headers[":scheme"] = "https";
headers[":authority"] = "localhost";
headers[":path"] = path;
@@ -1384,7 +1385,7 @@
// Start client2 which will use a good connection ID length.
std::unique_ptr<QuicTestClient> client2(CreateQuicClient(nullptr));
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -1485,7 +1486,7 @@
ASSERT_TRUE(Initialize());
// Send a request in two parts: the request and then an empty packet with FIN.
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -1528,7 +1529,7 @@
const int kNumRequests = 10;
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -1549,7 +1550,7 @@
ASSERT_TRUE(Initialize());
std::unique_ptr<QuicTestClient> client2(CreateQuicClient(nullptr));
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -1594,7 +1595,7 @@
ASSERT_TRUE(Initialize());
// Add a content length header with no body.
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -1616,7 +1617,7 @@
// 1 MB body.
std::string body(1024 * 1024, 'a');
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -1638,7 +1639,7 @@
// 100 KB body.
std::string body(100 * 1024, 'a');
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -1662,7 +1663,7 @@
// 10 KB body.
std::string body(1024 * 10, 'a');
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -1706,7 +1707,7 @@
// 10 KB body.
std::string body(1024 * 10, 'a');
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -1730,7 +1731,7 @@
// 10 KB body.
std::string body(1024 * 10, 'a');
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -1749,7 +1750,7 @@
// 1 MB body.
std::string body(1024 * 1024, 'a');
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -1925,7 +1926,7 @@
}
std::string body(20480, 'a');
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -2077,7 +2078,7 @@
ASSERT_TRUE(Initialize());
std::string body(20480, 'a');
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -2196,7 +2197,7 @@
EXPECT_TRUE(
GetClientConnection()->framer().HasEncrypterOfEncryptionLevel(
ENCRYPTION_HANDSHAKE));
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -2321,7 +2322,7 @@
// 1 MB body.
std::string body(1024 * 1024, 'a');
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -2379,7 +2380,7 @@
EXPECT_TRUE(client_->client()->WaitForOneRttKeysAvailable());
std::string body(kMaxOutgoingPacketSize, 'a');
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -2405,7 +2406,7 @@
EXPECT_TRUE(client_->client()->WaitForOneRttKeysAvailable());
std::string body(kMaxOutgoingPacketSize, 'a');
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -2434,7 +2435,7 @@
EXPECT_TRUE(client_->client()->WaitForOneRttKeysAvailable());
std::string large_body(1024 * 1024, 'a');
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -2506,7 +2507,7 @@
QuicSessionPeer::SetMaxOpenOutgoingStreams(client_session,
kServerMaxStreams + 1);
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -3892,7 +3893,7 @@
class TestResponseListener : public QuicSpdyClientBase::ResponseListener {
public:
void OnCompleteResponse(QuicStreamId id,
- const Http2HeaderBlock& response_headers,
+ const HttpHeaderBlock& response_headers,
absl::string_view response_body) override {
QUIC_DVLOG(1) << "response for stream " << id << " "
<< response_headers.DebugString() << "\n"
@@ -3944,7 +3945,7 @@
}
// Create a POST request and send the headers only.
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -4406,7 +4407,7 @@
EXPECT_TRUE(client_->client()->WaitForOneRttKeysAvailable());
// Lose the request.
SetPacketLossPercentage(100);
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -4438,7 +4439,7 @@
protected:
void SendErrorResponse() override {
QUIC_DLOG(INFO) << "Sending error response for stream " << id();
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":status"] = "500";
headers["content-length"] = absl::StrCat(response_body_.size());
// This method must call CloseReadSide to cause the test case, StopReading
@@ -4671,7 +4672,7 @@
// and before the body is received, due to invalid content-length.
// Set an invalid content-length, so the request will receive an early 500
// response.
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/garbage";
headers[":scheme"] = "https";
@@ -4720,11 +4721,11 @@
// Add a response with headers, body, and trailers.
const std::string kBody = "body content";
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":status"] = "200";
headers["content-length"] = absl::StrCat(kBody.size());
- Http2HeaderBlock trailers;
+ HttpHeaderBlock trailers;
trailers["some-trailing-header"] = "trailing-header-value";
memory_cache_backend_.AddResponse(server_hostname_, "/trailer_url",
@@ -4754,7 +4755,7 @@
ASSERT_LT(INT64_C(4294967296), request_body_size_bytes);
std::string body(kSizeBytes, 'a');
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -4832,7 +4833,7 @@
TEST_P(EndToEndTest, WayTooLongRequestHeaders) {
ASSERT_TRUE(Initialize());
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "GET";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -4882,7 +4883,7 @@
client_connection->set_debug_visitor(&observer);
// 100KB body.
std::string body(100 * 1024, 'a');
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -5001,7 +5002,7 @@
// 1 MB body.
std::string body(1024 * 1024, 'a');
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -5117,7 +5118,7 @@
// INCOMPLETE_RESPONSE will cause the server to not to send the trailer
// (and the FIN) after the response body.
std::string response_body(1305, 'a');
- Http2HeaderBlock response_headers;
+ HttpHeaderBlock response_headers;
response_headers[":status"] = absl::StrCat(200);
response_headers["content-length"] = absl::StrCat(response_body.length());
memory_cache_backend_.AddSpecialResponse(
@@ -5457,7 +5458,7 @@
ASSERT_TRUE(client_->client()->WaitForHandshakeConfirmed());
QuicConnection* client_connection = GetClientConnection();
QuicSocketAddress original_self_addr = client_connection->self_address();
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/bar";
headers[":scheme"] = "https";
@@ -5511,7 +5512,7 @@
client_->client()->EnablePortMigrationUponPathDegrading(std::nullopt);
ASSERT_TRUE(client_->client()->WaitForHandshakeConfirmed());
QuicConnection* client_connection = GetClientConnection();
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/bar";
headers[":scheme"] = "https";
@@ -5991,7 +5992,7 @@
client_->client()->Initialize();
// Send a request before handshake finishes.
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/bar";
headers[":scheme"] = "https";
@@ -6011,7 +6012,7 @@
ASSERT_TRUE(Initialize());
// Send a request without a fin, to keep the stream open
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -6186,7 +6187,7 @@
EXPECT_TRUE(client_->client()->WaitForOneRttKeysAvailable());
std::string body(kMaxOutgoingPacketSize, 'a');
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
@@ -6681,7 +6682,7 @@
EXPECT_TRUE(server_session->GetWebTransportSession(web_transport->id()) !=
nullptr);
server_thread_->Resume();
- const spdy::Http2HeaderBlock* response_headers = client_->response_headers();
+ const quiche::HttpHeaderBlock* response_headers = client_->response_headers();
auto it = response_headers->find("bar");
EXPECT_NE(it, response_headers->end());
EXPECT_EQ(it->second, "baz");
@@ -7229,7 +7230,7 @@
return;
}
// Missing :path header.
- spdy::Http2HeaderBlock headers;
+ quiche::HttpHeaderBlock headers;
headers[":scheme"] = "https";
headers[":authority"] = "localhost";
headers[":method"] = "CONNECT";
@@ -7251,7 +7252,7 @@
return;
}
// This extended CONNECT should be rejected.
- spdy::Http2HeaderBlock headers;
+ quiche::HttpHeaderBlock headers;
headers[":scheme"] = "https";
headers[":authority"] = "localhost";
headers[":method"] = "CONNECT";
@@ -7263,7 +7264,7 @@
CheckResponseHeaders("400");
// Vanilla CONNECT should be sent to backend.
- spdy::Http2HeaderBlock headers2;
+ quiche::HttpHeaderBlock headers2;
headers2[":authority"] = "localhost";
headers2[":method"] = "CONNECT";
@@ -7278,7 +7279,7 @@
SetQuicReloadableFlag(quic_act_upon_invalid_header, true);
ASSERT_TRUE(Initialize());
- spdy::Http2HeaderBlock headers;
+ quiche::HttpHeaderBlock headers;
headers[":scheme"] = "https";
headers[":authority"] = "localhost";
headers[":method"] = "GET";
@@ -7296,11 +7297,11 @@
ASSERT_TRUE(Initialize());
// Add a response with transfer-encoding headers.
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":status"] = "200";
headers["transfer-encoding"] = "gzip";
- Http2HeaderBlock trailers;
+ HttpHeaderBlock trailers;
trailers["some-trailing-header"] = "trailing-header-value";
memory_cache_backend_.AddResponse(server_hostname_, "/eep",
@@ -7315,7 +7316,7 @@
SetQuicReloadableFlag(quic_act_upon_invalid_header, true);
ASSERT_TRUE(Initialize());
- spdy::Http2HeaderBlock headers;
+ quiche::HttpHeaderBlock headers;
headers[":scheme"] = "https";
headers[":authority"] = "localhost";
headers[":method"] = "GET";
@@ -7331,7 +7332,7 @@
SetQuicReloadableFlag(quic_act_upon_invalid_header, true);
ASSERT_TRUE(Initialize());
- spdy::Http2HeaderBlock headers;
+ quiche::HttpHeaderBlock headers;
headers[":scheme"] = "https";
headers[":authority"] = "localhost";
headers[":method"] = "GET";
diff --git a/quiche/quic/core/http/metadata_decoder_test.cc b/quiche/quic/core/http/metadata_decoder_test.cc
index 7f913db..2740a58 100644
--- a/quiche/quic/core/http/metadata_decoder_test.cc
+++ b/quiche/quic/core/http/metadata_decoder_test.cc
@@ -17,7 +17,7 @@
class MetadataDecoderTest : public QuicTest {
protected:
- std::string EncodeHeaders(spdy::Http2HeaderBlock& headers) {
+ std::string EncodeHeaders(quiche::HttpHeaderBlock& headers) {
quic::NoopDecoderStreamErrorDelegate delegate;
quic::QpackEncoder encoder(&delegate, quic::HuffmanEncoding::kDisabled);
return encoder.EncodeHeaderList(id_, headers,
@@ -39,7 +39,7 @@
}
TEST_F(MetadataDecoderTest, Decode) {
- spdy::Http2HeaderBlock headers;
+ quiche::HttpHeaderBlock headers;
headers["key1"] = "val1";
headers["key2"] = "val2";
headers["key3"] = "val3";
@@ -65,7 +65,7 @@
}
TEST_F(MetadataDecoderTest, TooLarge) {
- spdy::Http2HeaderBlock headers;
+ quiche::HttpHeaderBlock headers;
for (int i = 0; i < 1024; ++i) {
headers.AppendValueOrAddHeader(absl::StrCat(i), std::string(1024, 'a'));
}
diff --git a/quiche/quic/core/http/quic_headers_stream_test.cc b/quiche/quic/core/http/quic_headers_stream_test.cc
index 48966a1..6df0607 100644
--- a/quiche/quic/core/http/quic_headers_stream_test.cc
+++ b/quiche/quic/core/http/quic_headers_stream_test.cc
@@ -29,14 +29,14 @@
#include "quiche/quic/test_tools/quic_spdy_session_peer.h"
#include "quiche/quic/test_tools/quic_stream_peer.h"
#include "quiche/quic/test_tools/quic_test_utils.h"
+#include "quiche/common/http/http_header_block.h"
#include "quiche/common/quiche_endian.h"
#include "quiche/spdy/core/http2_frame_decoder_adapter.h"
-#include "quiche/spdy/core/http2_header_block.h"
#include "quiche/spdy/core/spdy_alt_svc_wire_format.h"
#include "quiche/spdy/core/spdy_protocol.h"
+using quiche::HttpHeaderBlock;
using spdy::ERROR_CODE_PROTOCOL_ERROR;
-using spdy::Http2HeaderBlock;
using spdy::RecordingHeadersHandler;
using spdy::SETTINGS_ENABLE_PUSH;
using spdy::SETTINGS_HEADER_TABLE_SIZE;
@@ -355,7 +355,7 @@
StrictMock<MockQuicConnection>* connection_;
StrictMock<MockQuicSpdySession> session_;
QuicHeadersStream* headers_stream_;
- Http2HeaderBlock headers_;
+ HttpHeaderBlock headers_;
std::unique_ptr<RecordingHeadersHandler> headers_handler_;
std::string body_;
std::string saved_data_;
diff --git a/quiche/quic/core/http/quic_server_initiated_spdy_stream.cc b/quiche/quic/core/http/quic_server_initiated_spdy_stream.cc
index c036c2c..ed0bb27 100644
--- a/quiche/quic/core/http/quic_server_initiated_spdy_stream.cc
+++ b/quiche/quic/core/http/quic_server_initiated_spdy_stream.cc
@@ -17,7 +17,7 @@
}
size_t QuicServerInitiatedSpdyStream::WriteHeaders(
- spdy::Http2HeaderBlock /*header_block*/, bool /*fin*/,
+ quiche::HttpHeaderBlock /*header_block*/, bool /*fin*/,
quiche::QuicheReferenceCountedPointer<
QuicAckListenerInterface> /*ack_listener*/) {
QUIC_BUG(Writing headers in QuicServerInitiatedSpdyStream)
diff --git a/quiche/quic/core/http/quic_server_initiated_spdy_stream.h b/quiche/quic/core/http/quic_server_initiated_spdy_stream.h
index ce0ba63..abf70c4 100644
--- a/quiche/quic/core/http/quic_server_initiated_spdy_stream.h
+++ b/quiche/quic/core/http/quic_server_initiated_spdy_stream.h
@@ -6,7 +6,7 @@
#define QUICHE_QUIC_CORE_HTTP_QUIC_SERVER_INITIATED_SPDY_STREAM_H_
#include "quiche/quic/core/http/quic_spdy_stream.h"
-#include "quiche/spdy/core/http2_header_block.h"
+#include "quiche/common/http/http_header_block.h"
namespace quic {
@@ -19,7 +19,7 @@
void OnBodyAvailable() override;
size_t WriteHeaders(
- spdy::Http2HeaderBlock header_block, bool fin,
+ quiche::HttpHeaderBlock header_block, bool fin,
quiche::QuicheReferenceCountedPointer<QuicAckListenerInterface>
ack_listener) override;
void OnInitialHeadersComplete(bool fin, size_t frame_len,
diff --git a/quiche/quic/core/http/quic_spdy_client_session_base.cc b/quiche/quic/core/http/quic_spdy_client_session_base.cc
index ad821ff..305f98f 100644
--- a/quiche/quic/core/http/quic_spdy_client_session_base.cc
+++ b/quiche/quic/core/http/quic_spdy_client_session_base.cc
@@ -13,7 +13,7 @@
#include "quiche/quic/platform/api/quic_flags.h"
#include "quiche/quic/platform/api/quic_logging.h"
-using spdy::Http2HeaderBlock;
+using quiche::HttpHeaderBlock;
namespace quic {
diff --git a/quiche/quic/core/http/quic_spdy_client_session_base.h b/quiche/quic/core/http/quic_spdy_client_session_base.h
index afb4dd1..7a562b9 100644
--- a/quiche/quic/core/http/quic_spdy_client_session_base.h
+++ b/quiche/quic/core/http/quic_spdy_client_session_base.h
@@ -11,7 +11,7 @@
#include "quiche/quic/core/http/quic_spdy_session.h"
#include "quiche/quic/core/quic_crypto_client_stream.h"
#include "quiche/quic/platform/api/quic_export.h"
-#include "quiche/spdy/core/http2_header_block.h"
+#include "quiche/common/http/http_header_block.h"
namespace quic {
diff --git a/quiche/quic/core/http/quic_spdy_client_session_test.cc b/quiche/quic/core/http/quic_spdy_client_session_test.cc
index 7581c21..90fa90c 100644
--- a/quiche/quic/core/http/quic_spdy_client_session_test.cc
+++ b/quiche/quic/core/http/quic_spdy_client_session_test.cc
@@ -39,9 +39,9 @@
#include "quiche/quic/test_tools/quic_stream_peer.h"
#include "quiche/quic/test_tools/quic_test_utils.h"
#include "quiche/quic/test_tools/simple_session_cache.h"
-#include "quiche/spdy/core/http2_header_block.h"
+#include "quiche/common/http/http_header_block.h"
-using spdy::Http2HeaderBlock;
+using quiche::HttpHeaderBlock;
using ::testing::_;
using ::testing::AnyNumber;
using ::testing::AtLeast;
diff --git a/quiche/quic/core/http/quic_spdy_client_stream.cc b/quiche/quic/core/http/quic_spdy_client_stream.cc
index 323fa9b..99f93e3 100644
--- a/quiche/quic/core/http/quic_spdy_client_stream.cc
+++ b/quiche/quic/core/http/quic_spdy_client_stream.cc
@@ -19,7 +19,7 @@
#include "quiche/common/quiche_text_utils.h"
#include "quiche/spdy/core/spdy_protocol.h"
-using spdy::Http2HeaderBlock;
+using quiche::HttpHeaderBlock;
namespace quic {
@@ -46,7 +46,7 @@
bool QuicSpdyClientStream::CopyAndValidateHeaders(
const QuicHeaderList& header_list, int64_t& content_length,
- spdy::Http2HeaderBlock& headers) {
+ quiche::HttpHeaderBlock& headers) {
return SpdyUtils::CopyAndValidateHeaders(header_list, &content_length,
&headers);
}
@@ -158,7 +158,7 @@
}
}
-size_t QuicSpdyClientStream::SendRequest(Http2HeaderBlock headers,
+size_t QuicSpdyClientStream::SendRequest(HttpHeaderBlock headers,
absl::string_view body, bool fin) {
QuicConnection::ScopedPacketFlusher flusher(session_->connection());
bool send_fin_with_headers = fin && body.empty();
diff --git a/quiche/quic/core/http/quic_spdy_client_stream.h b/quiche/quic/core/http/quic_spdy_client_stream.h
index bbe922a..d5df1a6 100644
--- a/quiche/quic/core/http/quic_spdy_client_stream.h
+++ b/quiche/quic/core/http/quic_spdy_client_stream.h
@@ -12,7 +12,7 @@
#include "absl/strings/string_view.h"
#include "quiche/quic/core/http/quic_spdy_stream.h"
#include "quiche/quic/core/quic_packets.h"
-#include "quiche/spdy/core/http2_header_block.h"
+#include "quiche/common/http/http_header_block.h"
#include "quiche/spdy/core/spdy_framer.h"
namespace quic {
@@ -46,16 +46,18 @@
// Serializes the headers and body, sends it to the server, and
// returns the number of bytes sent.
- size_t SendRequest(spdy::Http2HeaderBlock headers, absl::string_view body,
+ size_t SendRequest(quiche::HttpHeaderBlock headers, absl::string_view body,
bool fin);
// Returns the response data.
absl::string_view data() const { return data_; }
// Returns whatever headers have been received for this stream.
- const spdy::Http2HeaderBlock& response_headers() { return response_headers_; }
+ const quiche::HttpHeaderBlock& response_headers() {
+ return response_headers_;
+ }
- const std::list<spdy::Http2HeaderBlock>& preliminary_headers() {
+ const std::list<quiche::HttpHeaderBlock>& preliminary_headers() {
return preliminary_headers_;
}
@@ -84,7 +86,7 @@
// on error.
virtual bool CopyAndValidateHeaders(const QuicHeaderList& header_list,
int64_t& content_length,
- spdy::Http2HeaderBlock& headers);
+ quiche::HttpHeaderBlock& headers);
// Called by OnInitialHeadersComplete to set response_code_ based on
// response_header_. Returns false on error.
@@ -96,7 +98,7 @@
private:
// The parsed headers received from the server.
- spdy::Http2HeaderBlock response_headers_;
+ quiche::HttpHeaderBlock response_headers_;
// The parsed content-length, or -1 if none is specified.
int64_t content_length_;
@@ -110,7 +112,7 @@
// These preliminary headers are used for interim response headers that may
// arrive before the final response headers.
- std::list<spdy::Http2HeaderBlock> preliminary_headers_;
+ std::list<quiche::HttpHeaderBlock> preliminary_headers_;
QuicTime::Delta time_to_response_headers_received_ =
QuicTime::Delta::Infinite();
diff --git a/quiche/quic/core/http/quic_spdy_client_stream_test.cc b/quiche/quic/core/http/quic_spdy_client_stream_test.cc
index ce39e5b..0d97895 100644
--- a/quiche/quic/core/http/quic_spdy_client_stream_test.cc
+++ b/quiche/quic/core/http/quic_spdy_client_stream_test.cc
@@ -22,7 +22,7 @@
#include "quiche/quic/test_tools/quic_test_utils.h"
#include "quiche/common/simple_buffer_allocator.h"
-using spdy::Http2HeaderBlock;
+using quiche::HttpHeaderBlock;
using testing::_;
using testing::ElementsAre;
using testing::StrictMock;
@@ -97,7 +97,7 @@
MockQuicSpdyClientSession session_;
QuicSpdyClientStream* stream_;
std::unique_ptr<StreamVisitor> stream_visitor_;
- Http2HeaderBlock headers_;
+ HttpHeaderBlock headers_;
std::string body_;
};
@@ -372,7 +372,7 @@
// Send trailers before sending the body. Even though a FIN has been received
// the stream should not be closed, as it does not yet have all the data bytes
// promised by the final offset field.
- Http2HeaderBlock trailer_block;
+ HttpHeaderBlock trailer_block;
trailer_block["trailer key"] = "trailer value";
trailer_block[kFinalOffsetHeaderKey] = absl::StrCat(body_.size());
auto trailers = AsHeaderList(trailer_block);
diff --git a/quiche/quic/core/http/quic_spdy_server_stream_base_test.cc b/quiche/quic/core/http/quic_spdy_server_stream_base_test.cc
index d9a31bc..88cb723 100644
--- a/quiche/quic/core/http/quic_spdy_server_stream_base_test.cc
+++ b/quiche/quic/core/http/quic_spdy_server_stream_base_test.cc
@@ -15,7 +15,7 @@
#include "quiche/quic/test_tools/quic_spdy_session_peer.h"
#include "quiche/quic/test_tools/quic_stream_peer.h"
#include "quiche/quic/test_tools/quic_test_utils.h"
-#include "quiche/spdy/core/http2_header_block.h"
+#include "quiche/common/http/http_header_block.h"
using testing::_;
@@ -301,7 +301,7 @@
TEST_F(QuicSpdyServerStreamBaseTest, EmptyHeaders) {
SetQuicReloadableFlag(quic_act_upon_invalid_header, true);
- spdy::Http2HeaderBlock empty_header;
+ quiche::HttpHeaderBlock empty_header;
quic::test::NoopQpackStreamSenderDelegate encoder_stream_sender_delegate;
NoopDecoderStreamErrorDelegate decoder_stream_error_delegate;
auto qpack_encoder = std::make_unique<quic::QpackEncoder>(
diff --git a/quiche/quic/core/http/quic_spdy_session.cc b/quiche/quic/core/http/quic_spdy_session.cc
index 687e29e..72d7276 100644
--- a/quiche/quic/core/http/quic_spdy_session.cc
+++ b/quiche/quic/core/http/quic_spdy_session.cc
@@ -39,7 +39,7 @@
#include "quiche/spdy/core/http2_frame_decoder_adapter.h"
using http2::Http2DecoderAdapter;
-using spdy::Http2HeaderBlock;
+using quiche::HttpHeaderBlock;
using spdy::Http2WeightToSpdy3Priority;
using spdy::Spdy3PriorityToHttp2Weight;
using spdy::SpdyErrorCode;
@@ -729,7 +729,7 @@
}
size_t QuicSpdySession::WriteHeadersOnHeadersStream(
- QuicStreamId id, Http2HeaderBlock headers, bool fin,
+ QuicStreamId id, HttpHeaderBlock headers, bool fin,
const spdy::SpdyStreamPrecedence& precedence,
quiche::QuicheReferenceCountedPointer<QuicAckListenerInterface>
ack_listener) {
@@ -957,7 +957,7 @@
}
size_t QuicSpdySession::WriteHeadersOnHeadersStreamImpl(
- QuicStreamId id, spdy::Http2HeaderBlock headers, bool fin,
+ QuicStreamId id, quiche::HttpHeaderBlock headers, bool fin,
QuicStreamId parent_stream_id, int weight, bool exclusive,
quiche::QuicheReferenceCountedPointer<QuicAckListenerInterface>
ack_listener) {
diff --git a/quiche/quic/core/http/quic_spdy_session.h b/quiche/quic/core/http/quic_spdy_session.h
index 2e614e1..92cf9e7 100644
--- a/quiche/quic/core/http/quic_spdy_session.h
+++ b/quiche/quic/core/http/quic_spdy_session.h
@@ -32,8 +32,8 @@
#include "quiche/quic/core/quic_utils.h"
#include "quiche/quic/core/quic_versions.h"
#include "quiche/quic/platform/api/quic_export.h"
+#include "quiche/common/http/http_header_block.h"
#include "quiche/spdy/core/http2_frame_decoder_adapter.h"
-#include "quiche/spdy/core/http2_header_block.h"
namespace quic {
@@ -109,7 +109,7 @@
QuicByteCount /*payload_length*/) = 0;
virtual void OnHeadersFrameSent(
QuicStreamId /*stream_id*/,
- const spdy::Http2HeaderBlock& /*header_block*/) = 0;
+ const quiche::HttpHeaderBlock& /*header_block*/) = 0;
// 0-RTT related events.
virtual void OnSettingsFrameResumed(const SettingsFrame& /*frame*/) = 0;
@@ -217,7 +217,7 @@
// If provided, |ack_notifier_delegate| will be registered to be notified when
// we have seen ACKs for all packets resulting from this call.
virtual size_t WriteHeadersOnHeadersStream(
- QuicStreamId id, spdy::Http2HeaderBlock headers, bool fin,
+ QuicStreamId id, quiche::HttpHeaderBlock headers, bool fin,
const spdy::SpdyStreamPrecedence& precedence,
quiche::QuicheReferenceCountedPointer<QuicAckListenerInterface>
ack_listener);
@@ -515,7 +515,7 @@
PendingStream* pending) override;
size_t WriteHeadersOnHeadersStreamImpl(
- QuicStreamId id, spdy::Http2HeaderBlock headers, bool fin,
+ QuicStreamId id, quiche::HttpHeaderBlock headers, bool fin,
QuicStreamId parent_stream_id, int weight, bool exclusive,
quiche::QuicheReferenceCountedPointer<QuicAckListenerInterface>
ack_listener);
diff --git a/quiche/quic/core/http/quic_spdy_session_test.cc b/quiche/quic/core/http/quic_spdy_session_test.cc
index f52476b..8646ef3 100644
--- a/quiche/quic/core/http/quic_spdy_session_test.cc
+++ b/quiche/quic/core/http/quic_spdy_session_test.cc
@@ -53,7 +53,7 @@
#include "quiche/common/test_tools/quiche_test_utils.h"
#include "quiche/spdy/core/spdy_framer.h"
-using spdy::Http2HeaderBlock;
+using quiche::HttpHeaderBlock;
using spdy::kV3HighestPriority;
using spdy::Spdy3PriorityToHttp2Weight;
using spdy::SpdyFramer;
@@ -597,7 +597,7 @@
WebTransportHttp3* web_transport =
session_->GetWebTransportSession(session_id);
ASSERT_TRUE(web_transport != nullptr);
- spdy::Http2HeaderBlock header_block;
+ quiche::HttpHeaderBlock header_block;
web_transport->HeadersReceived(header_block);
}
@@ -1549,7 +1549,7 @@
// Write until the header stream is flow control blocked.
EXPECT_CALL(*connection_, SendControlFrame(_))
.WillOnce(Invoke(&ClearControlFrame));
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
SimpleRandom random;
while (!headers_stream->IsFlowControlBlocked() && stream_id < 2000) {
EXPECT_FALSE(session_->IsConnectionFlowControlBlocked());
@@ -1904,7 +1904,7 @@
.WillOnce(Return(WriteResult(WRITE_STATUS_OK, 0)));
// Write headers with FIN set to close write side of stream.
// Header block does not matter.
- stream->WriteHeaders(Http2HeaderBlock(), /* fin = */ true, nullptr);
+ stream->WriteHeaders(HttpHeaderBlock(), /* fin = */ true, nullptr);
// Receive headers that are too large or empty, with FIN set.
// This causes the stream to be reset. No frames must be written after this.
@@ -4160,7 +4160,7 @@
TestStream* stream = session_->CreateOutgoingBidirectionalStream();
EXPECT_CALL(*writer_, IsWriteBlocked()).WillRepeatedly(Return(true));
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
headers[":method"] = "GET"; // entry with index 2 in HPACK static table
stream->WriteHeaders(std::move(headers), /* fin = */ true, nullptr);
diff --git a/quiche/quic/core/http/quic_spdy_stream.cc b/quiche/quic/core/http/quic_spdy_stream.cc
index 71eced9..59b0644 100644
--- a/quiche/quic/core/http/quic_spdy_stream.cc
+++ b/quiche/quic/core/http/quic_spdy_stream.cc
@@ -45,7 +45,7 @@
using ::quiche::Capsule;
using ::quiche::CapsuleType;
-using ::spdy::Http2HeaderBlock;
+using ::quiche::HttpHeaderBlock;
namespace quic {
@@ -267,7 +267,7 @@
QuicSpdyStream::~QuicSpdyStream() {}
size_t QuicSpdyStream::WriteHeaders(
- Http2HeaderBlock header_block, bool fin,
+ HttpHeaderBlock header_block, bool fin,
quiche::QuicheReferenceCountedPointer<QuicAckListenerInterface>
ack_listener) {
if (!AssertNotWebTransportDataStream("writing headers")) {
@@ -344,7 +344,7 @@
}
size_t QuicSpdyStream::WriteTrailers(
- Http2HeaderBlock trailer_block,
+ HttpHeaderBlock trailer_block,
quiche::QuicheReferenceCountedPointer<QuicAckListenerInterface>
ack_listener) {
if (fin_sent()) {
@@ -681,10 +681,9 @@
}
}
-bool QuicSpdyStream::CopyAndValidateTrailers(const QuicHeaderList& header_list,
- bool expect_final_byte_offset,
- size_t* final_byte_offset,
- spdy::Http2HeaderBlock* trailers) {
+bool QuicSpdyStream::CopyAndValidateTrailers(
+ const QuicHeaderList& header_list, bool expect_final_byte_offset,
+ size_t* final_byte_offset, quiche::HttpHeaderBlock* trailers) {
return SpdyUtils::CopyAndValidateTrailers(
header_list, expect_final_byte_offset, final_byte_offset, trailers);
}
@@ -933,9 +932,9 @@
return headers_decompressed_ && header_list_.empty();
}
-bool QuicSpdyStream::ParseHeaderStatusCode(const Http2HeaderBlock& header,
+bool QuicSpdyStream::ParseHeaderStatusCode(const HttpHeaderBlock& header,
int* status_code) {
- Http2HeaderBlock::const_iterator it = header.find(spdy::kHttp2StatusHeader);
+ HttpHeaderBlock::const_iterator it = header.find(spdy::kHttp2StatusHeader);
if (it == header.end()) {
return false;
}
@@ -1287,7 +1286,7 @@
bool QuicSpdyStream::OnUnknownFrameEnd() { return true; }
size_t QuicSpdyStream::WriteHeadersImpl(
- spdy::Http2HeaderBlock header_block, bool fin,
+ quiche::HttpHeaderBlock header_block, bool fin,
quiche::QuicheReferenceCountedPointer<QuicAckListenerInterface>
ack_listener) {
if (!VersionUsesHttp3(transport_version())) {
@@ -1381,7 +1380,7 @@
}
void QuicSpdyStream::MaybeProcessSentWebTransportHeaders(
- spdy::Http2HeaderBlock& headers) {
+ quiche::HttpHeaderBlock& headers) {
if (!spdy_session_->SupportsWebTransport()) {
return;
}
diff --git a/quiche/quic/core/http/quic_spdy_stream.h b/quiche/quic/core/http/quic_spdy_stream.h
index b74cf99..ccb11c7 100644
--- a/quiche/quic/core/http/quic_spdy_stream.h
+++ b/quiche/quic/core/http/quic_spdy_stream.h
@@ -39,8 +39,8 @@
#include "quiche/quic/platform/api/quic_flags.h"
#include "quiche/quic/platform/api/quic_socket_address.h"
#include "quiche/common/capsule.h"
+#include "quiche/common/http/http_header_block.h"
#include "quiche/common/platform/api/quiche_mem_slice.h"
-#include "quiche/spdy/core/http2_header_block.h"
#include "quiche/spdy/core/spdy_framer.h"
namespace quic {
@@ -157,7 +157,7 @@
// number of bytes sent, including data sent on the encoder stream when using
// QPACK.
virtual size_t WriteHeaders(
- spdy::Http2HeaderBlock header_block, bool fin,
+ quiche::HttpHeaderBlock header_block, bool fin,
quiche::QuicheReferenceCountedPointer<QuicAckListenerInterface>
ack_listener);
@@ -169,7 +169,7 @@
// always have the FIN flag set. Returns the number of bytes sent, including
// data sent on the encoder stream when using QPACK.
virtual size_t WriteTrailers(
- spdy::Http2HeaderBlock trailer_block,
+ quiche::HttpHeaderBlock trailer_block,
quiche::QuicheReferenceCountedPointer<QuicAckListenerInterface>
ack_listener);
@@ -211,7 +211,7 @@
// Returns true if header contains a valid 3-digit status and parse the status
// code to |status_code|.
- static bool ParseHeaderStatusCode(const spdy::Http2HeaderBlock& header,
+ static bool ParseHeaderStatusCode(const quiche::HttpHeaderBlock& header,
int* status_code);
// Returns true if status_value (associated with :status) contains a valid
// 3-digit status and parse the status code to |status_code|.
@@ -237,7 +237,7 @@
bool trailers_decompressed() const { return trailers_decompressed_; }
// Returns whatever trailers have been received for this stream.
- const spdy::Http2HeaderBlock& received_trailers() const {
+ const quiche::HttpHeaderBlock& received_trailers() const {
return received_trailers_;
}
@@ -361,14 +361,14 @@
virtual void OnTrailingHeadersComplete(bool fin, size_t frame_len,
const QuicHeaderList& header_list);
virtual size_t WriteHeadersImpl(
- spdy::Http2HeaderBlock header_block, bool fin,
+ quiche::HttpHeaderBlock header_block, bool fin,
quiche::QuicheReferenceCountedPointer<QuicAckListenerInterface>
ack_listener);
virtual bool CopyAndValidateTrailers(const QuicHeaderList& header_list,
bool expect_final_byte_offset,
size_t* final_byte_offset,
- spdy::Http2HeaderBlock* trailers);
+ quiche::HttpHeaderBlock* trailers);
Visitor* visitor() { return visitor_; }
@@ -439,7 +439,7 @@
QuicByteCount GetNumFrameHeadersInInterval(QuicStreamOffset offset,
QuicByteCount data_length) const;
- void MaybeProcessSentWebTransportHeaders(spdy::Http2HeaderBlock& headers);
+ void MaybeProcessSentWebTransportHeaders(quiche::HttpHeaderBlock& headers);
void MaybeProcessReceivedWebTransportHeaders();
// Writes HTTP/3 DATA frame header. If |force_write| is true, use
@@ -483,7 +483,7 @@
bool trailers_consumed_;
// The parsed trailers received from the peer.
- spdy::Http2HeaderBlock received_trailers_;
+ quiche::HttpHeaderBlock received_trailers_;
// Headers accumulator for decoding HEADERS frame payload.
std::unique_ptr<QpackDecodedHeadersAccumulator>
diff --git a/quiche/quic/core/http/quic_spdy_stream_test.cc b/quiche/quic/core/http/quic_spdy_stream_test.cc
index 9ea9a77..1b44549 100644
--- a/quiche/quic/core/http/quic_spdy_stream_test.cc
+++ b/quiche/quic/core/http/quic_spdy_stream_test.cc
@@ -47,8 +47,8 @@
#include "quiche/common/simple_buffer_allocator.h"
using quiche::Capsule;
+using quiche::HttpHeaderBlock;
using quiche::IpAddressRange;
-using spdy::Http2HeaderBlock;
using spdy::kV3HighestPriority;
using spdy::kV3LowestPriority;
using testing::_;
@@ -255,7 +255,7 @@
MOCK_METHOD(void, WriteHeadersMock, (bool fin), ());
size_t WriteHeadersImpl(
- spdy::Http2HeaderBlock header_block, bool fin,
+ quiche::HttpHeaderBlock header_block, bool fin,
quiche::QuicheReferenceCountedPointer<QuicAckListenerInterface>
/*ack_listener*/) override {
saved_headers_ = std::move(header_block);
@@ -270,7 +270,9 @@
}
const std::string& data() const { return data_; }
- const spdy::Http2HeaderBlock& saved_headers() const { return saved_headers_; }
+ const quiche::HttpHeaderBlock& saved_headers() const {
+ return saved_headers_;
+ }
void OnStreamHeaderList(bool fin, size_t frame_len,
const QuicHeaderList& header_list) override {
@@ -282,7 +284,7 @@
private:
bool should_process_data_;
- spdy::Http2HeaderBlock saved_headers_;
+ quiche::HttpHeaderBlock saved_headers_;
std::string data_;
size_t headers_payload_length_;
};
@@ -383,7 +385,7 @@
// Return QPACK-encoded header block without using the dynamic table.
std::string EncodeQpackHeaders(
std::vector<std::pair<absl::string_view, absl::string_view>> headers) {
- Http2HeaderBlock header_block;
+ HttpHeaderBlock header_block;
for (const auto& header_field : headers) {
header_block.AppendValueOrAddHeader(header_field.first,
header_field.second);
@@ -393,7 +395,7 @@
}
// Return QPACK-encoded header block without using the dynamic table.
- std::string EncodeQpackHeaders(const Http2HeaderBlock& header) {
+ std::string EncodeQpackHeaders(const HttpHeaderBlock& header) {
NoopQpackStreamSenderDelegate encoder_stream_sender_delegate;
auto qpack_encoder = std::make_unique<QpackEncoder>(
session_.get(), HuffmanEncoding::kEnabled);
@@ -466,7 +468,7 @@
session_->GetMutableCryptoStream()->OnHandshakeMessage(message);
}
- QuicHeaderList ProcessHeaders(bool fin, const Http2HeaderBlock& headers) {
+ QuicHeaderList ProcessHeaders(bool fin, const HttpHeaderBlock& headers) {
QuicHeaderList h = AsHeaderList(headers);
stream_->OnStreamHeaderList(fin, h.uncompressed_header_bytes(), h);
return h;
@@ -490,7 +492,7 @@
// Construct HEADERS frame with QPACK-encoded |headers| without using the
// dynamic table.
- std::string HeadersFrame(const Http2HeaderBlock& headers) {
+ std::string HeadersFrame(const HttpHeaderBlock& headers) {
return HeadersFrame(EncodeQpackHeaders(headers));
}
@@ -534,7 +536,7 @@
TestStream* stream_;
TestStream* stream2_;
- Http2HeaderBlock headers_;
+ HttpHeaderBlock headers_;
};
INSTANTIATE_TEST_SUITE_P(Tests, QuicSpdyStreamTest,
@@ -1286,11 +1288,11 @@
stream_->ConsumeHeaderList();
// Receive trailing headers.
- Http2HeaderBlock trailers_block;
+ HttpHeaderBlock trailers_block;
trailers_block["key1"] = "value1";
trailers_block["key2"] = "value2";
trailers_block["key3"] = "value3";
- Http2HeaderBlock trailers_block_with_final_offset = trailers_block.Clone();
+ HttpHeaderBlock trailers_block_with_final_offset = trailers_block.Clone();
if (!UsesHttp3()) {
// :final-offset pseudo-header is only added if trailers are sent
// on the headers stream.
@@ -1333,7 +1335,7 @@
std::string data = UsesHttp3() ? DataFrame(body) : body;
// Receive trailing headers.
- Http2HeaderBlock trailers_block;
+ HttpHeaderBlock trailers_block;
trailers_block["key1"] = "value1";
trailers_block["key2"] = "value2";
trailers_block["key3"] = "value3";
@@ -1376,7 +1378,7 @@
stream_->ConsumeHeaderList();
// Receive trailing headers, without kFinalOffsetHeaderKey.
- Http2HeaderBlock trailers_block;
+ HttpHeaderBlock trailers_block;
trailers_block["key1"] = "value1";
trailers_block["key2"] = "value2";
trailers_block["key3"] = "value3";
@@ -1410,7 +1412,7 @@
stream_->ConsumeHeaderList();
// Receive trailing headers with FIN deliberately set to false.
- Http2HeaderBlock trailers_block;
+ HttpHeaderBlock trailers_block;
trailers_block["foo"] = "bar";
auto trailers = AsHeaderList(trailers_block);
@@ -1437,7 +1439,7 @@
stream_->ConsumeHeaderList();
// Receive trailing headers after FIN already received.
- Http2HeaderBlock trailers_block;
+ HttpHeaderBlock trailers_block;
trailers_block["foo"] = "bar";
EXPECT_CALL(*connection_,
CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA, _, _))
@@ -1466,7 +1468,7 @@
stream_->OnStreamFrame(frame);
// Receive trailing headers after FIN already received.
- Http2HeaderBlock trailers_block;
+ HttpHeaderBlock trailers_block;
trailers_block["foo"] = "bar";
EXPECT_CALL(*connection_,
CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA, _, _))
@@ -1509,10 +1511,10 @@
// Write the initial headers, without a FIN.
EXPECT_CALL(*stream_, WriteHeadersMock(false));
- stream_->WriteHeaders(Http2HeaderBlock(), /*fin=*/false, nullptr);
+ stream_->WriteHeaders(HttpHeaderBlock(), /*fin=*/false, nullptr);
// Writing trailers implicitly sends a FIN.
- Http2HeaderBlock trailers;
+ HttpHeaderBlock trailers;
trailers["trailer key"] = "trailer value";
EXPECT_CALL(*stream_, WriteHeadersMock(true));
stream_->WriteTrailers(std::move(trailers), nullptr);
@@ -1542,10 +1544,10 @@
// Write the initial headers, without a FIN.
EXPECT_CALL(*stream_, WriteHeadersMock(false));
EXPECT_CALL(debug_visitor, OnHeadersFrameSent(stream_->id(), _));
- stream_->WriteHeaders(Http2HeaderBlock(), /*fin=*/false, nullptr);
+ stream_->WriteHeaders(HttpHeaderBlock(), /*fin=*/false, nullptr);
// Writing trailers implicitly sends a FIN.
- Http2HeaderBlock trailers;
+ HttpHeaderBlock trailers;
trailers["trailer key"] = "trailer value";
EXPECT_CALL(*stream_, WriteHeadersMock(true));
EXPECT_CALL(debug_visitor, OnHeadersFrameSent(stream_->id(), _));
@@ -1565,7 +1567,7 @@
EXPECT_CALL(*session_, WritevData(stream_->id(), _, _, _, _, _)).Times(1);
EXPECT_CALL(*stream_, WriteHeadersMock(false));
EXPECT_CALL(debug_visitor, OnHeadersFrameSent(stream_->id(), _));
- stream_->WriteHeaders(Http2HeaderBlock(), /*fin=*/false, nullptr);
+ stream_->WriteHeaders(HttpHeaderBlock(), /*fin=*/false, nullptr);
testing::Mock::VerifyAndClearExpectations(&debug_visitor);
// PRIORITY_UPDATE frame on the control stream.
@@ -1613,7 +1615,7 @@
// PRIORITY_UPDATE frame is not sent this time, because one is already sent.
EXPECT_CALL(*session_, WritevData(stream_->id(), _, _, _, _, _)).Times(1);
EXPECT_CALL(*stream_, WriteHeadersMock(true));
- stream_->WriteHeaders(Http2HeaderBlock(), /*fin=*/true, nullptr);
+ stream_->WriteHeaders(HttpHeaderBlock(), /*fin=*/true, nullptr);
}
// Test that when writing trailers, the trailers that are actually sent to the
@@ -1629,7 +1631,7 @@
// Write the initial headers.
EXPECT_CALL(*stream_, WriteHeadersMock(false));
- stream_->WriteHeaders(Http2HeaderBlock(), /*fin=*/false, nullptr);
+ stream_->WriteHeaders(HttpHeaderBlock(), /*fin=*/false, nullptr);
// Write non-zero body data to force a non-zero final offset.
EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _)).Times(AtLeast(1));
@@ -1645,10 +1647,10 @@
// The final offset field in the trailing headers is populated with the
// number of body bytes written (including queued bytes).
- Http2HeaderBlock trailers;
+ HttpHeaderBlock trailers;
trailers["trailer key"] = "trailer value";
- Http2HeaderBlock expected_trailers(trailers.Clone());
+ HttpHeaderBlock expected_trailers(trailers.Clone());
// :final-offset pseudo-header is only added if trailers are sent
// on the headers stream.
if (!UsesHttp3()) {
@@ -1673,7 +1675,7 @@
// Write the initial headers.
EXPECT_CALL(*stream_, WriteHeadersMock(false));
- stream_->WriteHeaders(Http2HeaderBlock(), /*fin=*/false, nullptr);
+ stream_->WriteHeaders(HttpHeaderBlock(), /*fin=*/false, nullptr);
// Write non-zero body data.
const int kBodySize = 1 * 1024; // 1 kB
@@ -1683,7 +1685,7 @@
// Headers and body have been fully written, there is no queued data. Writing
// trailers marks the end of this stream, and thus the write side is closed.
EXPECT_CALL(*stream_, WriteHeadersMock(true));
- stream_->WriteTrailers(Http2HeaderBlock(), nullptr);
+ stream_->WriteTrailers(HttpHeaderBlock(), nullptr);
EXPECT_TRUE(stream_->write_side_closed());
}
@@ -1702,7 +1704,7 @@
// Write the initial headers.
EXPECT_CALL(*stream_, WriteHeadersMock(false));
- stream_->WriteHeaders(Http2HeaderBlock(), /*fin=*/false, nullptr);
+ stream_->WriteHeaders(HttpHeaderBlock(), /*fin=*/false, nullptr);
// Write non-zero body data, but only consume partially, ensuring queueing.
const int kBodySize = 1 * 1024; // 1 kB
@@ -1717,7 +1719,7 @@
// Writing trailers will send a FIN, but not close the write side of the
// stream as there are queued bytes.
EXPECT_CALL(*stream_, WriteHeadersMock(true));
- stream_->WriteTrailers(Http2HeaderBlock(), nullptr);
+ stream_->WriteTrailers(HttpHeaderBlock(), nullptr);
EXPECT_TRUE(stream_->fin_sent());
EXPECT_FALSE(stream_->write_side_closed());
@@ -1739,12 +1741,12 @@
// Write the initial headers, with a FIN.
EXPECT_CALL(*stream_, WriteHeadersMock(true));
- stream_->WriteHeaders(Http2HeaderBlock(), /*fin=*/true, nullptr);
+ stream_->WriteHeaders(HttpHeaderBlock(), /*fin=*/true, nullptr);
EXPECT_TRUE(stream_->fin_sent());
// Writing Trailers should fail, as the FIN has already been sent.
// populated with the number of body bytes written.
- EXPECT_QUIC_BUG(stream_->WriteTrailers(Http2HeaderBlock(), nullptr),
+ EXPECT_QUIC_BUG(stream_->WriteTrailers(HttpHeaderBlock(), nullptr),
"Trailers cannot be sent after a FIN");
}
@@ -2120,7 +2122,7 @@
// A header block that will take more than one block of sequencer buffer.
// This ensures that when the trailers are consumed, some buffer buckets will
// be freed.
- Http2HeaderBlock trailers_block;
+ HttpHeaderBlock trailers_block;
trailers_block["key1"] = std::string(10000, 'x');
std::string trailers = HeadersFrame(trailers_block);
@@ -3114,7 +3116,7 @@
}));
// Receive another HEADERS frame, with no header fields.
- std::string trailers2 = HeadersFrame(Http2HeaderBlock());
+ std::string trailers2 = HeadersFrame(HttpHeaderBlock());
stream_->OnStreamFrame(
QuicStreamFrame(stream_->id(), false, offset, trailers2));
}
@@ -3300,7 +3302,7 @@
DoAll(SaveArg<1>(&bytes_written),
Invoke(session_.get(), &MockQuicSpdySession::ConsumeData)));
- Http2HeaderBlock request_headers;
+ HttpHeaderBlock request_headers;
request_headers["foo"] = "bar";
size_t write_headers_return_value =
stream_->WriteHeaders(std::move(request_headers), /*fin=*/true, nullptr);
@@ -3351,7 +3353,7 @@
EXPECT_CALL(*session_, WritevData(stream_->id(), _, _, _, _, _))
.Times(AnyNumber());
- spdy::Http2HeaderBlock headers;
+ quiche::HttpHeaderBlock headers;
headers[":method"] = "CONNECT";
headers[":protocol"] = "webtransport";
stream_->WriteHeaders(std::move(headers), /*fin=*/false, nullptr);
diff --git a/quiche/quic/core/http/spdy_utils.cc b/quiche/quic/core/http/spdy_utils.cc
index 7df35ef..8e0d206 100644
--- a/quiche/quic/core/http/spdy_utils.cc
+++ b/quiche/quic/core/http/spdy_utils.cc
@@ -20,13 +20,13 @@
#include "quiche/common/quiche_text_utils.h"
#include "quiche/spdy/core/spdy_protocol.h"
-using spdy::Http2HeaderBlock;
+using quiche::HttpHeaderBlock;
namespace quic {
// static
bool SpdyUtils::ExtractContentLengthFromHeaders(int64_t* content_length,
- Http2HeaderBlock* headers) {
+ HttpHeaderBlock* headers) {
auto it = headers->find("content-length");
if (it == headers->end()) {
return false;
@@ -61,7 +61,7 @@
bool SpdyUtils::CopyAndValidateHeaders(const QuicHeaderList& header_list,
int64_t* content_length,
- Http2HeaderBlock* headers) {
+ HttpHeaderBlock* headers) {
for (const auto& p : header_list) {
const std::string& name = p.first;
if (name.empty()) {
@@ -90,7 +90,7 @@
bool SpdyUtils::CopyAndValidateTrailers(const QuicHeaderList& header_list,
bool expect_final_byte_offset,
size_t* final_byte_offset,
- Http2HeaderBlock* trailers) {
+ HttpHeaderBlock* trailers) {
bool found_final_byte_offset = false;
for (const auto& p : header_list) {
const std::string& name = p.first;
@@ -135,7 +135,7 @@
// static
// TODO(danzh): Move it to quic/tools/ and switch to use GURL.
bool SpdyUtils::PopulateHeaderBlockFromUrl(const std::string url,
- Http2HeaderBlock* headers) {
+ HttpHeaderBlock* headers) {
(*headers)[":method"] = "GET";
size_t pos = url.find("://");
if (pos == std::string::npos) {
diff --git a/quiche/quic/core/http/spdy_utils.h b/quiche/quic/core/http/spdy_utils.h
index 0b0b854..2118a4d 100644
--- a/quiche/quic/core/http/spdy_utils.h
+++ b/quiche/quic/core/http/spdy_utils.h
@@ -14,7 +14,7 @@
#include "quiche/quic/core/http/quic_header_list.h"
#include "quiche/quic/core/quic_packets.h"
#include "quiche/quic/platform/api/quic_export.h"
-#include "quiche/spdy/core/http2_header_block.h"
+#include "quiche/common/http/http_header_block.h"
#include "quiche/spdy/core/spdy_alt_svc_wire_format.h"
namespace quic {
@@ -27,12 +27,12 @@
// Returns true on success, false if parsing fails or content-length header is
// missing.
static bool ExtractContentLengthFromHeaders(int64_t* content_length,
- spdy::Http2HeaderBlock* headers);
+ quiche::HttpHeaderBlock* headers);
// Copies a list of headers to a Http2HeaderBlock.
static bool CopyAndValidateHeaders(const QuicHeaderList& header_list,
int64_t* content_length,
- spdy::Http2HeaderBlock* headers);
+ quiche::HttpHeaderBlock* headers);
// Copies a list of headers to a Http2HeaderBlock.
// If |expect_final_byte_offset| is true, requires exactly one header field
@@ -47,12 +47,12 @@
static bool CopyAndValidateTrailers(const QuicHeaderList& header_list,
bool expect_final_byte_offset,
size_t* final_byte_offset,
- spdy::Http2HeaderBlock* trailers);
+ quiche::HttpHeaderBlock* trailers);
// Populates the fields of |headers| to make a GET request of |url|,
// which must be fully-qualified.
static bool PopulateHeaderBlockFromUrl(const std::string url,
- spdy::Http2HeaderBlock* headers);
+ quiche::HttpHeaderBlock* headers);
// Returns the advertised QUIC version from the specified alternative service
// advertisement, or ParsedQuicVersion::Unsupported() if no supported version
diff --git a/quiche/quic/core/http/spdy_utils_test.cc b/quiche/quic/core/http/spdy_utils_test.cc
index 43177ba..944d866 100644
--- a/quiche/quic/core/http/spdy_utils_test.cc
+++ b/quiche/quic/core/http/spdy_utils_test.cc
@@ -12,7 +12,7 @@
#include "quiche/quic/core/quic_versions.h"
#include "quiche/quic/platform/api/quic_test.h"
-using spdy::Http2HeaderBlock;
+using quiche::HttpHeaderBlock;
using testing::Pair;
using testing::UnorderedElementsAre;
@@ -64,7 +64,7 @@
{"cookie", " fin!"}});
int64_t content_length = -1;
- Http2HeaderBlock block;
+ HttpHeaderBlock block;
ASSERT_TRUE(
SpdyUtils::CopyAndValidateHeaders(*headers, &content_length, &block));
EXPECT_THAT(block,
@@ -80,7 +80,7 @@
TEST_F(CopyAndValidateHeaders, EmptyName) {
auto headers = FromList({{"foo", "foovalue"}, {"", "barvalue"}, {"baz", ""}});
int64_t content_length = -1;
- Http2HeaderBlock block;
+ HttpHeaderBlock block;
ASSERT_FALSE(
SpdyUtils::CopyAndValidateHeaders(*headers, &content_length, &block));
}
@@ -89,7 +89,7 @@
auto headers =
FromList({{"foo", "foovalue"}, {"bar", "barvalue"}, {"bAz", ""}});
int64_t content_length = -1;
- Http2HeaderBlock block;
+ HttpHeaderBlock block;
ASSERT_FALSE(
SpdyUtils::CopyAndValidateHeaders(*headers, &content_length, &block));
}
@@ -101,7 +101,7 @@
{"bar", "barvalue"},
{"baz", ""}});
int64_t content_length = -1;
- Http2HeaderBlock block;
+ HttpHeaderBlock block;
ASSERT_TRUE(
SpdyUtils::CopyAndValidateHeaders(*headers, &content_length, &block));
EXPECT_THAT(block, UnorderedElementsAre(
@@ -118,7 +118,7 @@
{"bar", "barvalue"},
{"baz", ""}});
int64_t content_length = -1;
- Http2HeaderBlock block;
+ HttpHeaderBlock block;
ASSERT_FALSE(
SpdyUtils::CopyAndValidateHeaders(*headers, &content_length, &block));
}
@@ -129,7 +129,7 @@
{"bar", "barvalue"},
{"baz", ""}});
int64_t content_length = -1;
- Http2HeaderBlock block;
+ HttpHeaderBlock block;
ASSERT_TRUE(
SpdyUtils::CopyAndValidateHeaders(*headers, &content_length, &block));
EXPECT_THAT(block,
@@ -149,7 +149,7 @@
{"bar", "barvalue"},
{"baz", ""}});
int64_t content_length = -1;
- Http2HeaderBlock block;
+ HttpHeaderBlock block;
EXPECT_FALSE(
SpdyUtils::CopyAndValidateHeaders(*headers, &content_length, &block));
}
@@ -161,7 +161,7 @@
{"foo", "boo"},
{"baz", "buzz"}});
int64_t content_length = -1;
- Http2HeaderBlock block;
+ HttpHeaderBlock block;
ASSERT_TRUE(
SpdyUtils::CopyAndValidateHeaders(*headers, &content_length, &block));
EXPECT_THAT(block, UnorderedElementsAre(
@@ -176,7 +176,7 @@
{"set-cookie", "value2"},
{"set-cookie", "value3"}});
int64_t content_length = -1;
- Http2HeaderBlock block;
+ HttpHeaderBlock block;
ASSERT_TRUE(
SpdyUtils::CopyAndValidateHeaders(*headers, &content_length, &block));
EXPECT_THAT(block, UnorderedElementsAre(Pair(
@@ -191,7 +191,7 @@
{"cookie", "value1"},
{"baz", ""}});
int64_t content_length = -1;
- Http2HeaderBlock block;
+ HttpHeaderBlock block;
ASSERT_TRUE(
SpdyUtils::CopyAndValidateHeaders(*headers, &content_length, &block));
EXPECT_THAT(block, UnorderedElementsAre(
@@ -207,7 +207,7 @@
{"baz", ""},
{"cookie", "value2"}});
int64_t content_length = -1;
- Http2HeaderBlock block;
+ HttpHeaderBlock block;
ASSERT_TRUE(
SpdyUtils::CopyAndValidateHeaders(*headers, &content_length, &block));
EXPECT_THAT(block, UnorderedElementsAre(
@@ -223,7 +223,7 @@
// gets parsed successfully.
auto trailers = FromList({{kFinalOffsetHeaderKey, "1234"}});
size_t final_byte_offset = 0;
- Http2HeaderBlock block;
+ HttpHeaderBlock block;
EXPECT_TRUE(SpdyUtils::CopyAndValidateTrailers(
*trailers, kExpectFinalByteOffset, &final_byte_offset, &block));
EXPECT_EQ(1234u, final_byte_offset);
@@ -234,7 +234,7 @@
// not present.
QuicHeaderList trailers;
size_t final_byte_offset = 0;
- Http2HeaderBlock block;
+ HttpHeaderBlock block;
EXPECT_FALSE(SpdyUtils::CopyAndValidateTrailers(
trailers, kExpectFinalByteOffset, &final_byte_offset, &block));
}
@@ -245,7 +245,7 @@
// not expected.
QuicHeaderList trailers;
size_t final_byte_offset = 0;
- Http2HeaderBlock block;
+ HttpHeaderBlock block;
EXPECT_TRUE(SpdyUtils::CopyAndValidateTrailers(
trailers, kDoNotExpectFinalByteOffset, &final_byte_offset, &block));
EXPECT_TRUE(block.empty());
@@ -256,7 +256,7 @@
// the rest of the header block is valid.
auto trailers = FromList({{"key", "value"}});
size_t final_byte_offset = 0;
- Http2HeaderBlock block;
+ HttpHeaderBlock block;
EXPECT_FALSE(SpdyUtils::CopyAndValidateTrailers(
*trailers, kExpectFinalByteOffset, &final_byte_offset, &block));
}
@@ -266,7 +266,7 @@
// even if the rest of the header block is valid.
auto trailers = FromList({{"key", "value"}, {kFinalOffsetHeaderKey, "1234"}});
size_t final_byte_offset = 0;
- Http2HeaderBlock block;
+ HttpHeaderBlock block;
EXPECT_FALSE(SpdyUtils::CopyAndValidateTrailers(
*trailers, kDoNotExpectFinalByteOffset, &final_byte_offset, &block));
}
@@ -276,7 +276,7 @@
// present.
auto trailers = FromList({{"key", "value"}});
size_t final_byte_offset = 0;
- Http2HeaderBlock block;
+ HttpHeaderBlock block;
EXPECT_TRUE(SpdyUtils::CopyAndValidateTrailers(
*trailers, kDoNotExpectFinalByteOffset, &final_byte_offset, &block));
EXPECT_THAT(block, UnorderedElementsAre(Pair("key", "value")));
@@ -287,7 +287,7 @@
// valid block of trailers.
auto trailers = FromList({{"", "value"}, {kFinalOffsetHeaderKey, "1234"}});
size_t final_byte_offset = 0;
- Http2HeaderBlock block;
+ HttpHeaderBlock block;
EXPECT_FALSE(SpdyUtils::CopyAndValidateTrailers(
*trailers, kExpectFinalByteOffset, &final_byte_offset, &block));
}
@@ -297,7 +297,7 @@
auto trailers =
FromList({{":pseudo_key", "value"}, {kFinalOffsetHeaderKey, "1234"}});
size_t final_byte_offset = 0;
- Http2HeaderBlock block;
+ HttpHeaderBlock block;
EXPECT_FALSE(SpdyUtils::CopyAndValidateTrailers(
*trailers, kExpectFinalByteOffset, &final_byte_offset, &block));
}
@@ -316,7 +316,7 @@
{"other_key", "value"},
{"key", "non_contiguous_duplicate"}});
size_t final_byte_offset = 0;
- Http2HeaderBlock block;
+ HttpHeaderBlock block;
EXPECT_TRUE(SpdyUtils::CopyAndValidateTrailers(
*trailers, kExpectFinalByteOffset, &final_byte_offset, &block));
EXPECT_THAT(
@@ -340,7 +340,7 @@
{"cookie", " non_contiguous_cookie!"}});
size_t final_byte_offset = 0;
- Http2HeaderBlock block;
+ HttpHeaderBlock block;
EXPECT_TRUE(SpdyUtils::CopyAndValidateTrailers(
*headers, kExpectFinalByteOffset, &final_byte_offset, &block));
EXPECT_THAT(
@@ -354,7 +354,7 @@
TEST_F(PopulateHeaderBlockFromUrl, NormalUsage) {
std::string url = "https://www.google.com/index.html";
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
EXPECT_TRUE(SpdyUtils::PopulateHeaderBlockFromUrl(url, &headers));
EXPECT_EQ("https", headers[":scheme"].as_string());
EXPECT_EQ("www.google.com", headers[":authority"].as_string());
@@ -363,7 +363,7 @@
TEST_F(PopulateHeaderBlockFromUrl, UrlWithNoPath) {
std::string url = "https://www.google.com";
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
EXPECT_TRUE(SpdyUtils::PopulateHeaderBlockFromUrl(url, &headers));
EXPECT_EQ("https", headers[":scheme"].as_string());
EXPECT_EQ("www.google.com", headers[":authority"].as_string());
@@ -371,7 +371,7 @@
}
TEST_F(PopulateHeaderBlockFromUrl, Failure) {
- Http2HeaderBlock headers;
+ HttpHeaderBlock headers;
EXPECT_FALSE(SpdyUtils::PopulateHeaderBlockFromUrl("/", &headers));
EXPECT_FALSE(SpdyUtils::PopulateHeaderBlockFromUrl("/index.html", &headers));
EXPECT_FALSE(
diff --git a/quiche/quic/core/http/web_transport_http3.cc b/quiche/quic/core/http/web_transport_http3.cc
index e3d4472..d0687ee 100644
--- a/quiche/quic/core/http/web_transport_http3.cc
+++ b/quiche/quic/core/http/web_transport_http3.cc
@@ -164,7 +164,8 @@
connect_stream_->WriteOrBufferBody("", /*fin=*/true);
}
-void WebTransportHttp3::HeadersReceived(const spdy::Http2HeaderBlock& headers) {
+void WebTransportHttp3::HeadersReceived(
+ const quiche::HttpHeaderBlock& headers) {
if (session_->perspective() == Perspective::IS_CLIENT) {
int status_code;
if (!QuicSpdyStream::ParseHeaderStatusCode(headers, &status_code)) {
diff --git a/quiche/quic/core/http/web_transport_http3.h b/quiche/quic/core/http/web_transport_http3.h
index 4f3815b..b6d5110 100644
--- a/quiche/quic/core/http/web_transport_http3.h
+++ b/quiche/quic/core/http/web_transport_http3.h
@@ -18,10 +18,10 @@
#include "quiche/quic/core/quic_types.h"
#include "quiche/quic/core/web_transport_interface.h"
#include "quiche/quic/core/web_transport_stats.h"
+#include "quiche/common/http/http_header_block.h"
#include "quiche/common/platform/api/quiche_mem_slice.h"
#include "quiche/common/quiche_callbacks.h"
#include "quiche/web_transport/web_transport.h"
-#include "quiche/spdy/core/http2_header_block.h"
namespace quic {
@@ -48,7 +48,7 @@
WebTransportHttp3(QuicSpdySession* session, QuicSpdyStream* connect_stream,
WebTransportSessionId id);
- void HeadersReceived(const spdy::Http2HeaderBlock& headers);
+ void HeadersReceived(const quiche::HttpHeaderBlock& headers);
void SetVisitor(std::unique_ptr<WebTransportVisitor> visitor) {
visitor_ = std::move(visitor);
}