proxygen
|
#include <HTTP2Codec.h>
Static Public Member Functions | |
static void | requestUpgrade (HTTPMessage &request) |
Private Types | |
enum | FrameState { UPSTREAM_CONNECTION_PREFACE = 0, DOWNSTREAM_CONNECTION_PREFACE = 1, FRAME_HEADER = 2, FRAME_DATA = 3, DATA_FRAME_DATA = 4 } |
Private Attributes | |
HPACKCodec | headerCodec_ |
http2::FrameHeader | curHeader_ |
StreamID | expectedContinuationStream_ {0} |
bool | pendingEndStreamHandling_ {false} |
bool | ingressWebsocketUpgrade_ {false} |
std::unordered_set< StreamID > | upgradedStreams_ |
uint16_t | curCertId_ {0} |
folly::IOBufQueue | curAuthenticatorBlock_ |
folly::IOBufQueue | curHeaderBlock_ {folly::IOBufQueue::cacheChainLength()} |
HTTPSettings | ingressSettings_ |
HTTPSettings | egressSettings_ |
uint64_t | receivedFrameCount_ {0} |
FrameState | frameState_:3 |
std::string | userAgent_ |
size_t | pendingDataFrameBytes_ {0} |
size_t | pendingDataFramePaddingBytes_ {0} |
HeaderDecodeInfo | decodeInfo_ |
std::vector< StreamID > | virtualPriorityNodes_ |
bool | reuseIOBufHeadroomForData_ {true} |
bool | parsingDownstreamTrailers_ {false} |
http2::FrameType | headerBlockFrameType_ {http2::FrameType::DATA} |
Private Attributes inherited from proxygen::HPACK::StreamingCallback | |
HeaderCodec::Stats * | stats {nullptr} |
An implementation of the framing layer for HTTP/2. Instances of this class must not be used from multiple threads concurrently.
Definition at line 29 of file HTTP2Codec.h.
|
private |
Enumerator | |
---|---|
UPSTREAM_CONNECTION_PREFACE | |
DOWNSTREAM_CONNECTION_PREFACE | |
FRAME_HEADER | |
FRAME_DATA | |
DATA_FRAME_DATA |
Definition at line 269 of file HTTP2Codec.h.
|
explicit |
Definition at line 42 of file HTTP2Codec.cpp.
References egressSettings_, proxygen::HTTPSettings::getSetting(), proxygen::getTransportDirectionString(), proxygen::HEADER_TABLE_SIZE, headerCodec_, proxygen::MAX_HEADER_LIST_SIZE, proxygen::HPACKCodec::setDecoderHeaderTableMaxSize(), and proxygen::HPACKCodec::setMaxUncompressed().
|
override |
Definition at line 66 of file HTTP2Codec.cpp.
|
overridevirtual |
Create virtual nodes in HTTP/2 priority tree. Some protocols (SPDY) have a linear priority structure which must be simulated in the HTTP/2 tree structure with "virtual" nodes representing different priority bands. There are other cases we simply want a "plain" linear priority structure even with HTTP/2. In that case a Priority frame will also be sent out for each virtual node created so that peer will have the same linear structure.
queue | the priority queue to add nodes |
writeBuf | IOBufQueue to append priority frames to send. For SPDY, the writeBuf will be ignored. |
maxLavel | the max level of virtual priority nodes to create. For SPDY, this value will be ignored. |
Reimplemented from proxygen::HTTPCodec.
Definition at line 670 of file HTTP2Codec.cpp.
References proxygen::HTTPCodec::PriorityQueue::addPriorityNode(), proxygen::HTTPParallelCodec::createStream(), generatePriority(), std::tr1::make_tuple(), parent, and virtualPriorityNodes_.
Referenced by isRequest().
|
private |
Definition at line 1598 of file HTTP2Codec.cpp.
References proxygen::HTTPParallelCodec::callback_, proxygen::ERROR, proxygen::getErrorCodeString(), proxygen::HTTPParallelCodec::goawayErrorMessage_, proxygen::HTTPException::INGRESS_AND_EGRESS, proxygen::NO_ERROR, proxygen::HTTPCodec::Callback::onError(), proxygen::IOBufPrinter::printHexFolly(), proxygen::HTTPException::setCodecStatusCode(), and string.
Referenced by getHeaderIndexingStrategy(), and onIngress().
Definition at line 973 of file HTTP2Codec.cpp.
References proxygen::HTTPParallelCodec::goawayErrorMessage_, proxygen::HTTPParallelCodec::isInitiatedStream(), proxygen::HTTPParallelCodec::lastStreamID_, proxygen::NO_ERROR, parsingDownstreamTrailers_, proxygen::PROTOCOL_ERROR, and proxygen::HTTPParallelCodec::sessionClosing_.
Referenced by getHeaderIndexingStrategy(), parseExHeaders(), parseHeaders(), and parsePushPromise().
|
private |
Definition at line 1217 of file HTTP2Codec.cpp.
References proxygen::HPACKCodec::encode(), proxygen::ERROR, proxygen::HTTPHeaders::forEach(), proxygen::HeaderCodec::getEncodedSize(), proxygen::HTTPSettings::getSetting(), headerCodec_, ingressSettings_, proxygen::http2::kFrameHeadersBaseMaxSize, proxygen::http2::kFrameHeaderSize, max, proxygen::MAX_HEADER_LIST_SIZE, name, proxygen::HeaderCodec::setEncodeHeadroom(), proxygen::HTTPHeaders::size(), wangle::HTTPHeaderSize::uncompressed, and value.
Referenced by generateHeaderImpl(), generateTrailers(), and getHeaderIndexingStrategy().
|
overridevirtual |
Write part of an egress message body.
This will automatically generate a chunk header and footer around the data if necessary (e.g. you haven't manually sent a chunk header and the message should be chunked).
padding | Optionally add padding bytes to the body if possible |
eom | implicitly generate the EOM marker with this body frame |
Implements proxygen::HTTPCodec.
Definition at line 1257 of file HTTP2Codec.cpp.
References folly::IOBufQueue::append(), folly::IOBufQueue::chainLength(), proxygen::http2::DATA, generateHeaderCallbackWrapper(), proxygen::HTTPParallelCodec::ingressGoawayAck_, proxygen::HTTPParallelCodec::isStreamIngressEgressAllowed(), maxSendFrameSize(), folly::IOBufQueue::move(), folly::gen::move, reuseIOBufHeadroomForData_, folly::IOBufQueue::split(), stream, and proxygen::http2::writeData().
Referenced by getUserAgent().
|
overridevirtual |
Reimplemented from proxygen::HTTPCodec.
Definition at line 1579 of file HTTP2Codec.cpp.
References folly::IOBufQueue::append(), folly::IOBufQueue::chainLength(), maxSendFrameSize(), folly::IOBufQueue::move(), folly::gen::move, folly::IOBufQueue::splitAtMost(), and proxygen::http2::writeCertificate().
Referenced by getUserAgent().
|
overridevirtual |
Reimplemented from proxygen::HTTPCodec.
Definition at line 1570 of file HTTP2Codec.cpp.
References folly::gen::move, and proxygen::http2::writeCertificateRequest().
Referenced by getUserAgent().
|
overridevirtual |
Write a body chunk header, if relevant.
Implements proxygen::HTTPCodec.
Definition at line 1296 of file HTTP2Codec.cpp.
Referenced by getUserAgent().
|
overridevirtual |
Write a body chunk terminator, if relevant.
Implements proxygen::HTTPCodec.
Definition at line 1303 of file HTTP2Codec.cpp.
Referenced by getUserAgent().
|
overridevirtual |
Generate a connection preface, if there is any for this protocol.
Reimplemented from proxygen::HTTPCodec.
Definition at line 1001 of file HTTP2Codec.cpp.
References folly::IOBufQueue::append(), proxygen::http2::kConnectionPreface, proxygen::HTTPParallelCodec::transportDirection_, and proxygen::UPSTREAM.
Referenced by getUserAgent().
void proxygen::HTTP2Codec::generateContinuation | ( | folly::IOBufQueue & | writeBuf, |
folly::IOBufQueue & | queue, | ||
StreamID | stream, | ||
size_t | maxFrameSize | ||
) |
Definition at line 1200 of file HTTP2Codec.cpp.
References folly::IOBufQueue::chainLength(), proxygen::http2::CONTINUATION, generateHeaderCallbackWrapper(), min, folly::gen::move, folly::IOBufQueue::split(), stream, and proxygen::http2::writeContinuation().
Referenced by generateHeaderImpl(), generateTrailers(), and getUserAgent().
|
overridevirtual |
Generate any protocol framing needed to finalize an egress message. This method must be called to complete a stream.
Implements proxygen::HTTPCodec.
Definition at line 1344 of file HTTP2Codec.cpp.
References proxygen::http2::DATA, generateHeaderCallbackWrapper(), proxygen::HTTPParallelCodec::ingressGoawayAck_, proxygen::HTTPParallelCodec::isStreamIngressEgressAllowed(), proxygen::http2::kNoPadding, reuseIOBufHeadroomForData_, stream, upgradedStreams_, and proxygen::http2::writeData().
Referenced by getUserAgent().
|
overridevirtual |
Reimplemented from proxygen::HTTPCodec.
Definition at line 1084 of file HTTP2Codec.cpp.
References generateHeaderImpl(), and folly::none.
Referenced by getUserAgent().
|
overridevirtual |
Generate any protocol framing needed to abort a connection.
Implements proxygen::HTTPCodec.
Definition at line 1391 of file HTTP2Codec.cpp.
References proxygen::HTTPParallelCodec::egressGoawayAck_, proxygen::http2::errorCodeToGoaway(), folly::FATAL, generateHeaderCallbackWrapper(), proxygen::getErrorCodeString(), proxygen::http2::GOAWAY, max, folly::gen::move, proxygen::NO_ERROR, proxygen::PROTOCOL_ERROR, proxygen::HTTPParallelCodec::sessionClosing_, userAgent_, and proxygen::http2::writeGoaway().
Referenced by getUserAgent().
|
overridevirtual |
Write an egress message header. For pushed streams, you must specify the assocStream.
size | the size of the generated message, both the actual size and the size of the uncompressed data. |
Implements proxygen::HTTPCodec.
Definition at line 1055 of file HTTP2Codec.cpp.
References generateHeaderImpl(), and folly::none.
Referenced by getUserAgent().
|
private |
Definition at line 1246 of file HTTP2Codec.cpp.
References proxygen::HTTPParallelCodec::callback_, and proxygen::HTTPCodec::Callback::onGenerateFrameHeader().
Referenced by generateBody(), generateContinuation(), generateEOM(), generateGoaway(), generateHeaderImpl(), generatePingReply(), generatePingRequest(), generatePriority(), generateRstStream(), generateSettings(), generateSettingsAck(), generateTrailers(), generateWindowUpdate(), and getHeaderIndexingStrategy().
|
private |
Definition at line 1099 of file HTTP2Codec.cpp.
References wangle::HTTPHeaderSize::compressed, proxygen::DOWNSTREAM, encodeHeaders(), proxygen::http2::EX_HEADERS, generateContinuation(), generateHeaderCallbackWrapper(), proxygen::HTTPMessage::getHeaders(), proxygen::HTTPMessage::getHTTP2Priority(), proxygen::http2::HEADERS, proxygen::HTTPParallelCodec::ingressGoawayAck_, proxygen::HTTPMessage::isEgressWebsocketUpgrade(), proxygen::HTTPMessage::isRequest(), proxygen::HTTPParallelCodec::isStreamIngressEgressAllowed(), proxygen::http2::kFramePrioritySize, proxygen::http2::kNoPadding, maxSendFrameSize(), min, folly::gen::move, proxygen::CodecUtil::prepareMessageForCompression(), proxygen::http2::PUSH_PROMISE, folly::size(), stream, proxygen::HTTPParallelCodec::transportDirection_, wangle::HTTPHeaderSize::uncompressed, upgradedStreams_, proxygen::UPSTREAM, proxygen::http2::writeExHeaders(), proxygen::http2::writeHeaders(), and proxygen::http2::writePushPromise().
Referenced by generateExHeader(), generateHeader(), generatePushPromise(), and getHeaderIndexingStrategy().
|
overridevirtual |
Generate a reply to a ping message, if supported in the protocol implemented by the codec.
Reimplemented from proxygen::HTTPCodec.
Definition at line 1448 of file HTTP2Codec.cpp.
References generateHeaderCallbackWrapper(), proxygen::http2::PING, and proxygen::http2::writePing().
Referenced by getUserAgent().
|
overridevirtual |
If the protocol supports it, generate a ping message that the other side should respond to.
Reimplemented from proxygen::HTTPCodec.
Definition at line 1439 of file HTTP2Codec.cpp.
References generateHeaderCallbackWrapper(), proxygen::http2::PING, folly::Random::rand64(), uint64_t, and proxygen::http2::writePing().
Referenced by getUserAgent().
|
overridevirtual |
Reimplemented from proxygen::HTTPCodec.
Definition at line 1552 of file HTTP2Codec.cpp.
References generateHeaderCallbackWrapper(), proxygen::HTTPParallelCodec::ingressGoawayAck_, proxygen::HTTPParallelCodec::isStreamIngressEgressAllowed(), proxygen::http2::PRIORITY, stream, and proxygen::http2::writePriority().
Referenced by addPriorityNodes(), and getUserAgent().
|
overridevirtual |
Reimplemented from proxygen::HTTPCodec.
Definition at line 1069 of file HTTP2Codec.cpp.
References generateHeaderImpl(), and folly::none.
Referenced by getUserAgent().
|
overridevirtual |
Generate any protocol framing needed to abort a stream.
Implements proxygen::HTTPCodec.
Definition at line 1364 of file HTTP2Codec.cpp.
References curHeader_, proxygen::http2::END_STREAM, proxygen::http2::errorCodeToReset(), proxygen::http2::FrameHeader::flags, generateHeaderCallbackWrapper(), proxygen::getErrorCodeString(), proxygen::HTTPParallelCodec::ingressGoawayAck_, ingressWebsocketUpgrade_, proxygen::HTTPParallelCodec::isStreamIngressEgressAllowed(), pendingEndStreamHandling_, proxygen::PROTOCOL_ERROR, proxygen::http2::RST_STREAM, proxygen::http2::FrameHeader::stream, upgradedStreams_, userAgent_, and proxygen::http2::writeRstStream().
Referenced by getUserAgent().
|
overridevirtual |
Generate a settings message, if supported in the protocol implemented by the codec.
Reimplemented from proxygen::HTTPCodec.
Definition at line 1455 of file HTTP2Codec.cpp.
References proxygen::DOWNSTREAM, egressSettings_, proxygen::ENABLE_CONNECT_PROTOCOL, proxygen::ENABLE_EX_HEADERS, proxygen::ENABLE_PUSH, proxygen::ERROR, generateHeaderCallbackWrapper(), proxygen::HTTPSettings::getAllSettings(), proxygen::HTTPParallelCodec::getTransportDirection(), proxygen::getTransportDirectionString(), proxygen::HEADER_TABLE_SIZE, headerCodec_, proxygen::INITIAL_WINDOW_SIZE, proxygen::MAX_CONCURRENT_STREAMS, proxygen::MAX_FRAME_SIZE, proxygen::MAX_HEADER_LIST_SIZE, proxygen::HPACKCodec::setDecoderHeaderTableMaxSize(), proxygen::HPACKCodec::setMaxUncompressed(), proxygen::http2::SETTINGS, settings, proxygen::THRIFT_CHANNEL_ID, proxygen::THRIFT_CHANNEL_ID_DEPRECATED, proxygen::HTTPParallelCodec::transportDirection_, type, and proxygen::http2::writeSettings().
Referenced by getUserAgent(), and requestUpgrade().
|
overridevirtual |
Generate a settings ack message, if supported in the protocol implemented by the codec.
Reimplemented from proxygen::HTTPCodec.
Definition at line 1531 of file HTTP2Codec.cpp.
References generateHeaderCallbackWrapper(), proxygen::HTTPParallelCodec::getTransportDirection(), proxygen::getTransportDirectionString(), proxygen::http2::SETTINGS, and proxygen::http2::writeSettingsAck().
Referenced by getUserAgent().
|
overridevirtual |
Write the message trailers
Implements proxygen::HTTPCodec.
Definition at line 1309 of file HTTP2Codec.cpp.
References folly::IOBufQueue::append(), proxygen::CodecUtil::appendHeaders(), folly::IOBufQueue::chainLength(), wangle::HTTPHeaderSize::compressed, encodeHeaders(), generateContinuation(), generateHeaderCallbackWrapper(), proxygen::http2::HEADERS, proxygen::HTTP_HEADER_NONE, proxygen::http2::kNoPadding, maxSendFrameSize(), min, folly::gen::move, folly::size(), folly::IOBufQueue::split(), and proxygen::http2::writeHeaders().
Referenced by getUserAgent().
|
overridevirtual |
Reimplemented from proxygen::HTTPCodec.
Definition at line 1538 of file HTTP2Codec.cpp.
References generateHeaderCallbackWrapper(), proxygen::HTTPParallelCodec::ingressGoawayAck_, proxygen::HTTPParallelCodec::isStreamIngressEgressAllowed(), proxygen::http2::WINDOW_UPDATE, and proxygen::http2::writeWindowUpdate().
Referenced by getUserAgent().
|
inlineoverridevirtual |
Get the default size of flow control windows for this protocol
Reimplemented from proxygen::HTTPCodec.
Definition at line 117 of file HTTP2Codec.h.
References proxygen::http2::kInitialWindow.
Referenced by TEST_F().
|
inlineoverridevirtual |
Reimplemented from proxygen::HTTPCodec.
Definition at line 116 of file HTTP2Codec.h.
References egressSettings_.
|
inline |
Definition at line 174 of file HTTP2Codec.h.
References checkConnectionError(), checkNewStream(), encodeHeaders(), generateHeaderCallbackWrapper(), generateHeaderImpl(), proxygen::HPACKCodec::getHeaderIndexingStrategy(), handleEndStream(), handleSettings(), headerCodec_, parseAllData(), parseCertificate(), parseCertificateRequest(), parseContinuation(), parseDataFrameData(), parseExHeaders(), parseFrame(), parseGoaway(), parseHeaders(), parseHeadersCheckConcurrentStreams(), parseHeadersDecodeFrames(), parseHeadersImpl(), parsePing(), parsePriority(), parsePushPromise(), parseRstStream(), parseSettings(), parseWindowUpdate(), settings, folly::size(), type, and uint32_t.
Referenced by HTTPDownstreamTest< SPDY3_1CodecPair >::HTTPDownstreamTest(), TEST_F(), HTTPDownstreamTest< C >::testSimpleUpgrade(), and HTTPUpstreamTest< C >::testSimpleUpgrade().
|
inlineoverridevirtual |
Gets both the egress and ingress header table size, bytes stored in header table, and the number of headers stored in the header table
Reimplemented from proxygen::HTTPCodec.
Definition at line 151 of file HTTP2Codec.h.
References proxygen::HPACKCodec::getHPACKTableInfo(), headerCodec_, and requestUpgrade().
|
inlineoverridevirtual |
Reimplemented from proxygen::HTTPCodec.
Definition at line 113 of file HTTP2Codec.h.
References ingressSettings_.
|
inlineoverridevirtual |
Gets the session protocol currently used by the codec. This can be mapped to a string for logging and diagnostic use.
Implements proxygen::HTTPCodec.
Definition at line 40 of file HTTP2Codec.h.
References proxygen::HTTP_2.
Referenced by TEST().
|
inline |
|
inlineoverridevirtual |
Gets the user agent string of the client. Thus, it is only meaningful for a DOWNSTREAM session. Note that the value is available after onHeadersComplete(). It can help in diagnosing the interactions between different codec implementation.
Implements proxygen::HTTPCodec.
Definition at line 44 of file HTTP2Codec.h.
References generateBody(), generateCertificate(), generateCertificateRequest(), generateChunkHeader(), generateChunkTerminator(), generateConnectionPreface(), generateContinuation(), generateEOM(), generateExHeader(), generateGoaway(), generateHeader(), generatePingReply(), generatePingRequest(), generatePriority(), generatePushPromise(), generateRstStream(), generateSettings(), generateSettingsAck(), generateTrailers(), generateWindowUpdate(), onIngress(), onIngressUpgradeMessage(), folly::size(), statusCode, uint16_t, uint32_t, uint64_t, userAgent_, and fizz::detail::writeBuf().
|
private |
Definition at line 252 of file HTTP2Codec.cpp.
References proxygen::http2::CONTINUATION, curHeader_, proxygen::http2::DATA, proxygen::HTTPParallelCodec::deliverCallbackIfAllowed(), proxygen::http2::END_STREAM, proxygen::http2::EX_HEADERS, expectedContinuationStream_, proxygen::http2::FrameHeader::flags, proxygen::http2::HEADERS, ingressWebsocketUpgrade_, proxygen::NO_ERROR, proxygen::HTTPCodec::Callback::onMessageComplete(), pendingEndStreamHandling_, proxygen::http2::FrameHeader::stream, and proxygen::http2::FrameHeader::type.
Referenced by getHeaderIndexingStrategy(), parseAllData(), parseDataFrameData(), and parseHeadersImpl().
|
private |
Definition at line 721 of file HTTP2Codec.cpp.
References proxygen::HTTPParallelCodec::callback_, curHeader_, egressSettings_, proxygen::ENABLE_CONNECT_PROTOCOL, proxygen::ENABLE_EX_HEADERS, proxygen::ENABLE_PUSH, proxygen::HTTPSettings::getSetting(), proxygen::HTTPParallelCodec::getTransportDirection(), proxygen::getTransportDirectionString(), proxygen::HTTPParallelCodec::goawayErrorMessage_, proxygen::HEADER_TABLE_SIZE, headerCodec_, ingressSettings_, proxygen::INITIAL_WINDOW_SIZE, proxygen::http2::kMaxFramePayloadLength, proxygen::http2::kMaxFramePayloadLengthMin, proxygen::http2::kMaxHeaderTableSize, proxygen::http2::kMaxWindowUpdateSize, proxygen::MAX_CONCURRENT_STREAMS, proxygen::MAX_FRAME_SIZE, proxygen::MAX_HEADER_LIST_SIZE, proxygen::NO_ERROR, proxygen::HTTPCodec::Callback::onSettings(), proxygen::PROTOCOL_ERROR, ptr, proxygen::HPACKCodec::setEncoderHeaderTableSize(), proxygen::HTTPSettings::setSetting(), proxygen::SETTINGS_HTTP_CERT_AUTH, proxygen::http2::FrameHeader::stream, proxygen::THRIFT_CHANNEL_ID, proxygen::THRIFT_CHANNEL_ID_DEPRECATED, proxygen::HTTPParallelCodec::transportDirection_, uint32_t, and proxygen::UPSTREAM.
Referenced by getHeaderIndexingStrategy(), onIngressUpgradeMessage(), and parseSettings().
|
inline |
Definition at line 138 of file HTTP2Codec.h.
References addPriorityNodes(), proxygen::DOWNSTREAM, mapPriorityToDependency(), proxygen::HTTPParallelCodec::transportDirection_, uint8_t, and proxygen::UPSTREAM.
Referenced by parseExHeaders(), and parseHeadersDecodeFrames().
|
overridevirtual |
Map the given linear priority to the correct parent node dependency
Reimplemented from proxygen::HTTPCodec.
Definition at line 1627 of file HTTP2Codec.cpp.
References min, uint8_t, and virtualPriorityNodes_.
Referenced by isRequest().
|
inlineprivate |
Definition at line 233 of file HTTP2Codec.h.
References egressSettings_, folly::pushmi::operators::error(), proxygen::HTTPSettings::getSetting(), proxygen::http2::kMaxFramePayloadLengthMin, proxygen::MAX_FRAME_SIZE, parsingTrailers(), streamError(), string, and uint32_t.
Referenced by onIngress().
|
inlineprivate |
Definition at line 229 of file HTTP2Codec.h.
References proxygen::HTTPSettings::getSetting(), ingressSettings_, proxygen::http2::kMaxFramePayloadLengthMin, proxygen::MAX_FRAME_SIZE, and uint32_t.
Referenced by generateBody(), generateCertificate(), generateHeaderImpl(), and generateTrailers().
|
overridevirtual |
Implements proxygen::HPACK::StreamingCallback.
Definition at line 646 of file HTTP2Codec.cpp.
References proxygen::HeaderDecodeInfo::decodeError, and decodeInfo_.
|
overridevirtual |
Implements proxygen::HPACK::StreamingCallback.
Definition at line 606 of file HTTP2Codec.cpp.
References decodeInfo_, headerCodec_, proxygen::HeaderDecodeInfo::onHeader(), proxygen::HeaderDecodeInfo::parsingError, folly::basic_fbstring< E, T, A, Storage >::toStdString(), proxygen::HTTPParallelCodec::transportDirection_, uint32_t, and userAgent_.
|
overridevirtual |
Implements proxygen::HPACK::StreamingCallback.
Definition at line 618 of file HTTP2Codec.cpp.
References proxygen::CONNECT, curHeader_, decodeInfo_, proxygen::DOWNSTREAM, proxygen::HTTPMessage::getMethod(), proxygen::HTTPMessage::getStatusCode(), proxygen::HTTPMessage::getUpgradeProtocol(), proxygen::HTTPRequestVerifier::hasUpgradeProtocol(), ingressWebsocketUpgrade_, proxygen::http2::kProtocolString, proxygen::headers::kWebsocketString, proxygen::HeaderDecodeInfo::msg, proxygen::HeaderDecodeInfo::onHeadersComplete(), proxygen::HeaderDecodeInfo::parsingError, proxygen::HTTPMessage::setIngressWebsocketUpgrade(), proxygen::http2::FrameHeader::stream, proxygen::HTTPParallelCodec::transportDirection_, upgradedStreams_, and proxygen::HeaderDecodeInfo::verifier.
|
overridevirtual |
Parse ingress data.
buf | A single IOBuf of data to parse |
Implements proxygen::HTTPCodec.
Definition at line 70 of file HTTP2Codec.cpp.
References proxygen::HTTPParallelCodec::callback_, checkConnectionError(), curHeader_, proxygen::http2::DATA, proxygen::http2::FrameHeader::flags, FOLLY_SCOPED_TRACE_SECTION, proxygen::FRAME_SIZE_ERROR, frameState_, proxygen::http2::getFrameTypeString(), proxygen::HTTPParallelCodec::goawayErrorMessage_, proxygen::http2::kConnectionPreface, proxygen::http2::kFrameHeaderSize, proxygen::http2::FrameHeader::length, maxRecvFrameSize(), proxygen::NO_ERROR, proxygen::HTTPCodec::Callback::onFrameHeader(), parseDataFrameData(), parseFrame(), proxygen::http2::parseFrameHeader(), pendingDataFrameBytes_, pendingDataFramePaddingBytes_, proxygen::PROTOCOL_ERROR, folly::io::detail::CursorBase< Derived, BufType >::readFixedString(), receivedFrameCount_, proxygen::http2::SETTINGS, proxygen::http2::FrameHeader::stream, folly::io::detail::CursorBase< Derived, BufType >::totalLength(), and proxygen::http2::FrameHeader::type.
Referenced by getUserAgent().
|
overridevirtual |
Invoked on a codec that has been upgraded to via an HTTPMessage on a different codec. The codec may return false to halt the upgrade.
Reimplemented from proxygen::HTTPCodec.
Definition at line 1010 of file HTTP2Codec.cpp.
References folly::IOBufQueue::append(), c, proxygen::HTTPMessage::getHeaders(), proxygen::HTTPHeaders::getNumberOfValues(), proxygen::HTTPHeaders::getSingleOrEmpty(), handleSettings(), proxygen::http2::kMaxFramePayloadLength, proxygen::http2::kProtocolSettingsHeader, folly::gen::move, proxygen::NO_ERROR, proxygen::HTTPParallelCodec::onIngressUpgradeMessage(), proxygen::http2::parseSettings(), proxygen::http2::SETTINGS, settings, and uint32_t.
Referenced by getUserAgent().
|
private |
Definition at line 281 of file HTTP2Codec.cpp.
References proxygen::HTTPParallelCodec::callback_, curHeader_, proxygen::HTTPParallelCodec::deliverCallbackIfAllowed(), folly::IOBuf::empty(), handleEndStream(), proxygen::http2::FrameHeader::length, folly::gen::move, proxygen::HTTPCodec::Callback::onBody(), proxygen::http2::parseData(), RETURN_IF_ERROR, proxygen::http2::FrameHeader::stream, and uint16_t.
Referenced by getHeaderIndexingStrategy(), and parseFrame().
|
private |
Definition at line 945 of file HTTP2Codec.cpp.
References folly::IOBufQueue::append(), proxygen::HTTPParallelCodec::callback_, folly::IOBufQueue::chainLength(), folly::IOBufQueue::clear(), curAuthenticatorBlock_, curCertId_, curHeader_, folly::IOBufQueue::empty(), proxygen::http2::FrameHeader::flags, proxygen::http2::kMaxAuthenticatorBufSize, proxygen::http2::FrameHeader::length, folly::IOBufQueue::move(), folly::gen::move, proxygen::NO_ERROR, proxygen::HTTPCodec::Callback::onCertificate(), proxygen::http2::parseCertificate(), proxygen::PROTOCOL_ERROR, RETURN_IF_ERROR, proxygen::http2::TO_BE_CONTINUED, and uint16_t.
Referenced by getHeaderIndexingStrategy(), and parseFrame().
|
private |
Definition at line 931 of file HTTP2Codec.cpp.
References proxygen::HTTPParallelCodec::callback_, curHeader_, proxygen::http2::FrameHeader::length, folly::gen::move, proxygen::NO_ERROR, proxygen::HTTPCodec::Callback::onCertificateRequest(), proxygen::http2::parseCertificateRequest(), RETURN_IF_ERROR, and uint16_t.
Referenced by getHeaderIndexingStrategy(), and parseFrame().
|
private |
Definition at line 413 of file HTTP2Codec.cpp.
References curHeader_, proxygen::http2::FrameHeader::length, folly::gen::move, folly::none, proxygen::http2::parseContinuation(), parseHeadersImpl(), RETURN_IF_ERROR, and proxygen::http2::FrameHeader::stream.
Referenced by getHeaderIndexingStrategy(), and parseFrame().
|
private |
Definition at line 299 of file HTTP2Codec.cpp.
References proxygen::HTTPParallelCodec::callback_, folly::io::detail::CursorBase< Derived, BufType >::clone(), curHeader_, proxygen::HTTPParallelCodec::deliverCallbackIfAllowed(), folly::IOBuf::empty(), FOLLY_SCOPED_TRACE_SECTION, proxygen::http2::frameHasPadding(), handleEndStream(), proxygen::http2::FrameHeader::length, min, folly::gen::move, proxygen::NO_ERROR, proxygen::HTTPCodec::Callback::onBody(), proxygen::http2::parseDataBegin(), proxygen::http2::parseDataEnd(), pendingDataFrameBytes_, pendingDataFramePaddingBytes_, RETURN_IF_ERROR, proxygen::http2::FrameHeader::stream, and uint16_t.
Referenced by getHeaderIndexingStrategy(), and onIngress().
|
private |
Definition at line 395 of file HTTP2Codec.cpp.
References checkNewStream(), curHeader_, FOLLY_SCOPED_TRACE_SECTION, isRequest(), proxygen::http2::FrameHeader::length, folly::gen::move, folly::none, proxygen::http2::parseExHeaders(), parseHeadersImpl(), RETURN_IF_ERROR, and proxygen::http2::FrameHeader::stream.
Referenced by getHeaderIndexingStrategy(), and parseFrame().
|
private |
Definition at line 163 of file HTTP2Codec.cpp.
References proxygen::http2::ALTSVC, proxygen::http2::CERTIFICATE, proxygen::http2::CERTIFICATE_REQUEST, folly::IOBufQueue::chainLength(), proxygen::http2::CONTINUATION, curHeader_, curHeaderBlock_, proxygen::http2::DATA, egressSettings_, proxygen::ENABLE_EX_HEADERS, proxygen::http2::END_HEADERS, proxygen::ERROR, proxygen::http2::EX_HEADERS, expectedContinuationStream_, proxygen::http2::FrameHeader::flags, FOLLY_SCOPED_TRACE_SECTION, proxygen::http2::frameAffectsCompression(), proxygen::http2::getFrameTypeString(), proxygen::HTTPSettings::getSetting(), proxygen::http2::GOAWAY, proxygen::HTTPParallelCodec::goawayErrorMessage_, proxygen::http2::HEADERS, ingressSettings_, proxygen::http2::FrameHeader::length, proxygen::MAX_HEADER_LIST_SIZE, proxygen::NO_ERROR, parseAllData(), parseCertificate(), parseCertificateRequest(), parseContinuation(), parseExHeaders(), parseGoaway(), parseHeaders(), parsePing(), parsePriority(), parsePushPromise(), parseRstStream(), parseSettings(), parseWindowUpdate(), proxygen::http2::PING, proxygen::http2::PRIORITY, proxygen::PROTOCOL_ERROR, proxygen::http2::PUSH_PROMISE, proxygen::http2::RST_STREAM, proxygen::http2::SETTINGS, folly::io::detail::CursorBase< Derived, BufType >::skip(), proxygen::http2::FrameHeader::stream, proxygen::http2::FrameHeader::type, uint8_t, and proxygen::http2::WINDOW_UPDATE.
Referenced by getHeaderIndexingStrategy(), and onIngress().
|
private |
Definition at line 869 of file HTTP2Codec.cpp.
References proxygen::HTTPParallelCodec::callback_, curHeader_, folly::IOBuf::data(), proxygen::empty_string, proxygen::getErrorCodeString(), proxygen::HTTPParallelCodec::ingressGoawayAck_, proxygen::http2::FrameHeader::length, folly::IOBuf::length(), folly::gen::move, proxygen::NO_ERROR, proxygen::HTTPCodec::Callback::onGoaway(), proxygen::http2::parseGoaway(), RETURN_IF_ERROR, statusCode, uint32_t, userAgent_, and folly::WARNING.
Referenced by getHeaderIndexingStrategy(), and parseFrame().
|
private |
Definition at line 378 of file HTTP2Codec.cpp.
References checkNewStream(), curHeader_, proxygen::DOWNSTREAM, FOLLY_SCOPED_TRACE_SECTION, proxygen::http2::FrameHeader::length, folly::gen::move, folly::none, proxygen::http2::parseHeaders(), parseHeadersImpl(), RETURN_IF_ERROR, proxygen::http2::FrameHeader::stream, and proxygen::HTTPParallelCodec::transportDirection_.
Referenced by getHeaderIndexingStrategy(), and parseFrame().
|
private |
Definition at line 585 of file HTTP2Codec.cpp.
References proxygen::HTTPParallelCodec::callback_, curHeader_, egressSettings_, proxygen::http2::EX_HEADERS, proxygen::http2::FrameHeader::flags, proxygen::HTTPSettings::getSetting(), proxygen::http2::HEADERS, max, proxygen::MAX_CONCURRENT_STREAMS, proxygen::NO_ERROR, proxygen::HTTPCodec::Callback::numIncomingStreams(), proxygen::http2::PRIORITY, proxygen::REFUSED_STREAM, streamError(), and proxygen::http2::FrameHeader::type.
Referenced by getHeaderIndexingStrategy(), and parseHeadersImpl().
|
private |
Definition at line 507 of file HTTP2Codec.cpp.
References proxygen::HTTPParallelCodec::callback_, folly::IOBufQueue::chainLength(), proxygen::COMPRESSION_ERROR, curHeader_, curHeaderBlock_, proxygen::HeaderDecodeInfo::decodeError, decodeInfo_, proxygen::HPACKCodec::decodeStreaming(), proxygen::DOWNSTREAM, proxygen::ERROR, folly::IOBufQueue::front(), g(), headerCodec_, proxygen::http2::HEADERS, proxygen::HPACK::HEADERS_TOO_LARGE, proxygen::HTTPException::INGRESS, proxygen::HeaderDecodeInfo::init(), isRequest(), std::tr1::make_tuple(), folly::makeGuard(), folly::IOBufQueue::move(), folly::gen::move, proxygen::HeaderDecodeInfo::msg, proxygen::NO_ERROR, proxygen::HPACK::NONE, proxygen::HTTPCodec::Callback::onError(), parsingDownstreamTrailers_, proxygen::HeaderDecodeInfo::parsingError, proxygen::IOBufPrinter::printHexFolly(), proxygen::PROTOCOL_ERROR, proxygen::http2::FrameHeader::stream, streamError(), string, proxygen::HTTPParallelCodec::transportDirection_, and proxygen::http2::FrameHeader::type.
Referenced by getHeaderIndexingStrategy(), and parseHeadersImpl().
|
private |
Definition at line 424 of file HTTP2Codec.cpp.
References folly::IOBufQueue::append(), proxygen::HTTPParallelCodec::callback_, proxygen::http2::CONTINUATION, proxygen::HTTPCodec::ExAttributes::controlStream, curHeader_, curHeaderBlock_, proxygen::HTTPParallelCodec::deliverCallbackIfAllowed(), proxygen::http2::END_HEADERS, proxygen::http2::END_STREAM, proxygen::http2::EX_HEADERS, proxygen::http2::FrameHeader::flags, handleEndStream(), headerBlockFrameType_, proxygen::http2::HEADERS, folly::gen::move, proxygen::NO_ERROR, proxygen::HTTPCodec::Callback::onExMessageBegin(), proxygen::HTTPCodec::Callback::onHeadersComplete(), proxygen::HTTPCodec::Callback::onMessageBegin(), proxygen::HTTPCodec::Callback::onPushMessageBegin(), proxygen::HTTPCodec::Callback::onTrailersComplete(), parseHeadersCheckConcurrentStreams(), parseHeadersDecodeFrames(), parsingTrailers(), proxygen::http2::PUSH_PROMISE, proxygen::http2::FrameHeader::stream, proxygen::HTTPParallelCodec::transportDirection_, proxygen::http2::FrameHeader::type, uint32_t, and proxygen::HTTPCodec::ExAttributes::unidirectional.
Referenced by getHeaderIndexingStrategy(), parseContinuation(), parseExHeaders(), parseHeaders(), and parsePushPromise().
|
private |
Definition at line 854 of file HTTP2Codec.cpp.
References proxygen::http2::ACK, proxygen::HTTPParallelCodec::callback_, curHeader_, proxygen::http2::FrameHeader::flags, proxygen::http2::FrameHeader::length, proxygen::NO_ERROR, proxygen::HTTPCodec::Callback::onPingReply(), proxygen::HTTPCodec::Callback::onPingRequest(), proxygen::http2::parsePing(), RETURN_IF_ERROR, and uint64_t.
Referenced by getHeaderIndexingStrategy(), and parseFrame().
|
private |
Definition at line 650 of file HTTP2Codec.cpp.
References curHeader_, proxygen::HTTPParallelCodec::deliverCallbackIfAllowed(), proxygen::http2::PriorityUpdate::exclusive, proxygen::http2::FrameHeader::length, std::tr1::make_tuple(), proxygen::NO_ERROR, proxygen::HTTPCodec::Callback::onPriority(), proxygen::http2::parsePriority(), proxygen::PROTOCOL_ERROR, RETURN_IF_ERROR, proxygen::http2::FrameHeader::stream, proxygen::http2::PriorityUpdate::streamDependency, streamError(), and proxygen::http2::PriorityUpdate::weight.
Referenced by getHeaderIndexingStrategy(), and parseFrame().
|
private |
Definition at line 817 of file HTTP2Codec.cpp.
References checkNewStream(), curHeader_, egressSettings_, proxygen::ENABLE_PUSH, proxygen::HTTPSettings::getSetting(), proxygen::HTTPParallelCodec::goawayErrorMessage_, proxygen::http2::FrameHeader::length, folly::gen::move, folly::none, parseHeadersImpl(), proxygen::http2::parsePushPromise(), proxygen::PROTOCOL_ERROR, RETURN_IF_ERROR, proxygen::http2::FrameHeader::stream, proxygen::HTTPParallelCodec::transportDirection_, uint32_t, and proxygen::UPSTREAM.
Referenced by getHeaderIndexingStrategy(), and parseFrame().
|
private |
Definition at line 686 of file HTTP2Codec.cpp.
References curHeader_, proxygen::HTTPParallelCodec::deliverCallbackIfAllowed(), proxygen::getErrorCodeString(), proxygen::HTTPParallelCodec::goawayErrorMessage_, proxygen::http2::FrameHeader::length, proxygen::NO_ERROR, proxygen::HTTPCodec::Callback::onAbort(), proxygen::http2::parseRstStream(), proxygen::PROTOCOL_ERROR, RETURN_IF_ERROR, statusCode, proxygen::http2::FrameHeader::stream, upgradedStreams_, and userAgent_.
Referenced by getHeaderIndexingStrategy(), and parseFrame().
|
private |
Definition at line 705 of file HTTP2Codec.cpp.
References proxygen::http2::ACK, proxygen::HTTPParallelCodec::callback_, curHeader_, proxygen::http2::FrameHeader::flags, handleSettings(), proxygen::http2::FrameHeader::length, proxygen::NO_ERROR, proxygen::HTTPCodec::Callback::onSettingsAck(), proxygen::http2::parseSettings(), RETURN_IF_ERROR, settings, and proxygen::http2::FrameHeader::stream.
Referenced by getHeaderIndexingStrategy(), and parseFrame().
|
private |
Definition at line 898 of file HTTP2Codec.cpp.
References curHeader_, proxygen::HTTPParallelCodec::deliverCallbackIfAllowed(), proxygen::HTTPParallelCodec::goawayErrorMessage_, proxygen::http2::FrameHeader::length, proxygen::NO_ERROR, proxygen::HTTPCodec::Callback::onWindowUpdate(), proxygen::http2::parseWindowUpdate(), proxygen::PROTOCOL_ERROR, RETURN_IF_ERROR, proxygen::http2::FrameHeader::stream, streamError(), and uint32_t.
Referenced by getHeaderIndexingStrategy(), and parseFrame().
|
private |
Definition at line 1637 of file HTTP2Codec.cpp.
References proxygen::http2::CONTINUATION, curHeader_, decodeInfo_, proxygen::DOWNSTREAM, proxygen::HeaderDecodeInfo::hasStatus(), proxygen::http2::HEADERS, parsingDownstreamTrailers_, proxygen::HTTPParallelCodec::transportDirection_, and proxygen::http2::FrameHeader::type.
Referenced by maxRecvFrameSize(), and parseHeadersImpl().
|
inline |
Definition at line 127 of file HTTP2Codec.h.
References proxygen::ENABLE_CONNECT_PROTOCOL, proxygen::HTTPSettings::getSetting(), and ingressSettings_.
|
static |
Definition at line 1509 of file HTTP2Codec.cpp.
References proxygen::HTTPMessage::checkForHeaderToken(), generateSettings(), proxygen::HTTPMessage::getHeaders(), proxygen::HTTP_HEADER_CONNECTION, proxygen::HTTP_HEADER_UPGRADE, proxygen::http2::kFrameHeaderSize, proxygen::http2::kProtocolCleartextString, proxygen::http2::kProtocolSettingsHeader, proxygen::HTTPHeaders::set(), proxygen::UPSTREAM, and fizz::detail::writeBuf().
Referenced by getHPACKTableInfo(), and TEST_F().
|
inlineoverridevirtual |
set stats for the header codec, if the protocol supports header compression
Reimplemented from proxygen::HTTPCodec.
Definition at line 134 of file HTTP2Codec.h.
References headerCodec_, and proxygen::HeaderCodec::setStats().
|
inline |
Definition at line 171 of file HTTP2Codec.h.
References headerCodec_, and proxygen::HPACKCodec::setHeaderIndexingStrategy().
Referenced by proxygen::HTTPSessionBase::initCodecHeaderIndexingStrategy().
|
inline |
Definition at line 167 of file HTTP2Codec.h.
References reuseIOBufHeadroomForData_.
|
private |
Definition at line 1616 of file HTTP2Codec.cpp.
References proxygen::HTTPParallelCodec::callback_, curHeader_, folly::pushmi::operators::error(), proxygen::HTTPException::INGRESS_AND_EGRESS, proxygen::HTTPCodec::Callback::onError(), proxygen::HTTPException::setCodecStatusCode(), and proxygen::http2::FrameHeader::stream.
Referenced by maxRecvFrameSize(), parseHeadersCheckConcurrentStreams(), parseHeadersDecodeFrames(), parsePriority(), and parseWindowUpdate().
|
inlineoverridevirtual |
Check whether the codec supports bidirectional communications between server and client.
Reimplemented from proxygen::HTTPCodec.
Definition at line 130 of file HTTP2Codec.h.
References egressSettings_, proxygen::ENABLE_EX_HEADERS, proxygen::HTTPSettings::getSetting(), and ingressSettings_.
|
inlineoverridevirtual |
Check whether the codec supports pushing resources from server to client.
Implements proxygen::HTTPCodec.
Definition at line 120 of file HTTP2Codec.h.
References proxygen::DOWNSTREAM, egressSettings_, proxygen::ENABLE_PUSH, proxygen::HTTPSettings::getSetting(), ingressSettings_, proxygen::HTTPParallelCodec::transportDirection_, and proxygen::UPSTREAM.
|
private |
Definition at line 251 of file HTTP2Codec.h.
Referenced by parseCertificate().
|
private |
Definition at line 250 of file HTTP2Codec.h.
Referenced by parseCertificate().
|
private |
Definition at line 243 of file HTTP2Codec.h.
Referenced by generateRstStream(), handleEndStream(), handleSettings(), onHeadersComplete(), onIngress(), parseAllData(), parseCertificate(), parseCertificateRequest(), parseContinuation(), parseDataFrameData(), parseExHeaders(), parseFrame(), parseGoaway(), parseHeaders(), parseHeadersCheckConcurrentStreams(), parseHeadersDecodeFrames(), parseHeadersImpl(), parsePing(), parsePriority(), parsePushPromise(), parseRstStream(), parseSettings(), parseWindowUpdate(), parsingTrailers(), and streamError().
|
private |
Definition at line 254 of file HTTP2Codec.h.
Referenced by parseFrame(), parseHeadersDecodeFrames(), and parseHeadersImpl().
|
private |
Definition at line 282 of file HTTP2Codec.h.
Referenced by onDecodeError(), onHeader(), onHeadersComplete(), parseHeadersDecodeFrames(), and parsingTrailers().
|
private |
Definition at line 260 of file HTTP2Codec.h.
Referenced by generateSettings(), getEgressSettings(), handleSettings(), HTTP2Codec(), maxRecvFrameSize(), parseFrame(), parseHeadersCheckConcurrentStreams(), parsePushPromise(), supportsExTransactions(), and supportsPushTransactions().
|
private |
Definition at line 244 of file HTTP2Codec.h.
Referenced by handleEndStream(), and parseFrame().
|
private |
Definition at line 276 of file HTTP2Codec.h.
Referenced by onIngress().
|
private |
Definition at line 296 of file HTTP2Codec.h.
Referenced by parseHeadersImpl().
|
private |
Definition at line 240 of file HTTP2Codec.h.
Referenced by encodeHeaders(), generateSettings(), getHeaderIndexingStrategy(), getHPACKTableInfo(), handleSettings(), HTTP2Codec(), onHeader(), parseHeadersDecodeFrames(), setHeaderCodecStats(), and setHeaderIndexingStrategy().
|
private |
Definition at line 255 of file HTTP2Codec.h.
Referenced by encodeHeaders(), getIngressSettings(), handleSettings(), maxSendFrameSize(), parseFrame(), peerHasWebsockets(), supportsExTransactions(), and supportsPushTransactions().
|
private |
Definition at line 246 of file HTTP2Codec.h.
Referenced by generateRstStream(), handleEndStream(), and onHeadersComplete().
|
private |
Definition at line 292 of file HTTP2Codec.h.
Referenced by checkNewStream(), parseHeadersDecodeFrames(), and parsingTrailers().
|
private |
Definition at line 279 of file HTTP2Codec.h.
Referenced by onIngress(), and parseDataFrameData().
|
private |
Definition at line 280 of file HTTP2Codec.h.
Referenced by onIngress(), and parseDataFrameData().
|
private |
Definition at line 245 of file HTTP2Codec.h.
Referenced by generateRstStream(), and handleEndStream().
|
private |
Definition at line 267 of file HTTP2Codec.h.
Referenced by getReceivedFrameCount(), and onIngress().
|
private |
Definition at line 284 of file HTTP2Codec.h.
Referenced by generateBody(), generateEOM(), and setReuseIOBufHeadroomForData().
|
private |
Definition at line 248 of file HTTP2Codec.h.
Referenced by generateEOM(), generateHeaderImpl(), generateRstStream(), onHeadersComplete(), and parseRstStream().
|
private |
Definition at line 277 of file HTTP2Codec.h.
Referenced by generateGoaway(), generateRstStream(), getUserAgent(), onHeader(), parseGoaway(), and parseRstStream().
|
private |
Definition at line 283 of file HTTP2Codec.h.
Referenced by addPriorityNodes(), and mapPriorityToDependency().