#include "net/test/embedded_test_server/http2_connection.h"
#include <memory>
#include <string_view>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_ref.h"
#include "base/strings/strcat.h"
#include "base/task/sequenced_task_runner.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_status_code.h"
#include "net/socket/stream_socket.h"
#include "net/ssl/ssl_info.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
namespace net {
namespace {
std::vector<http2::adapter::Header> GenerateHeaders(HttpStatusCode status,
base::StringPairs headers) { … }
}
namespace test_server {
class Http2Connection::DataFrameSource
: public http2::adapter::DataFrameSource { … };
class Http2Connection::ResponseDelegate : public HttpResponseDelegate { … };
Http2Connection::Http2Connection(
std::unique_ptr<StreamSocket> socket,
EmbeddedTestServerConnectionListener* connection_listener,
EmbeddedTestServer* embedded_test_server)
: … { … }
Http2Connection::~Http2Connection() = default;
void Http2Connection::OnSocketReady() { … }
void Http2Connection::ReadData() { … }
void Http2Connection::OnDataRead(int rv) { … }
bool Http2Connection::HandleData(int rv) { … }
StreamSocket* Http2Connection::Socket() { … }
std::unique_ptr<StreamSocket> Http2Connection::TakeSocket() { … }
base::WeakPtr<HttpConnection> Http2Connection::GetWeakPtr() { … }
int64_t Http2Connection::OnReadyToSend(std::string_view serialized) { … }
bool Http2Connection::OnCloseStream(StreamId stream_id,
http2::adapter::Http2ErrorCode error_code) { … }
void Http2Connection::SendInternal() { … }
void Http2Connection::OnSendInternalDone(int rv) { … }
void Http2Connection::SendIfNotProcessing() { … }
http2::adapter::Http2VisitorInterface::OnHeaderResult
Http2Connection::OnHeaderForStream(http2::adapter::Http2StreamId stream_id,
std::string_view key,
std::string_view value) { … }
bool Http2Connection::OnEndHeadersForStream(
http2::adapter::Http2StreamId stream_id) { … }
bool Http2Connection::OnEndStream(http2::adapter::Http2StreamId stream_id) { … }
bool Http2Connection::OnFrameHeader(StreamId ,
size_t ,
uint8_t ,
uint8_t ) { … }
bool Http2Connection::OnBeginHeadersForStream(StreamId stream_id) { … }
bool Http2Connection::OnBeginDataForStream(StreamId stream_id,
size_t payload_length) { … }
bool Http2Connection::OnDataForStream(StreamId stream_id,
std::string_view data) { … }
bool Http2Connection::OnDataPaddingLength(StreamId stream_id,
size_t padding_length) { … }
bool Http2Connection::OnGoAway(StreamId last_accepted_stream_id,
http2::adapter::Http2ErrorCode error_code,
std::string_view opaque_data) { … }
int Http2Connection::OnBeforeFrameSent(uint8_t frame_type,
StreamId stream_id,
size_t length,
uint8_t flags) { … }
int Http2Connection::OnFrameSent(uint8_t frame_type,
StreamId stream_id,
size_t length,
uint8_t flags,
uint32_t error_code) { … }
bool Http2Connection::OnInvalidFrame(StreamId stream_id,
InvalidFrameError error) { … }
bool Http2Connection::OnMetadataForStream(StreamId stream_id,
std::string_view metadata) { … }
bool Http2Connection::OnMetadataEndForStream(StreamId stream_id) { … }
}
}