#include "quiche/quic/core/http/quic_spdy_session.h"
#include <algorithm>
#include <cstdint>
#include <limits>
#include <memory>
#include <optional>
#include <ostream>
#include <string>
#include <utility>
#include "absl/base/attributes.h"
#include "absl/strings/numbers.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "quiche/quic/core/http/http_constants.h"
#include "quiche/quic/core/http/http_decoder.h"
#include "quiche/quic/core/http/http_frames.h"
#include "quiche/quic/core/http/quic_headers_stream.h"
#include "quiche/quic/core/http/quic_spdy_stream.h"
#include "quiche/quic/core/http/web_transport_http3.h"
#include "quiche/quic/core/quic_error_codes.h"
#include "quiche/quic/core/quic_session.h"
#include "quiche/quic/core/quic_types.h"
#include "quiche/quic/core/quic_utils.h"
#include "quiche/quic/core/quic_versions.h"
#include "quiche/quic/platform/api/quic_bug_tracker.h"
#include "quiche/quic/platform/api/quic_exported_stats.h"
#include "quiche/quic/platform/api/quic_flag_utils.h"
#include "quiche/quic/platform/api/quic_flags.h"
#include "quiche/quic/platform/api/quic_logging.h"
#include "quiche/quic/platform/api/quic_stack_trace.h"
#include "quiche/common/platform/api/quiche_mem_slice.h"
#include "quiche/spdy/core/http2_frame_decoder_adapter.h"
Http2DecoderAdapter;
HttpHeaderBlock;
Http2WeightToSpdy3Priority;
Spdy3PriorityToHttp2Weight;
SpdyErrorCode;
SpdyFramer;
SpdyFramerDebugVisitorInterface;
SpdyFramerVisitorInterface;
SpdyFrameType;
SpdyHeadersHandlerInterface;
SpdyHeadersIR;
SpdyPingId;
SpdyPriority;
SpdyPriorityIR;
SpdySerializedFrame;
SpdySettingsId;
SpdyStreamId;
namespace quic {
ABSL_CONST_INIT const size_t kMaxUnassociatedWebTransportStreams = …;
namespace {
constexpr uint64_t kHpackEncoderDynamicTableSizeLimit = …;
constexpr QuicStreamCount kDefaultMaxWebTransportSessions = …;
#define ENDPOINT …
class AlpsFrameDecoder : public HttpDecoder::Visitor { … };
uint64_t GetDefaultQpackMaximumDynamicTableCapacity(Perspective perspective) { … }
class SizeLimitingHeaderList : public spdy::SpdyHeadersHandlerInterface { … };
}
class QuicSpdySession::SpdyFramerVisitor
: public SpdyFramerVisitorInterface,
public SpdyFramerDebugVisitorInterface { … };
Http3DebugVisitor::Http3DebugVisitor() { … }
Http3DebugVisitor::~Http3DebugVisitor() { … }
QuicSpdySession::QuicSpdySession(
QuicConnection* connection, QuicSession::Visitor* visitor,
const QuicConfig& config, const ParsedQuicVersionVector& supported_versions)
: … { … }
QuicSpdySession::~QuicSpdySession() { … }
void QuicSpdySession::Initialize() { … }
void QuicSpdySession::FillSettingsFrame() { … }
void QuicSpdySession::OnDecoderStreamError(QuicErrorCode error_code,
absl::string_view error_message) { … }
void QuicSpdySession::OnEncoderStreamError(QuicErrorCode error_code,
absl::string_view error_message) { … }
void QuicSpdySession::OnStreamHeadersPriority(
QuicStreamId stream_id, const spdy::SpdyStreamPrecedence& precedence) { … }
void QuicSpdySession::OnStreamHeaderList(QuicStreamId stream_id, bool fin,
size_t frame_len,
const QuicHeaderList& header_list) { … }
void QuicSpdySession::OnPriorityFrame(
QuicStreamId stream_id, const spdy::SpdyStreamPrecedence& precedence) { … }
bool QuicSpdySession::OnPriorityUpdateForRequestStream(
QuicStreamId stream_id, HttpStreamPriority priority) { … }
size_t QuicSpdySession::ProcessHeaderData(const struct iovec& iov) { … }
size_t QuicSpdySession::WriteHeadersOnHeadersStream(
QuicStreamId id, HttpHeaderBlock headers, bool fin,
const spdy::SpdyStreamPrecedence& precedence,
quiche::QuicheReferenceCountedPointer<QuicAckListenerInterface>
ack_listener) { … }
size_t QuicSpdySession::WritePriority(QuicStreamId stream_id,
QuicStreamId parent_stream_id, int weight,
bool exclusive) { … }
void QuicSpdySession::WriteHttp3PriorityUpdate(QuicStreamId stream_id,
HttpStreamPriority priority) { … }
void QuicSpdySession::OnHttp3GoAway(uint64_t id) { … }
bool QuicSpdySession::OnStreamsBlockedFrame(
const QuicStreamsBlockedFrame& frame) { … }
void QuicSpdySession::SendHttp3GoAway(QuicErrorCode error_code,
const std::string& reason) { … }
void QuicSpdySession::SendInitialData() { … }
bool QuicSpdySession::CheckStreamWriteBlocked(QuicStream* stream) const { … }
QpackEncoder* QuicSpdySession::qpack_encoder() { … }
QpackDecoder* QuicSpdySession::qpack_decoder() { … }
void QuicSpdySession::OnStreamCreated(QuicSpdyStream* stream) { … }
QuicSpdyStream* QuicSpdySession::GetOrCreateSpdyDataStream(
const QuicStreamId stream_id) { … }
void QuicSpdySession::OnNewEncryptionKeyAvailable(
EncryptionLevel level, std::unique_ptr<QuicEncrypter> encrypter) { … }
bool QuicSpdySession::ShouldNegotiateWebTransport() const { … }
WebTransportHttp3VersionSet
QuicSpdySession::LocallySupportedWebTransportVersions() const { … }
bool QuicSpdySession::WillNegotiateWebTransport() { … }
bool QuicSpdySession::ShouldKeepConnectionAlive() const { … }
bool QuicSpdySession::UsesPendingStreamForFrame(QuicFrameType type,
QuicStreamId stream_id) const { … }
size_t QuicSpdySession::WriteHeadersOnHeadersStreamImpl(
QuicStreamId id, quiche::HttpHeaderBlock headers, bool fin,
QuicStreamId parent_stream_id, int weight, bool exclusive,
quiche::QuicheReferenceCountedPointer<QuicAckListenerInterface>
ack_listener) { … }
bool QuicSpdySession::ResumeApplicationState(ApplicationState* cached_state) { … }
std::optional<std::string> QuicSpdySession::OnAlpsData(const uint8_t* alps_data,
size_t alps_length) { … }
void QuicSpdySession::OnAcceptChFrameReceivedViaAlps(
const AcceptChFrame& frame) { … }
bool QuicSpdySession::OnSettingsFrame(const SettingsFrame& frame) { … }
bool QuicSpdySession::ValidateWebTransportSettingsConsistency() { … }
std::optional<std::string> QuicSpdySession::OnSettingsFrameViaAlps(
const SettingsFrame& frame) { … }
bool QuicSpdySession::VerifySettingIsZeroOrOne(uint64_t id, uint64_t value) { … }
bool QuicSpdySession::OnSetting(uint64_t id, uint64_t value) { … }
bool QuicSpdySession::ShouldReleaseHeadersStreamSequencerBuffer() { … }
void QuicSpdySession::OnHeaders(SpdyStreamId stream_id, bool has_priority,
const spdy::SpdyStreamPrecedence& precedence,
bool fin) { … }
void QuicSpdySession::OnPriority(SpdyStreamId stream_id,
const spdy::SpdyStreamPrecedence& precedence) { … }
void QuicSpdySession::OnHeaderList(const QuicHeaderList& header_list) { … }
void QuicSpdySession::OnCompressedFrameSize(size_t frame_len) { … }
void QuicSpdySession::CloseConnectionWithDetails(QuicErrorCode error,
const std::string& details) { … }
bool QuicSpdySession::HasActiveRequestStreams() const { … }
QuicStream* QuicSpdySession::ProcessReadUnidirectionalPendingStream(
PendingStream* pending) { … }
void QuicSpdySession::MaybeInitializeHttp3UnidirectionalStreams() { … }
void QuicSpdySession::BeforeConnectionCloseSent() { … }
void QuicSpdySession::MaybeBundleOpportunistically() { … }
void QuicSpdySession::OnCanCreateNewOutgoingStream(bool unidirectional) { … }
bool QuicSpdySession::goaway_received() const { … }
bool QuicSpdySession::goaway_sent() const { … }
void QuicSpdySession::CloseConnectionOnDuplicateHttp3UnidirectionalStreams(
absl::string_view type) { … }
void QuicSpdySession::LogHeaderCompressionRatioHistogram(
bool using_qpack, bool is_sent, QuicByteCount compressed,
QuicByteCount uncompressed) { … }
MessageStatus QuicSpdySession::SendHttp3Datagram(QuicStreamId stream_id,
absl::string_view payload) { … }
void QuicSpdySession::SetMaxDatagramTimeInQueueForStreamId(
QuicStreamId , QuicTime::Delta max_time_in_queue) { … }
void QuicSpdySession::OnMessageReceived(absl::string_view message) { … }
bool QuicSpdySession::SupportsWebTransport() { … }
std::optional<WebTransportHttp3Version>
QuicSpdySession::SupportedWebTransportVersion() { … }
bool QuicSpdySession::SupportsH3Datagram() const { … }
WebTransportHttp3* QuicSpdySession::GetWebTransportSession(
WebTransportSessionId id) { … }
bool QuicSpdySession::ShouldProcessIncomingRequests() { … }
void QuicSpdySession::OnStreamWaitingForClientSettings(QuicStreamId id) { … }
void QuicSpdySession::AssociateIncomingWebTransportStreamWithSession(
WebTransportSessionId session_id, QuicStreamId stream_id) { … }
void QuicSpdySession::ProcessBufferedWebTransportStreamsForSession(
WebTransportHttp3* session) { … }
WebTransportHttp3UnidirectionalStream*
QuicSpdySession::CreateOutgoingUnidirectionalWebTransportStream(
WebTransportHttp3* session) { … }
QuicSpdyStream* QuicSpdySession::CreateOutgoingBidirectionalWebTransportStream(
WebTransportHttp3* session) { … }
void QuicSpdySession::OnDatagramProcessed(
std::optional<MessageStatus> ) { … }
void QuicSpdySession::DatagramObserver::OnDatagramProcessed(
std::optional<MessageStatus> status) { … }
HttpDatagramSupport QuicSpdySession::LocalHttpDatagramSupport() { … }
std::string HttpDatagramSupportToString(
HttpDatagramSupport http_datagram_support) { … }
std::ostream& operator<<(std::ostream& os,
const HttpDatagramSupport& http_datagram_support) { … }
void QuicSpdySession::set_allow_extended_connect(bool allow_extended_connect) { … }
void QuicSpdySession::OnConfigNegotiated() { … }
#undef ENDPOINT
}