#include "quiche/quic/core/http/quic_spdy_stream.h"
#include <limits>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include "absl/base/macros.h"
#include "absl/strings/numbers.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "quiche/http2/adapter/header_validator.h"
#include "quiche/http2/http2_constants.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_spdy_session.h"
#include "quiche/quic/core/http/spdy_utils.h"
#include "quiche/quic/core/http/web_transport_http3.h"
#include "quiche/quic/core/qpack/qpack_decoder.h"
#include "quiche/quic/core/qpack/qpack_encoder.h"
#include "quiche/quic/core/quic_error_codes.h"
#include "quiche/quic/core/quic_stream_priority.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/core/quic_write_blocked_list.h"
#include "quiche/quic/core/web_transport_interface.h"
#include "quiche/quic/platform/api/quic_bug_tracker.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_testvalue.h"
#include "quiche/common/capsule.h"
#include "quiche/common/platform/api/quiche_flag_utils.h"
#include "quiche/common/platform/api/quiche_logging.h"
#include "quiche/common/quiche_mem_slice_storage.h"
#include "quiche/common/quiche_text_utils.h"
#include "quiche/spdy/core/spdy_protocol.h"
Capsule;
CapsuleType;
HttpHeaderBlock;
namespace quic {
class QuicSpdyStream::HttpDecoderVisitor : public HttpDecoder::Visitor { … };
#define ENDPOINT …
QuicSpdyStream::QuicSpdyStream(QuicStreamId id, QuicSpdySession* spdy_session,
StreamType type)
: … { … }
QuicSpdyStream::QuicSpdyStream(PendingStream* pending,
QuicSpdySession* spdy_session)
: … { … }
QuicSpdyStream::~QuicSpdyStream() { … }
size_t QuicSpdyStream::WriteHeaders(
HttpHeaderBlock header_block, bool fin,
quiche::QuicheReferenceCountedPointer<QuicAckListenerInterface>
ack_listener) { … }
void QuicSpdyStream::WriteOrBufferBody(absl::string_view data, bool fin) { … }
size_t QuicSpdyStream::WriteTrailers(
HttpHeaderBlock trailer_block,
quiche::QuicheReferenceCountedPointer<QuicAckListenerInterface>
ack_listener) { … }
QuicConsumedData QuicSpdyStream::WritevBody(const struct iovec* iov, int count,
bool fin) { … }
bool QuicSpdyStream::WriteDataFrameHeader(QuicByteCount data_length,
bool force_write) { … }
QuicConsumedData QuicSpdyStream::WriteBodySlices(
absl::Span<quiche::QuicheMemSlice> slices, bool fin) { … }
size_t QuicSpdyStream::Readv(const struct iovec* iov, size_t iov_len) { … }
int QuicSpdyStream::GetReadableRegions(iovec* iov, size_t iov_len) const { … }
void QuicSpdyStream::MarkConsumed(size_t num_bytes) { … }
bool QuicSpdyStream::IsDoneReading() const { … }
bool QuicSpdyStream::HasBytesToRead() const { … }
QuicByteCount QuicSpdyStream::ReadableBytes() const { … }
void QuicSpdyStream::MarkTrailersConsumed() { … }
uint64_t QuicSpdyStream::total_body_bytes_read() const { … }
void QuicSpdyStream::ConsumeHeaderList() { … }
void QuicSpdyStream::OnStreamHeadersPriority(
const spdy::SpdyStreamPrecedence& precedence) { … }
void QuicSpdyStream::OnStreamHeaderList(bool fin, size_t frame_len,
const QuicHeaderList& header_list) { … }
void QuicSpdyStream::OnHeadersDecoded(QuicHeaderList headers,
bool header_list_size_limit_exceeded) { … }
void QuicSpdyStream::OnHeaderDecodingError(QuicErrorCode error_code,
absl::string_view error_message) { … }
void QuicSpdyStream::MaybeSendPriorityUpdateFrame() { … }
void QuicSpdyStream::OnHeadersTooLarge() { … }
void QuicSpdyStream::OnInitialHeadersComplete(
bool fin, size_t , const QuicHeaderList& header_list) { … }
bool QuicSpdyStream::CopyAndValidateTrailers(
const QuicHeaderList& header_list, bool expect_final_byte_offset,
size_t* final_byte_offset, quiche::HttpHeaderBlock* trailers) { … }
void QuicSpdyStream::OnTrailingHeadersComplete(
bool fin, size_t , const QuicHeaderList& header_list) { … }
void QuicSpdyStream::RegisterMetadataVisitor(MetadataVisitor* visitor) { … }
void QuicSpdyStream::UnregisterMetadataVisitor() { … }
void QuicSpdyStream::OnPriorityFrame(
const spdy::SpdyStreamPrecedence& precedence) { … }
void QuicSpdyStream::OnStreamReset(const QuicRstStreamFrame& frame) { … }
void QuicSpdyStream::ResetWithError(QuicResetStreamError error) { … }
bool QuicSpdyStream::OnStopSending(QuicResetStreamError error) { … }
void QuicSpdyStream::OnWriteSideInDataRecvdState() { … }
void QuicSpdyStream::OnDataAvailable() { … }
void QuicSpdyStream::OnClose() { … }
void QuicSpdyStream::OnCanWrite() { … }
bool QuicSpdyStream::FinishedReadingHeaders() const { … }
bool QuicSpdyStream::ParseHeaderStatusCode(const HttpHeaderBlock& header,
int* status_code) { … }
bool QuicSpdyStream::ParseHeaderStatusCode(absl::string_view status,
int* status_code) { … }
bool QuicSpdyStream::FinishedReadingTrailers() const { … }
bool QuicSpdyStream::OnDataFrameStart(QuicByteCount header_length,
QuicByteCount payload_length) { … }
bool QuicSpdyStream::OnDataFramePayload(absl::string_view payload) { … }
bool QuicSpdyStream::OnDataFrameEnd() { … }
bool QuicSpdyStream::OnStreamFrameAcked(QuicStreamOffset offset,
QuicByteCount data_length,
bool fin_acked,
QuicTime::Delta ack_delay_time,
QuicTime receive_timestamp,
QuicByteCount* newly_acked_length) { … }
void QuicSpdyStream::OnStreamFrameRetransmitted(QuicStreamOffset offset,
QuicByteCount data_length,
bool fin_retransmitted) { … }
QuicByteCount QuicSpdyStream::GetNumFrameHeadersInInterval(
QuicStreamOffset offset, QuicByteCount data_length) const { … }
bool QuicSpdyStream::OnHeadersFrameStart(QuicByteCount header_length,
QuicByteCount payload_length) { … }
bool QuicSpdyStream::OnHeadersFramePayload(absl::string_view payload) { … }
bool QuicSpdyStream::OnHeadersFrameEnd() { … }
void QuicSpdyStream::OnWebTransportStreamFrameType(
QuicByteCount header_length, WebTransportSessionId session_id) { … }
bool QuicSpdyStream::OnMetadataFrameStart(QuicByteCount header_length,
QuicByteCount payload_length) { … }
bool QuicSpdyStream::OnMetadataFramePayload(absl::string_view payload) { … }
bool QuicSpdyStream::OnMetadataFrameEnd() { … }
bool QuicSpdyStream::OnUnknownFrameStart(uint64_t frame_type,
QuicByteCount header_length,
QuicByteCount payload_length) { … }
bool QuicSpdyStream::OnUnknownFramePayload(absl::string_view payload) { … }
bool QuicSpdyStream::OnUnknownFrameEnd() { … }
size_t QuicSpdyStream::WriteHeadersImpl(
quiche::HttpHeaderBlock header_block, bool fin,
quiche::QuicheReferenceCountedPointer<QuicAckListenerInterface>
ack_listener) { … }
bool QuicSpdyStream::CanWriteNewBodyData(QuicByteCount write_size) const { … }
void QuicSpdyStream::MaybeProcessReceivedWebTransportHeaders() { … }
void QuicSpdyStream::MaybeProcessSentWebTransportHeaders(
quiche::HttpHeaderBlock& headers) { … }
void QuicSpdyStream::OnCanWriteNewData() { … }
bool QuicSpdyStream::AssertNotWebTransportDataStream(
absl::string_view operation) { … }
void QuicSpdyStream::ConvertToWebTransportDataStream(
WebTransportSessionId session_id) { … }
QuicSpdyStream::WebTransportDataStream::WebTransportDataStream(
QuicSpdyStream* stream, WebTransportSessionId session_id)
: … { … }
void QuicSpdyStream::HandleReceivedDatagram(absl::string_view payload) { … }
bool QuicSpdyStream::OnCapsule(const Capsule& capsule) { … }
void QuicSpdyStream::OnCapsuleParseFailure(absl::string_view error_message) { … }
void QuicSpdyStream::WriteCapsule(const Capsule& capsule, bool fin) { … }
void QuicSpdyStream::WriteGreaseCapsule() { … }
MessageStatus QuicSpdyStream::SendHttp3Datagram(absl::string_view payload) { … }
void QuicSpdyStream::RegisterHttp3DatagramVisitor(
Http3DatagramVisitor* visitor) { … }
void QuicSpdyStream::UnregisterHttp3DatagramVisitor() { … }
void QuicSpdyStream::ReplaceHttp3DatagramVisitor(
Http3DatagramVisitor* visitor) { … }
void QuicSpdyStream::RegisterConnectIpVisitor(ConnectIpVisitor* visitor) { … }
void QuicSpdyStream::UnregisterConnectIpVisitor() { … }
void QuicSpdyStream::ReplaceConnectIpVisitor(ConnectIpVisitor* visitor) { … }
void QuicSpdyStream::SetMaxDatagramTimeInQueue(
QuicTime::Delta max_time_in_queue) { … }
void QuicSpdyStream::OnDatagramReceived(QuicDataReader* reader) { … }
QuicByteCount QuicSpdyStream::GetMaxDatagramSize() const { … }
void QuicSpdyStream::HandleBodyAvailable() { … }
namespace {
bool IsValidHeaderName(absl::string_view name) { … }
}
bool QuicSpdyStream::ValidateReceivedHeaders(
const QuicHeaderList& header_list) { … }
void QuicSpdyStream::set_invalid_request_details(
std::string invalid_request_details) { … }
bool QuicSpdyStream::AreHeaderFieldValuesValid(
const QuicHeaderList& header_list) const { … }
void QuicSpdyStream::StopReading() { … }
void QuicSpdyStream::OnInvalidHeaders() { … }
void QuicSpdyStream::CloseReadSide() { … }
#undef ENDPOINT
}