proxygen
|
#include <SPDYCodec.h>
Classes | |
struct | SettingData |
Public Types | |
using | SettingList = std::vector< SettingData > |
Public Types inherited from proxygen::HTTPCodec | |
using | StreamID = uint64_t |
Static Public Member Functions | |
static const SPDYVersionSettings & | getVersionSettings (SPDYVersion version) |
static folly::Optional< SPDYVersion > | getVersion (const std::string &protocol) |
Static Public Attributes | |
static const StreamID | NoStream = 0 |
Static Public Attributes inherited from proxygen::HTTPCodec | |
static const folly::Optional< StreamID > | NoStream |
static const folly::Optional< uint8_t > | NoPadding = folly::none |
static const StreamID | MAX_STREAM_ID = 1u << 31 |
static const folly::Optional< ExAttributes > | NoExAttributes |
Private Types | |
enum | FrameState { FRAME_HEADER = 0, CTRL_FRAME_DATA = 1, DATA_FRAME_DATA = 2 } |
Private Attributes | |
folly::fbvector< StreamID > | closedStreams_ |
const SPDYVersionSettings & | versionSettings_ |
HTTPSettings | ingressSettings_ |
HTTPSettings | egressSettings_ |
std::unique_ptr< HTTPMessage > | partialMsg_ |
std::string | userAgent_ |
const folly::IOBuf * | currentIngressBuf_ {nullptr} |
StreamID | nextEgressPingID_ |
uint32_t | maxFrameLength_ {spdy::kMaxFrameLength} |
uint32_t | streamId_ {0} |
uint32_t | length_ {0} |
uint16_t | version_ {0} |
uint16_t | type_ {0xffff} |
uint8_t | flags_ {0} |
enum proxygen::SPDYCodec::FrameState | frameState_ |
bool | ctrl_:1 |
GzipHeaderCodec | headerCodec_ |
Additional Inherited Members | |
Protected Types inherited from proxygen::HTTPParallelCodec | |
enum | ClosingState { OPEN = 0, OPEN_WITH_GRACEFUL_DRAIN_ENABLED = 1, FIRST_GOAWAY_SENT = 2, CLOSING = 3, CLOSED = 4 } |
Protected Member Functions inherited from proxygen::HTTPParallelCodec | |
template<typename T , typename... Args> | |
bool | deliverCallbackIfAllowed (T callbackFn, char const *cbName, StreamID stream, Args &&...args) |
Protected Attributes inherited from proxygen::HTTPParallelCodec | |
TransportDirection | transportDirection_ |
StreamID | nextEgressStreamID_ |
StreamID | lastStreamID_ {0} |
HTTPCodec::Callback * | callback_ {nullptr} |
StreamID | ingressGoawayAck_ {std::numeric_limits<uint32_t>::max()} |
StreamID | egressGoawayAck_ {std::numeric_limits<uint32_t>::max()} |
std::string | goawayErrorMessage_ |
enum proxygen::HTTPParallelCodec::ClosingState | sessionClosing_ |
An implementation of the framing layer for all versions of SPDY. Instances of this class must not be used from multiple threads concurrently.
Definition at line 36 of file SPDYCodec.h.
using proxygen::SPDYCodec::SettingList = std::vector<SettingData> |
Definition at line 153 of file SPDYCodec.h.
|
private |
Enumerator | |
---|---|
FRAME_HEADER | |
CTRL_FRAME_DATA | |
DATA_FRAME_DATA |
Definition at line 369 of file SPDYCodec.h.
|
explicit |
Definition at line 170 of file SPDYCodec.cpp.
References headerCodec_, proxygen::SPDYVersionSettings::majorVersion, proxygen::SPDYVersionSettings::minorVersion, nextEgressPingID_, proxygen::HTTPParallelCodec::nextEgressStreamID_, proxygen::HeaderCodec::setMaxUncompressed(), and versionSettings_.
|
override |
Definition at line 186 of file SPDYCodec.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 1010 of file SPDYCodec.cpp.
References proxygen::HTTPCodec::PriorityQueue::addPriorityNode(), proxygen::HTTPCodec::MAX_STREAM_ID, parent, and uint8_t.
|
private |
Definition at line 219 of file SPDYCodec.cpp.
References proxygen::ERROR, proxygen::spdy::GOAWAY_PROTOCOL_ERROR, and length_.
Referenced by onControlFrame().
|
private |
Definition at line 227 of file SPDYCodec.cpp.
References proxygen::ERROR, proxygen::spdy::GOAWAY_PROTOCOL_ERROR, and length_.
Referenced by onControlFrame().
|
private |
Decodes the headers from the cursor and returns the result.
Definition at line 466 of file SPDYCodec.cpp.
References proxygen::BAD_ENCODING, proxygen::GzipHeaderCodec::decode(), failStream(), proxygen::spdy::GOAWAY_PROTOCOL_ERROR, headerCodec_, proxygen::spdy::HEADERS, proxygen::HEADERS_TOO_LARGE, proxygen::INFLATE_DICTIONARY, length_, proxygen::spdy::RST_FRAME_TOO_LARGE, proxygen::spdy::RST_PROTOCOL_ERROR, streamId_, and type_.
Referenced by onControlFrame().
|
private |
Definition at line 1271 of file SPDYCodec.cpp.
References proxygen::HTTPParallelCodec::deliverCallbackIfAllowed(), proxygen::HTTPCodec::Callback::onMessageBegin(), and proxygen::HTTPCodec::Callback::onPushMessageBegin().
Referenced by onSynCommon(), and parseHeaders().
|
private |
Helper function to create the compressed Name/Value representation of a message's headers.
msg | The message containing headers to serialize. |
headers | A vector containing any extra headers to serialize |
size | Size of the serialized headers before and after compression |
headroom | Optional amount of headroom to reserve at the front of the returned IOBuf, in case the caller wants to put some other data there. |
Definition at line 503 of file SPDYCodec.cpp.
References proxygen::GzipHeaderCodec::encode(), proxygen::HTTPHeaders::forEachWithCode(), proxygen::HeaderCodec::getEncodedSize(), proxygen::HTTPMessage::getHeaders(), headerCodec_, proxygen::HTTP_HEADER_CONNECTION, proxygen::HTTP_HEADER_HOST, proxygen::HTTP_HEADER_KEEP_ALIVE, proxygen::HTTP_HEADER_OTHER, proxygen::HTTP_HEADER_PROXY_CONNECTION, proxygen::HTTP_HEADER_TRANSFER_ENCODING, proxygen::HTTP_HEADER_UPGRADE, proxygen::spdy::httpVersion, isSPDYReserved(), proxygen::SPDYVersionSettings::majorVersion, name, proxygen::HeaderCodec::setEncodeHeadroom(), value, versionSettings_, and proxygen::SPDYVersionSettings::versionStr.
Referenced by serializeRequestHeaders(), and serializeResponseHeaders().
|
private |
Definition at line 1474 of file SPDYCodec.cpp.
References proxygen::HTTPParallelCodec::callback_, folly::IOBuf::clone(), currentIngressBuf_, proxygen::spdy::goawayToErrorCode(), proxygen::HTTPException::INGRESS_AND_EGRESS, proxygen::kErrorParseHeader, proxygen::HTTPParallelCodec::lastStreamID_, proxygen::HTTPCodec::Callback::onError(), proxygen::HTTPException::setCodecStatusCode(), proxygen::HTTPException::setCurrentIngressBuf(), and proxygen::Exception::setProxygenError().
Referenced by onIngress().
|
private |
Definition at line 1444 of file SPDYCodec.cpp.
References proxygen::HTTPParallelCodec::callback_, folly::IOBuf::clone(), proxygen::spdy::CTRL_FLAG_FIN, currentIngressBuf_, flags_, proxygen::HTTPException::INGRESS, proxygen::HTTPException::INGRESS_AND_EGRESS, proxygen::kErrorParseHeader, folly::gen::move, proxygen::HTTPCodec::Callback::onError(), partialMsg_, proxygen::spdy::rstToErrorCode(), proxygen::HTTPException::setCodecStatusCode(), proxygen::HTTPException::setCurrentIngressBuf(), proxygen::HTTPException::setHttpStatusCode(), proxygen::HTTPException::setPartialMsg(), proxygen::Exception::setProxygenError(), and streamId_.
Referenced by decodeHeaders(), and parseIngress().
|
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 765 of file SPDYCodec.cpp.
References folly::IOBuf::computeChainDataLength(), generateDataFrame(), proxygen::HTTPParallelCodec::ingressGoawayAck_, proxygen::HTTPParallelCodec::isStreamIngressEgressAllowed(), folly::gen::move, uint32_t, and uint8_t.
Referenced by TEST_F().
|
overridevirtual |
Write a body chunk header, if relevant.
Implements proxygen::HTTPCodec.
Definition at line 790 of file SPDYCodec.cpp.
|
overridevirtual |
Write a body chunk terminator, if relevant.
Implements proxygen::HTTPCodec.
Definition at line 797 of file SPDYCodec.cpp.
|
private |
Generate the header for a SPDY data frame
writeBuf | Buffer queue to which the control frame is written. |
streamID | Stream ID. |
flags | Bitmap of flags, as defined in the SPDY spec. |
length | Length of the data, in bytes. |
Definition at line 1031 of file SPDYCodec.cpp.
References folly::IOBufQueue::append(), folly::IOBuf::headroom(), folly::IOBuf::isSharedOne(), folly::IOBuf::length(), folly::gen::move, folly::IOBuf::pop(), folly::IOBufQueue::postallocate(), folly::IOBuf::retreat(), folly::IOBufQueue::tailroom(), folly::IOBuf::trimEnd(), uint32_t, uint64_t, and folly::io::detail::Writable< Derived >::writeBE().
Referenced by generateBody(), and generateEOM().
|
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 812 of file SPDYCodec.cpp.
References generateDataFrame(), proxygen::HTTPParallelCodec::ingressGoawayAck_, proxygen::HTTPParallelCodec::isStreamIngressEgressAllowed(), stream, and uint32_t.
Referenced by TEST().
|
overridevirtual |
Generate any protocol framing needed to abort a connection.
Implements proxygen::HTTPCodec.
Definition at line 856 of file SPDYCodec.cpp.
References folly::IOBufQueue::chainLength(), proxygen::SPDYVersionSettings::controlVersion, folly::IOBuf::data(), proxygen::HTTPParallelCodec::egressGoawayAck_, proxygen::spdy::errorCodeToGoaway(), proxygen::getErrorCodeString(), proxygen::spdy::GOAWAY, proxygen::SPDYVersionSettings::goawaySize, proxygen::SPDYVersionSettings::majorVersion, max, proxygen::NO_ERROR, proxygen::HTTPParallelCodec::sessionClosing_, statusCode, uint16_t, uint32_t, versionSettings_, and folly::io::detail::Writable< Derived >::writeBE().
Referenced by TEST(), and TEST_F().
|
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 625 of file SPDYCodec.cpp.
References wangle::HTTPHeaderSize::compressed, generateSynReply(), generateSynStream(), proxygen::HTTPParallelCodec::ingressGoawayAck_, proxygen::HTTPParallelCodec::isStreamIngressEgressAllowed(), proxygen::HTTPParallelCodec::transportDirection_, wangle::HTTPHeaderSize::uncompressed, and proxygen::UPSTREAM.
Referenced by TEST_F().
|
private |
Generates the shared parts of a ping request and reply.
Definition at line 929 of file SPDYCodec.cpp.
References folly::IOBufQueue::chainLength(), proxygen::SPDYVersionSettings::controlVersion, proxygen::spdy::PING, uint16_t, uint32_t, versionSettings_, and folly::io::detail::Writable< Derived >::writeBE().
Referenced by generatePingReply(), and generatePingRequest().
|
overridevirtual |
Generate a reply to a ping message, if supported in the protocol implemented by the codec.
Reimplemented from proxygen::HTTPCodec.
Definition at line 924 of file SPDYCodec.cpp.
References generatePingCommon().
Referenced by TEST().
|
overridevirtual |
If the protocol supports it, generate a ping message that the other side should respond to.
Reimplemented from proxygen::HTTPCodec.
Definition at line 917 of file SPDYCodec.cpp.
References generatePingCommon(), and nextEgressPingID_.
Referenced by TEST().
|
overridevirtual |
Reimplemented from proxygen::HTTPCodec.
Definition at line 646 of file SPDYCodec.cpp.
References wangle::HTTPHeaderSize::compressed, generateSynStream(), proxygen::HTTPParallelCodec::ingressGoawayAck_, proxygen::HTTPParallelCodec::isStreamIngressEgressAllowed(), NoStream, and wangle::HTTPHeaderSize::uncompressed.
Referenced by TEST_F().
|
overridevirtual |
Generate any protocol framing needed to abort a stream.
Implements proxygen::HTTPCodec.
Definition at line 824 of file SPDYCodec.cpp.
References folly::IOBufQueue::chainLength(), proxygen::SPDYVersionSettings::controlVersion, proxygen::spdy::CTRL_FLAG_FIN, proxygen::spdy::errorCodeToReset(), flags_, proxygen::getErrorCodeString(), proxygen::HTTPParallelCodec::ingressGoawayAck_, proxygen::HTTPParallelCodec::isStreamIngressEgressAllowed(), proxygen::spdy::RST_PROTOCOL_ERROR, proxygen::spdy::RST_STREAM, rstStatusSupported(), statusCode, streamId_, uint16_t, uint32_t, versionSettings_, and folly::io::detail::Writable< Derived >::writeBE().
Referenced by TEST().
|
overridevirtual |
Generate a settings message, if supported in the protocol implemented by the codec.
Reimplemented from proxygen::HTTPCodec.
Definition at line 941 of file SPDYCodec.cpp.
References folly::IOBufQueue::chainLength(), proxygen::SPDYVersionSettings::controlVersion, egressSettings_, proxygen::spdy::FLAG_SETTINGS_CLEAR_SETTINGS, proxygen::HTTPSettings::getAllSettings(), proxygen::HTTPSettings::getNumSettings(), proxygen::spdy::httpToSpdySettingsId(), proxygen::SPDYVersionSettings::majorVersion, proxygen::spdy::SETTINGS, uint16_t, uint32_t, versionSettings_, folly::io::detail::Writable< Derived >::writeBE(), and folly::io::detail::Writable< Derived >::writeLE().
Referenced by TEST().
|
private |
Generates a frame of type SYN_REPLY
Definition at line 724 of file SPDYCodec.cpp.
References folly::IOBufQueue::append(), folly::IOBuf::computeChainDataLength(), proxygen::SPDYVersionSettings::controlVersion, proxygen::spdy::CTRL_FLAG_FIN, proxygen::spdy::CTRL_FLAG_NONE, proxygen::SPDYVersionSettings::majorVersion, folly::gen::move, folly::IOBuf::prepend(), serializeResponseHeaders(), proxygen::spdy::SYN_REPLY, proxygen::SPDYVersionSettings::synReplySize, uint16_t, uint32_t, uint8_t, and versionSettings_.
Referenced by generateHeader().
|
private |
Generates a frame of type SYN_STREAM
Definition at line 665 of file SPDYCodec.cpp.
References folly::IOBufQueue::append(), folly::IOBuf::computeChainDataLength(), proxygen::SPDYVersionSettings::controlVersion, proxygen::spdy::CTRL_FLAG_FIN, proxygen::spdy::CTRL_FLAG_NONE, proxygen::spdy::CTRL_FLAG_UNIDIRECTIONAL, proxygen::HTTPMessage::getPriority(), proxygen::SPDYVersionSettings::majorVersion, folly::gen::move, NoStream, folly::IOBuf::prepend(), proxygen::SPDYVersionSettings::priShift, serializeRequestHeaders(), proxygen::spdy::SYN_STREAM, uint16_t, uint32_t, uint8_t, and versionSettings_.
Referenced by generateHeader(), and generatePushPromise().
|
overridevirtual |
Write the message trailers
Implements proxygen::HTTPCodec.
Definition at line 803 of file SPDYCodec.cpp.
|
overridevirtual |
Reimplemented from proxygen::HTTPCodec.
Definition at line 981 of file SPDYCodec.cpp.
References folly::IOBufQueue::chainLength(), proxygen::SPDYVersionSettings::controlVersion, proxygen::HTTPParallelCodec::ingressGoawayAck_, proxygen::HTTPParallelCodec::isStreamIngressEgressAllowed(), proxygen::SPDYVersionSettings::majorVersion, proxygen::SPDYVersionSettings::minorVersion, NoStream, uint16_t, uint32_t, versionSettings_, proxygen::spdy::WINDOW_UPDATE, and folly::io::detail::Writable< Derived >::writeBE().
|
inlineoverridevirtual |
Get the default size of flow control windows for this protocol
Reimplemented from proxygen::HTTPCodec.
Definition at line 108 of file SPDYCodec.h.
References proxygen::http2::kInitialWindow, uint32_t, and uint8_t.
|
inlineoverridevirtual |
Returns a reference to the egress settings
Reimplemented from proxygen::HTTPCodec.
Definition at line 107 of file SPDYCodec.h.
Referenced by TEST().
|
inlineoverridevirtual |
Returns a const reference to the ingress settings. Since ingress settings are set by the remote end, it doesn't make sense for these to be mutable outside the codec.
Reimplemented from proxygen::HTTPCodec.
Definition at line 101 of file SPDYCodec.h.
uint8_t proxygen::SPDYCodec::getMinorVersion | ( | ) | const |
Definition at line 1027 of file SPDYCodec.cpp.
References proxygen::SPDYVersionSettings::minorVersion, and versionSettings_.
|
overridevirtual |
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 197 of file SPDYCodec.cpp.
References proxygen::SPDY3, proxygen::SPDY3_1, proxygen::SPDY_3, proxygen::SPDY_3_1, proxygen::SPDYVersionSettings::version, and versionSettings_.
Referenced by TEST().
|
overridevirtual |
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 206 of file SPDYCodec.cpp.
References userAgent_.
uint8_t proxygen::SPDYCodec::getVersion | ( | ) | const |
Definition at line 1023 of file SPDYCodec.cpp.
References proxygen::SPDYVersionSettings::majorVersion, and versionSettings_.
Referenced by proxygen::DefaultHTTPCodecFactory::getCodec(), proxygen::HTTPDefaultSessionCodecFactory::getCodec(), proxygen::HTTPDefaultSessionCodecFactory::HTTPDefaultSessionCodecFactory(), and TEST().
|
static |
Returns the SPDYVersion for the given protocol string, or none otherwise.
Definition at line 1501 of file SPDYCodec.cpp.
References folly::none, proxygen::SPDY3, and proxygen::SPDY3_1.
|
static |
Definition at line 138 of file SPDYCodec.cpp.
References proxygen::spdy::kNameHostv3, proxygen::spdy::kNameMethodv3, proxygen::spdy::kNamePathv3, proxygen::spdy::kNameSchemev3, proxygen::spdy::kNameStatusv3, proxygen::spdy::kNameVersionv3, proxygen::spdy::kSessionProtoNameSPDY3, proxygen::kSPDYv3Dictionary, proxygen::spdy::kVersionStrv3, proxygen::spdy::kVersionStrv31, proxygen::SPDY3, proxygen::SPDY3_1, and version.
|
private |
Definition at line 489 of file SPDYCodec.cpp.
References proxygen::caseInsensitiveEqual(), proxygen::DOWNSTREAM, proxygen::spdy::kNameMethodv2, proxygen::spdy::kNamePathv2, proxygen::spdy::kNameSchemev2, proxygen::spdy::kNameStatusv2, proxygen::spdy::kNameVersionv2, proxygen::SPDYVersionSettings::majorVersion, proxygen::HTTPParallelCodec::transportDirection_, proxygen::UPSTREAM, and versionSettings_.
Referenced by encodeHeaders().
Map the parent back to the priority, -1 if this doesn't make sense.
Reimplemented from proxygen::HTTPCodec.
Definition at line 136 of file SPDYCodec.h.
Map the given linear priority to the correct parent node dependency
Reimplemented from proxygen::HTTPCodec.
Definition at line 132 of file SPDYCodec.h.
|
private |
Helper function to parse out a control frame and execute its handler. All errors are thrown as exceptions.
Definition at line 335 of file SPDYCodec.cpp.
References checkLength(), checkMinLength(), proxygen::spdy::CREDENTIAL, decodeHeaders(), DELTA_WINDOW_SIZE_MASK, proxygen::ERROR, FLAGS_MASK, proxygen::GzipHeaderCodec::getDecodedSize(), proxygen::spdy::GOAWAY, proxygen::spdy::GOAWAY_PROTOCOL_ERROR, proxygen::SPDYVersionSettings::goawaySize, headerCodec_, proxygen::spdy::HEADERS, i, length_, proxygen::spdy::NOOP, onGoaway(), onHeaders(), onPing(), onRstStream(), onSettings(), onSynReply(), onSynStream(), onWindowUpdate(), proxygen::spdy::PING, proxygen::SPDYVersionSettings::priShift, folly::io::detail::CursorBase< Derived, BufType >::read(), folly::io::detail::CursorBase< Derived, BufType >::readBE(), folly::io::detail::CursorBase< Derived, BufType >::readLE(), proxygen::spdy::RST_STREAM, proxygen::spdy::SETTINGS, settings, folly::io::detail::CursorBase< Derived, BufType >::skip(), statusCode, STREAM_ID_MASK, streamId_, proxygen::spdy::SYN_REPLY, proxygen::spdy::SYN_STREAM, proxygen::SPDYVersionSettings::synReplySize, type_, uint32_t, uint8_t, value, version_, versionSettings_, and proxygen::spdy::WINDOW_UPDATE.
Referenced by parseIngress().
Definition at line 1416 of file SPDYCodec.cpp.
References proxygen::HTTPParallelCodec::callback_, proxygen::spdy::GOAWAY_FLOW_CONTROL_ERROR, proxygen::spdy::goawayToErrorCode(), proxygen::HTTPParallelCodec::ingressGoawayAck_, proxygen::HTTPCodec::Callback::onGoaway(), proxygen::PROTOCOL_ERROR, and statusCode.
Referenced by onControlFrame().
|
privatenoexcept |
Handle a HEADERS frame. This is not invoked when the first headers on a stream are received. This is called when the remote endpoint sends us any additional headers.
Definition at line 1435 of file SPDYCodec.cpp.
Referenced by onControlFrame().
|
overridevirtual |
Parse ingress data.
buf | A single IOBuf of data to parse |
Implements proxygen::HTTPCodec.
Definition at line 234 of file SPDYCodec.cpp.
References folly::IOBuf::computeChainDataLength(), currentIngressBuf_, failSession(), and parseIngress().
Referenced by TEST().
|
privatenoexcept |
Definition at line 1393 of file SPDYCodec.cpp.
References proxygen::HTTPParallelCodec::callback_, proxygen::DOWNSTREAM, nextEgressPingID_, odd, proxygen::HTTPCodec::Callback::onPingReply(), proxygen::HTTPCodec::Callback::onPingRequest(), and proxygen::HTTPParallelCodec::transportDirection_.
Referenced by onControlFrame().
|
privatenoexcept |
Handle an ingress RST_STREAM control frame.
Definition at line 1337 of file SPDYCodec.cpp.
References proxygen::HTTPParallelCodec::deliverCallbackIfAllowed(), proxygen::HTTPCodec::Callback::onAbort(), proxygen::spdy::rstToErrorCode(), statusCode, streamID, and streamId_.
Referenced by onControlFrame().
|
private |
Handle a SETTINGS message that changes/updates settings for the entire SPDY connection (across all transactions)
Definition at line 1345 of file SPDYCodec.cpp.
References proxygen::HTTPParallelCodec::callback_, proxygen::ERROR, flags_, proxygen::HTTPSettings::getSetting(), proxygen::spdy::GOAWAY_PROTOCOL_ERROR, proxygen::spdy::ID_FLAG_SETTINGS_PERSISTED, ingressSettings_, max, proxygen::HTTPCodec::Callback::onSettings(), s, proxygen::HTTPSettings::setSetting(), proxygen::spdy::SETTINGS_CLIENT_CERTIFICATE_VECTOR_SIZE, proxygen::spdy::SETTINGS_CURRENT_CWND, proxygen::spdy::SETTINGS_DOWNLOAD_BANDWIDTH, proxygen::spdy::SETTINGS_DOWNLOAD_RETRANS_RATE, proxygen::spdy::SETTINGS_INITIAL_WINDOW_SIZE, proxygen::spdy::SETTINGS_MAX_CONCURRENT_STREAMS, proxygen::spdy::SETTINGS_ROUND_TRIP_TIME, proxygen::spdy::SETTINGS_UPLOAD_BANDWIDTH, proxygen::spdy::spdyToHttpSettingsId(), and version_.
Referenced by onControlFrame().
|
private |
Helper function that contains the common implementation details of calling the same callbacks for onSynStream() and onSynReply()
Negative values of pri are interpreted much like negative array indexes in python, so -1 will be the largest numerical priority value for this SPDY version (i.e., 3 for SPDY/2 or 7 for SPDY/3), -2 the second largest (i.e., 2 for SPDY/2 or 6 for SPDY/3).
Definition at line 1238 of file SPDYCodec.cpp.
References proxygen::spdy::CTRL_FLAG_FIN, proxygen::HTTPParallelCodec::deliverCallbackIfAllowed(), deliverOnMessageBegin(), proxygen::ERROR, flags_, proxygen::spdy::GOAWAY_PROTOCOL_ERROR, proxygen::HTTP_HEADER_USER_AGENT, proxygen::SPDYVersionSettings::majorVersion, std::tr1::make_tuple(), proxygen::HTTPCodec::MAX_STREAM_ID, folly::gen::move, proxygen::HTTPCodec::Callback::onHeadersComplete(), parseHeaders(), proxygen::SPDYVersionSettings::protocolVersionString, proxygen::HTTPParallelCodec::transportDirection_, userAgent_, version_, and versionSettings_.
Referenced by onSynReply(), and onSynStream().
|
private |
Handle an ingress SYN_REPLY control frame. For an upstream-facing SPDY session, this frame is the equivalent of an HTTP response header.
Definition at line 1323 of file SPDYCodec.cpp.
References proxygen::DOWNSTREAM, NoStream, onSynCommon(), proxygen::spdy::RST_PROTOCOL_ERROR, streamId_, and proxygen::HTTPParallelCodec::transportDirection_.
Referenced by onControlFrame().
|
private |
Handle an ingress SYN_STREAM control frame. For a downstream-facing SPDY session, this frame is the equivalent of an HTTP request header.
Definition at line 1283 of file SPDYCodec.cpp.
References proxygen::HTTPParallelCodec::callback_, proxygen::spdy::CTRL_FLAG_UNIDIRECTIONAL, proxygen::DOWNSTREAM, egressSettings_, proxygen::ERROR, flags_, proxygen::HTTPSettings::getSetting(), proxygen::spdy::GOAWAY_PROTOCOL_ERROR, proxygen::spdy::kMaxConcurrentStreams, proxygen::HTTPParallelCodec::lastStreamID_, proxygen::MAX_CONCURRENT_STREAMS, NoStream, proxygen::HTTPCodec::Callback::numIncomingStreams(), onSynCommon(), proxygen::spdy::RST_PROTOCOL_ERROR, proxygen::spdy::RST_REFUSED_STREAM, proxygen::HTTPParallelCodec::sessionClosing_, streamId_, proxygen::HTTPParallelCodec::transportDirection_, and proxygen::UPSTREAM.
Referenced by onControlFrame().
|
privatenoexcept |
Definition at line 1439 of file SPDYCodec.cpp.
References proxygen::HTTPParallelCodec::deliverCallbackIfAllowed(), proxygen::HTTPCodec::Callback::onWindowUpdate(), and streamId_.
Referenced by onControlFrame().
|
private |
Parses the headers in the nameValues array and creates an HTTPMessage object initialized for this transaction.
Definition at line 1059 of file SPDYCodec.cpp.
References add, proxygen::HTTPHeaders::add(), proxygen::caseInsensitiveEqual(), deliverOnMessageBegin(), proxygen::DOWNSTREAM, proxygen::HTTPHeaders::exists(), proxygen::HTTPHeaders::getSingleOrEmpty(), proxygen::CodecUtil::hasGzipAndDeflate(), proxygen::spdy::HEADERS, proxygen::HTTP_HEADER_ACCEPT_ENCODING, proxygen::HTTP_HEADER_HOST, i, int16_t, int32_t, folly::gen::move, name, partialMsg_, proxygen::spdy::RST_PROTOCOL_ERROR, proxygen::HTTPHeaders::set(), folly::Range< Iter >::str(), proxygen::CodecUtil::STRICT, type_, uint32_t, uint8_t, proxygen::UPSTREAM, proxygen::CodecUtil::validateHeaderName(), proxygen::CodecUtil::validateHeaderValue(), proxygen::CodecUtil::validateMethod(), proxygen::CodecUtil::validateURL(), value, and version_.
Referenced by onSynCommon().
|
private |
Ingress parser, can throw exceptions
Definition at line 246 of file SPDYCodec.cpp.
References proxygen::HTTPParallelCodec::callback_, folly::io::detail::CursorBase< Derived, BufType >::clone(), folly::IOBuf::computeChainDataLength(), ctrl_, proxygen::spdy::CTRL_FLAG_FIN, CTRL_MASK, data, proxygen::HTTPParallelCodec::deliverCallbackIfAllowed(), proxygen::ERROR, failStream(), flags_, FLAGS_MASK, FRAME_HEADER_LEN, frameState_, proxygen::spdy::GOAWAY_PROTOCOL_ERROR, proxygen::spdy::HEADERS, length_, proxygen::SPDYVersionSettings::majorVersion, max, maxFrameLength_, min, folly::gen::move, proxygen::HTTPCodec::Callback::onBody(), onControlFrame(), proxygen::HTTPCodec::Callback::onFrameHeader(), proxygen::HTTPCodec::Callback::onMessageComplete(), folly::io::detail::CursorBase< Derived, BufType >::peek(), folly::io::detail::CursorBase< Derived, BufType >::readBE(), proxygen::spdy::RST_FRAME_TOO_LARGE, STREAM_ID_MASK, streamId_, proxygen::spdy::SYN_REPLY, proxygen::spdy::SYN_STREAM, folly::io::detail::CursorBase< Derived, BufType >::totalLength(), type_, uint16_t, uint32_t, version_, VERSION_MASK, and versionSettings_.
Referenced by onIngress().
|
private |
Helper function to check if the status code is supported by the SPDY version being used
Definition at line 1489 of file SPDYCodec.cpp.
References proxygen::SPDYVersionSettings::majorVersion, proxygen::spdy::RST_FLOW_CONTROL_ERROR, and versionSettings_.
Referenced by generateRstStream().
|
private |
Serializes headers for requests (aka SYN_STREAM)
msg | The message to serialize. |
isPushed | true if this is a push message |
size | Size of the serialized headers before and after compression |
headroom | Optional amount of headroom to reserve at the front of the returned IOBuf, in case the caller wants to put some other data there. |
Definition at line 587 of file SPDYCodec.cpp.
References encodeHeaders(), proxygen::HTTPHeaders::exists(), proxygen::HTTPMessage::getHeaders(), proxygen::HTTPMessage::getMethodString(), proxygen::HTTPMessage::getPushStatusStr(), proxygen::HTTPHeaders::getSingleOrEmpty(), proxygen::HTTPMessage::getURL(), proxygen::SPDYVersionSettings::hostStr, proxygen::HTTP_HEADER_COLON_METHOD, proxygen::HTTP_HEADER_COLON_PATH, proxygen::HTTP_HEADER_COLON_SCHEME, proxygen::HTTP_HEADER_COLON_STATUS, proxygen::HTTP_HEADER_HOST, proxygen::HTTP_HEADER_OTHER, proxygen::HTTPMessage::isSecure(), proxygen::SPDYVersionSettings::majorVersion, proxygen::HTTPHeaders::size(), and versionSettings_.
Referenced by generateSynStream().
|
private |
Serializes headers for responses (aka SYN_REPLY)
msg | The message to serialize. |
size | Size of the serialized headers before and after compression |
headroom | Optional amount of headroom to reserve at the front of the returned IOBuf, in case the caller wants to put some other data there. |
Definition at line 557 of file SPDYCodec.cpp.
References date, encodeHeaders(), proxygen::HTTPHeaders::exists(), proxygen::HTTPMessage::formatDateHeader(), proxygen::HTTPMessage::getHeaders(), proxygen::HTTPMessage::getStatusCode(), proxygen::HTTPMessage::getStatusMessage(), proxygen::HTTP_HEADER_COLON_STATUS, proxygen::HTTP_HEADER_DATE, and proxygen::HTTPHeaders::size().
Referenced by generateSynReply().
|
inlineoverridevirtual |
set stats for the header codec, if the protocol supports header compression
Reimplemented from proxygen::HTTPCodec.
Definition at line 123 of file SPDYCodec.h.
References uint8_t.
void proxygen::SPDYCodec::setMaxFrameLength | ( | uint32_t | maxFrameLength | ) |
void proxygen::SPDYCodec::setMaxUncompressedHeaders | ( | uint32_t | maxUncompressed | ) |
Set the maximum size of the uncompressed headers
Definition at line 193 of file SPDYCodec.cpp.
References headerCodec_, and proxygen::HeaderCodec::setMaxUncompressed().
Referenced by TEST().
|
inlineoverridevirtual |
Check whether the codec supports pushing resources from server to client.
Implements proxygen::HTTPCodec.
Definition at line 53 of file SPDYCodec.h.
References folly::size(), statusCode, uint32_t, uint64_t, and fizz::detail::writeBuf().
|
overridevirtual |
Returns true iff this codec supports session level flow control
Reimplemented from proxygen::HTTPParallelCodec.
Definition at line 214 of file SPDYCodec.cpp.
References proxygen::SPDYVersionSettings::majorVersion, proxygen::SPDYVersionSettings::minorVersion, and versionSettings_.
Referenced by TEST().
|
overridevirtual |
Returns true iff this codec supports per stream flow control
Reimplemented from proxygen::HTTPParallelCodec.
Definition at line 210 of file SPDYCodec.cpp.
References proxygen::SPDYVersionSettings::majorVersion, and versionSettings_.
|
private |
Definition at line 341 of file SPDYCodec.h.
|
private |
Definition at line 375 of file SPDYCodec.h.
Referenced by parseIngress().
|
private |
Definition at line 355 of file SPDYCodec.h.
Referenced by failSession(), failStream(), and onIngress().
|
private |
Definition at line 348 of file SPDYCodec.h.
Referenced by generateSettings(), and onSynStream().
|
private |
Definition at line 366 of file SPDYCodec.h.
Referenced by failStream(), generateRstStream(), onSettings(), onSynCommon(), onSynStream(), and parseIngress().
|
private |
Referenced by parseIngress().
|
private |
Definition at line 377 of file SPDYCodec.h.
Referenced by decodeHeaders(), encodeHeaders(), onControlFrame(), setMaxUncompressedHeaders(), and SPDYCodec().
|
private |
|
private |
Definition at line 363 of file SPDYCodec.h.
Referenced by checkLength(), checkMinLength(), decodeHeaders(), onControlFrame(), and parseIngress().
|
private |
Definition at line 361 of file SPDYCodec.h.
Referenced by parseIngress(), and setMaxFrameLength().
|
private |
Definition at line 357 of file SPDYCodec.h.
Referenced by generatePingRequest(), onPing(), and SPDYCodec().
|
static |
Definition at line 38 of file SPDYCodec.h.
Referenced by generatePushPromise(), generateSynStream(), generateWindowUpdate(), onSynReply(), and onSynStream().
|
private |
Definition at line 353 of file SPDYCodec.h.
Referenced by failStream(), and parseHeaders().
|
private |
Definition at line 362 of file SPDYCodec.h.
Referenced by decodeHeaders(), failStream(), generateRstStream(), onControlFrame(), onRstStream(), onSynReply(), onSynStream(), onWindowUpdate(), and parseIngress().
|
private |
Definition at line 365 of file SPDYCodec.h.
Referenced by decodeHeaders(), onControlFrame(), parseHeaders(), and parseIngress().
|
private |
Definition at line 354 of file SPDYCodec.h.
Referenced by getUserAgent(), and onSynCommon().
|
private |
Definition at line 364 of file SPDYCodec.h.
Referenced by onControlFrame(), onSettings(), onSynCommon(), parseHeaders(), and parseIngress().
|
private |
Definition at line 342 of file SPDYCodec.h.
Referenced by encodeHeaders(), generateGoaway(), generatePingCommon(), generateRstStream(), generateSettings(), generateSynReply(), generateSynStream(), generateWindowUpdate(), getMinorVersion(), getProtocol(), getVersion(), isSPDYReserved(), onControlFrame(), onSynCommon(), parseIngress(), rstStatusSupported(), serializeRequestHeaders(), SPDYCodec(), supportsSessionFlowControl(), and supportsStreamFlowControl().