proxygen
|
#include <HTTP1xCodec.h>
Static Public Member Functions | |
static bool | supportsNextProtocol (const std::string &npn) |
Private Member Functions | |
std::string | generateWebsocketKey () const |
std::string | generateWebsocketAccept (const std::string &acceptKey) const |
void | addDateHeader (folly::IOBufQueue &writeBuf, size_t &len) |
bool | isParsingHeaders () const |
bool | isParsingHeaderOrTrailerName () const |
void | onParserError (const char *what=nullptr) |
void | pushHeaderNameAndValue (HTTPHeaders &hdrs) |
void | serializeWebsocketHeader (folly::IOBufQueue &writeBuf, size_t &len, bool upstream) |
int | onMessageBegin () |
int | onURL (const char *buf, size_t len) |
int | onReason (const char *buf, size_t len) |
int | onHeaderField (const char *buf, size_t len) |
int | onHeaderValue (const char *buf, size_t len) |
int | onHeadersComplete (size_t len) |
int | onBody (const char *buf, size_t len) |
int | onChunkHeader (size_t len) |
int | onChunkComplete () |
int | onMessageComplete () |
Static Private Member Functions | |
static int | onMessageBeginCB (http_parser *parser) |
static int | onPathCB (http_parser *parser, const char *buf, size_t len) |
static int | onQueryStringCB (http_parser *parser, const char *buf, size_t len) |
static int | onUrlCB (http_parser *parser, const char *buf, size_t len) |
static int | onReasonCB (http_parser *parser, const char *buf, size_t len) |
static int | onHeaderFieldCB (http_parser *parser, const char *buf, size_t len) |
static int | onHeaderValueCB (http_parser *parser, const char *buf, size_t len) |
static int | onHeadersCompleteCB (http_parser *parser, const char *buf, size_t len) |
static int | onBodyCB (http_parser *parser, const char *buf, size_t len) |
static int | onChunkHeaderCB (http_parser *parser) |
static int | onChunkCompleteCB (http_parser *parser) |
static int | onMessageCompleteCB (http_parser *parser) |
static const http_parser_settings * | getParserSettings () |
Additional Inherited Members | |
Public Types inherited from proxygen::HTTPCodec | |
using | StreamID = uint64_t |
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 |
Definition at line 21 of file HTTP1xCodec.h.
|
strongprivate |
Simple state model used to track the parsing of HTTP headers
Enumerator | |
---|---|
kParsingHeaderIdle | |
kParsingHeaderStart | |
kParsingHeaderName | |
kParsingHeaderValue | |
kParsingHeadersComplete | |
kParsingTrailerName | |
kParsingTrailerValue |
Definition at line 91 of file HTTP1xCodec.h.
|
strongprivate |
Used to keep track of whether a client requested keep-alive. This is only useful to support HTTP 1.0 keep-alive for a downstream connection where keep-alive is disabled unless the client requested it.
Enumerator | |
---|---|
UNSET | |
ENABLED | |
DISABLED |
Definition at line 108 of file HTTP1xCodec.h.
|
explicit |
Definition at line 81 of file HTTP1xCodec.cpp.
References http_parser::data, proxygen::DOWNSTREAM, http_parser_init(), HTTP_REQUEST, HTTP_RESPONSE, parser_, and proxygen::UPSTREAM.
|
override |
Definition at line 125 of file HTTP1xCodec.cpp.
|
private |
Definition at line 306 of file HTTP1xCodec.cpp.
References appendLiteral, and proxygen::HTTPMessage::formatDateHeader().
Referenced by generateHeader().
|
inlineoverridevirtual |
Checks whether the socket needs to be closed when EOM is sent. This is used during CONNECT when EOF needs to be sent after upgrade to notify the server
Implements proxygen::HTTPCodec.
Definition at line 49 of file HTTP1xCodec.h.
References egressUpgrade_.
|
overridevirtual |
Reserve a stream ID.
Implements proxygen::HTTPCodec.
Definition at line 132 of file HTTP1xCodec.cpp.
References proxygen::DOWNSTREAM, egressTxnID_, ingressTxnID_, and transportDirection_.
Referenced by getTransportDirection(), TEST(), and TEST_P().
|
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 657 of file HTTP1xCodec.cpp.
References folly::IOBufQueue::append(), folly::IOBuf::computeChainDataLength(), egressChunked_, egressTxnID_, generateEOM(), inChunk_, and folly::gen::move.
Referenced by supportsPushTransactions(), and TEST().
|
overridevirtual |
Write a body chunk header, if relevant.
Implements proxygen::HTTPCodec.
Definition at line 697 of file HTTP1xCodec.cpp.
References folly::IOBufQueue::append(), egressChunked_, and inChunk_.
Referenced by supportsPushTransactions().
|
overridevirtual |
Write a body chunk terminator, if relevant.
Implements proxygen::HTTPCodec.
Definition at line 721 of file HTTP1xCodec.cpp.
References folly::IOBufQueue::append(), egressChunked_, and inChunk_.
Referenced by supportsPushTransactions().
|
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 752 of file HTTP1xCodec.cpp.
References appendLiteral, proxygen::DOWNSTREAM, egressChunked_, egressTxnID_, headRequest_, inChunk_, lastChunkWritten_, requestPending_, responsePending_, transportDirection_, and proxygen::UPSTREAM.
Referenced by generateBody(), generateHeader(), supportsPushTransactions(), and TEST().
|
overridevirtual |
Generate any protocol framing needed to abort a connection.
Implements proxygen::HTTPCodec.
Definition at line 791 of file HTTP1xCodec.cpp.
References disableKeepalivePending_.
Referenced by supportsPushTransactions().
|
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 364 of file HTTP1xCodec.cpp.
References addDateHeader(), appendLiteral, proxygen::caseInsensitiveEqual(), wangle::HTTPHeaderSize::compressed, proxygen::CONNECT, connectRequest_, disableKeepalivePending_, proxygen::DOWNSTREAM, egressChunked_, egressTxnID_, egressUpgrade_, ENABLED, proxygen::ERROR, expectNoResponseBody_, forceUpstream1_1_, proxygen::HTTPHeaders::forEachWithCode(), generateEOM(), proxygen::GET, proxygen::HTTPMessage::getDefaultReason(), proxygen::HTTPMessage::getHeaders(), proxygen::HTTPMessage::getHTTPVersion(), proxygen::HTTPMessage::getIsChunked(), proxygen::HTTPMessage::getMethod(), proxygen::HTTPMessage::getMethodString(), proxygen::HTTPMessage::getStatusCode(), proxygen::HTTPMessage::getStatusMessage(), proxygen::HTTPMessage::getURL(), proxygen::HEAD, headRequest_, proxygen::HTTP_HEADER_CONNECTION, proxygen::HTTP_HEADER_CONTENT_LENGTH, proxygen::HTTP_HEADER_DATE, proxygen::HTTP_HEADER_SEC_WEBSOCKET_ACCEPT, proxygen::HTTP_HEADER_SEC_WEBSOCKET_KEY, proxygen::HTTP_HEADER_TRANSFER_ENCODING, proxygen::HTTP_HEADER_UPGRADE, http_parser::http_major, http_parser::http_minor, ingressTxnID_, ingressUpgrade_, proxygen::HTTPMessage::is1xxResponse(), is1xxResponse_, proxygen::HTTPMessage::isEgressWebsocketUpgrade(), folly::join(), keepalive_, keepaliveRequested_, proxygen::HTTPMessage::kHTTPVersion10, proxygen::HTTPMessage::kHTTPVersion11, lastChunkWritten_, max, mayChunkEgress_, proxygen::methodToString(), parser_, proxygen::POST, folly::IOBufQueue::postallocate(), folly::IOBufQueue::preallocate(), requestPending_, proxygen::RFC2616::responseBodyMustBeEmpty(), responsePending_, serializeWebsocketHeader(), folly::split(), statusCode, transportDirection_, folly::trimWhitespace(), wangle::HTTPHeaderSize::uncompressed, upgradeHeader_, proxygen::UPSTREAM, value, version, and proxygen::HTTPMessage::wantsKeepalive().
Referenced by supportsPushTransactions(), TEST(), and TEST_P().
|
overridevirtual |
Generate any protocol framing needed to abort a stream.
Implements proxygen::HTTPCodec.
Definition at line 782 of file HTTP1xCodec.cpp.
References disableKeepalivePending_.
Referenced by supportsPushTransactions().
|
overridevirtual |
Write the message trailers
Implements proxygen::HTTPCodec.
Definition at line 733 of file HTTP1xCodec.cpp.
References appendLiteral, egressChunked_, egressTxnID_, proxygen::HTTPHeaders::forEach(), inChunk_, and lastChunkWritten_.
Referenced by supportsPushTransactions(), and TEST().
|
private |
Definition at line 326 of file HTTP1xCodec.cpp.
References folly::netops::accept(), proxygen::Base64::encode(), folly::ssl::OpenSSLHash::Digest::hash_final(), folly::ssl::OpenSSLHash::Digest::hash_init(), folly::ssl::OpenSSLHash::Digest::hash_update(), and proxygen::kWSMagicString.
Referenced by onHeadersComplete(), and serializeWebsocketHeader().
|
private |
Definition at line 319 of file HTTP1xCodec.cpp.
References proxygen::Base64::encode(), folly::Random::secureRandom(), and string.
Referenced by serializeWebsocketHeader().
const std::string & proxygen::HTTP1xCodec::getAllowedUpgradeProtocols | ( | ) |
Definition at line 812 of file HTTP1xCodec.cpp.
References allowedNativeUpgrades_.
Referenced by supportsPushTransactions(), and TEST().
|
staticprivate |
Definition at line 158 of file HTTP1xCodec.cpp.
References http_parser_settings::on_body, http_parser_settings::on_chunk_complete, http_parser_settings::on_chunk_header, http_parser_settings::on_header_field, http_parser_settings::on_header_value, http_parser_settings::on_headers_complete, http_parser_settings::on_message_begin, http_parser_settings::on_message_complete, http_parser_settings::on_reason, http_parser_settings::on_url, onBodyCB(), onChunkCompleteCB(), onChunkHeaderCB(), onHeaderFieldCB(), onHeadersCompleteCB(), onHeaderValueCB(), onMessageBeginCB(), onMessageCompleteCB(), onReasonCB(), and onUrlCB().
Referenced by onIngress(), and onIngressEOF().
|
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 28 of file HTTP1xCodec.h.
References proxygen::HTTP_1_1.
Referenced by TEST().
|
inlineoverridevirtual |
Get the transport direction of this codec: DOWNSTREAM if the codec receives requests from clients or UPSTREAM if the codec sends requests to servers.
Implements proxygen::HTTPCodec.
Definition at line 36 of file HTTP1xCodec.h.
References createStream(), and transportDirection_.
|
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 32 of file HTTP1xCodec.h.
References userAgent_.
|
overridevirtual |
Check whether the codec still has at least one HTTP stream to parse.
Implements proxygen::HTTPCodec.
Definition at line 301 of file HTTP1xCodec.cpp.
References requestPending_, and responsePending_.
Referenced by setCallback().
|
inlineprivate |
Check whether we're currently parsing ingress header-or-trailer name
Definition at line 123 of file HTTP1xCodec.h.
References headerParseState_, kParsingHeaderName, kParsingTrailerName, onBody(), onChunkComplete(), onChunkHeader(), onHeaderField(), onHeadersComplete(), onHeaderValue(), onMessageBegin(), onMessageComplete(), onParserError(), onReason(), onURL(), pushHeaderNameAndValue(), and serializeWebsocketHeader().
Referenced by onHeaderField().
|
inlineprivate |
Check whether we're currently parsing ingress message headers
Definition at line 117 of file HTTP1xCodec.h.
References headerParseState_, kParsingHeaderIdle, and kParsingHeadersComplete.
Referenced by onBody(), onHeaderValue(), and onMessageComplete().
|
overridevirtual |
Check whether the codec can process new streams. Typically, an implementing subclass will return true when a new codec is created and false once it encounters a situation that would prevent reuse of the underlying transport (e.g., a "Connection: close" in HTTP/1.x).
Implements proxygen::HTTPCodec.
Definition at line 295 of file HTTP1xCodec.cpp.
References egressUpgrade_, ingressUpgrade_, keepalive_, parserError_, and websockAcceptKey_.
Referenced by setCallback().
|
inlineoverridevirtual |
Returns true if this codec is in a state where it accepting new requests but will soon begin to reject new requests. For SPDY and HTTP/2, this is true when the first GOAWAY NO_ERROR is sent during graceful shutdown.
Implements proxygen::HTTPCodec.
Definition at line 46 of file HTTP1xCodec.h.
|
private |
Definition at line 1144 of file HTTP1xCodec.cpp.
References callback_, folly::IOBuf::cloneOne(), currentIngressBuf_, folly::IOBuf::data(), ingressTxnID_, inRecvLastChunk_, isParsingHeaders(), folly::IOBuf::length(), folly::gen::move, and proxygen::HTTPCodec::Callback::onBody().
Referenced by isParsingHeaderOrTrailerName(), and onBodyCB().
|
staticprivate |
Definition at line 1321 of file HTTP1xCodec.cpp.
References codec, http_parser::data, onBody(), onParserError(), and parser_.
Referenced by getParserSettings().
|
private |
Definition at line 1171 of file HTTP1xCodec.cpp.
References callback_, ingressTxnID_, inRecvLastChunk_, and proxygen::HTTPCodec::Callback::onChunkComplete().
Referenced by isParsingHeaderOrTrailerName(), and onChunkCompleteCB().
|
staticprivate |
Definition at line 1353 of file HTTP1xCodec.cpp.
References codec, http_parser::data, onChunkComplete(), onParserError(), and parser_.
Referenced by getParserSettings().
|
private |
Definition at line 1160 of file HTTP1xCodec.cpp.
References callback_, ingressTxnID_, inRecvLastChunk_, and proxygen::HTTPCodec::Callback::onChunkHeader().
Referenced by isParsingHeaderOrTrailerName(), and onChunkHeaderCB().
|
staticprivate |
Definition at line 1340 of file HTTP1xCodec.cpp.
References codec, http_parser::content_length, http_parser::data, onChunkHeader(), onParserError(), and parser_.
Referenced by getParserSettings().
|
private |
Definition at line 866 of file HTTP1xCodec.cpp.
References folly::Range< Iter >::advance(), folly::Range< Iter >::begin(), currentHeaderName_, currentHeaderNameStringPiece_, folly::Range< Iter >::end(), headerParseState_, isParsingHeaderOrTrailerName(), kParsingHeaderName, kParsingHeadersComplete, kParsingHeaderValue, kParsingTrailerName, kParsingTrailerValue, msg_, pushHeaderNameAndValue(), folly::Range< Iter >::reset(), folly::Range< Iter >::size(), and trailers_.
Referenced by isParsingHeaderOrTrailerName(), and onHeaderFieldCB().
|
staticprivate |
Definition at line 1278 of file HTTP1xCodec.cpp.
References codec, http_parser::data, onHeaderField(), onParserError(), and parser_.
Referenced by getParserSettings().
|
private |
Definition at line 926 of file HTTP1xCodec.cpp.
References folly::netops::accept(), allowedNativeUpgrades_, callback_, proxygen::caseInsensitiveEqual(), proxygen::checkForProtocolUpgrade(), proxygen::CONNECT, connectRequest_, DISABLED, proxygen::DOWNSTREAM, egressUpgrade_, ENABLED, proxygen::ERROR, folly::pushmi::operators::error(), expectNoResponseBody_, F_CHUNKED, F_UPGRADE, http_parser::flags, g(), generateWebsocketAccept(), proxygen::getCodecProtocolString(), proxygen::ParseURL::hasHost(), folly::Optional< Value >::hasValue(), proxygen::HEAD, headerParseState_, headersComplete_, headerSize_, headRequest_, proxygen::ParseURL::hostAndPort(), proxygen::HTTP_1_1, proxygen::HTTP_HEADER_CONTENT_LENGTH, proxygen::HTTP_HEADER_HOST, proxygen::HTTP_HEADER_SEC_WEBSOCKET_ACCEPT, proxygen::HTTP_HEADER_SEC_WEBSOCKET_KEY, proxygen::HTTP_HEADER_TRANSFER_ENCODING, proxygen::HTTP_HEADER_UPGRADE, proxygen::HTTP_HEADER_USER_AGENT, http_parser::http_major, http_method_str(), http_parser::http_minor, ingressTxnID_, ingressUpgrade_, is1xxResponse_, keepalive_, keepaliveRequested_, kParsingHeadersComplete, kParsingHeaderValue, folly::makeGuard(), mayChunkEgress_, http_parser::method, folly::gen::move, msg_, nativeUpgrade_, proxygen::HTTPCodec::Callback::onHeadersComplete(), proxygen::HTTPCodec::Callback::onNativeProtocolUpgrade(), parser_, pushHeaderNameAndValue(), reason_, proxygen::RFC2616::responseBodyMustBeEmpty(), http_parser::status_code, string, transportDirection_, wangle::HTTPHeaderSize::uncompressed, UNSET, http_parser::upgrade, upgradeHeader_, upgradeRequest_, upgradeResult_, proxygen::UPSTREAM, url_, userAgent_, value, folly::Optional< Value >::value(), and websockAcceptKey_.
Referenced by isParsingHeaderOrTrailerName(), onHeadersCompleteCB(), and onIngress().
|
staticprivate |
Definition at line 1305 of file HTTP1xCodec.cpp.
References codec, http_parser::data, onHeadersComplete(), onParserError(), and parser_.
Referenced by getParserSettings().
|
private |
Definition at line 915 of file HTTP1xCodec.cpp.
References currentHeaderValue_, headerParseState_, isParsingHeaders(), kParsingHeaderValue, and kParsingTrailerValue.
Referenced by isParsingHeaderOrTrailerName(), and onHeaderValueCB().
|
staticprivate |
Definition at line 1292 of file HTTP1xCodec.cpp.
References codec, http_parser::data, onHeaderValue(), onParserError(), and parser_.
Referenced by getParserSettings().
|
overridevirtual |
Parse ingress data.
buf | A single IOBuf of data to parse |
Implements proxygen::HTTPCodec.
Definition at line 177 of file HTTP1xCodec.cpp.
References folly::Range< Iter >::begin(), callback_, folly::IOBuf::clone(), folly::IOBuf::computeChainDataLength(), currentHeaderName_, currentHeaderNameStringPiece_, currentIngressBuf_, folly::IOBuf::data(), folly::Range< Iter >::empty(), getParserSettings(), headersComplete_, headerSize_, HPE_OK, HPE_PAUSED, http_parser::http_major, http_parser::http_minor, HTTP_PARSER_ERRNO, http_parser_execute(), ingressTxnID_, ingressUpgradeComplete_, folly::IOBuf::length(), msg_, proxygen::HTTPCodec::Callback::onBody(), onHeadersComplete(), onIngressEOF(), onMessageBegin(), onParserError(), parser_, parserActive_, parserError_, pendingEOF_, folly::Range< Iter >::size(), transportDirection_, wangle::HTTPHeaderSize::uncompressed, and proxygen::UPSTREAM.
Referenced by setCallback(), TEST(), and TEST_P().
|
overridevirtual |
Finish parsing when the ingress stream has ended.
Implements proxygen::HTTPCodec.
Definition at line 231 of file HTTP1xCodec.cpp.
References callback_, getParserSettings(), HPE_OK, HPE_PAUSED, HTTP_PARSER_ERRNO, http_parser_execute(), ingressTxnID_, ingressUpgradeComplete_, proxygen::HTTPCodec::Callback::onMessageComplete(), onParserError(), parser_, parserActive_, parserError_, and pendingEOF_.
Referenced by onIngress(), setCallback(), and TEST().
|
private |
Definition at line 817 of file HTTP1xCodec.cpp.
References callback_, proxygen::DOWNSTREAM, headerParseState_, headersComplete_, headerSize_, ingressTxnID_, is1xxResponse_, kParsingHeaderStart, msg_, proxygen::HTTPCodec::Callback::onMessageBegin(), requestPending_, responsePending_, trailers_, transportDirection_, wangle::HTTPHeaderSize::uncompressed, and proxygen::UPSTREAM.
Referenced by isParsingHeaderOrTrailerName(), onIngress(), and onMessageBeginCB().
|
staticprivate |
Definition at line 1236 of file HTTP1xCodec.cpp.
References codec, http_parser::data, onMessageBegin(), onParserError(), and parser_.
Referenced by getParserSettings().
|
private |
Definition at line 1180 of file HTTP1xCodec.cpp.
References callback_, proxygen::DOWNSTREAM, headerParseState_, ingressTxnID_, ingressUpgrade_, ingressUpgradeComplete_, inRecvLastChunk_, is1xxResponse_, isParsingHeaders(), kParsingHeaderIdle, kParsingTrailerValue, folly::gen::move, nativeUpgrade_, proxygen::HTTPCodec::Callback::onMessageComplete(), proxygen::HTTPCodec::Callback::onNativeProtocolUpgrade(), proxygen::HTTPCodec::Callback::onTrailersComplete(), pushHeaderNameAndValue(), requestPending_, responsePending_, setParserPaused(), trailers_, transportDirection_, upgradeRequest_, upgradeResult_, and proxygen::UPSTREAM.
Referenced by isParsingHeaderOrTrailerName(), and onMessageCompleteCB().
|
staticprivate |
Definition at line 1367 of file HTTP1xCodec.cpp.
References codec, http_parser::data, onMessageComplete(), onParserError(), and parser_.
Referenced by getParserSettings().
|
private |
Invoked when a parsing error occurs. It will send an exception to the callback object to report the error and do any other cleanup needed. It optionally takes a message to pass to the generated HTTPException passed to callback_.
Definition at line 257 of file HTTP1xCodec.cpp.
References callback_, folly::IOBuf::cloneOne(), currentIngressBuf_, proxygen::DOWNSTREAM, egressTxnID_, folly::pushmi::operators::error(), HPE_HEADER_OVERFLOW, HPE_HUGE_CHUNK_SIZE, HPE_HUGE_CONTENT_LENGTH, HPE_INVALID_CHUNK_SIZE, HPE_INVALID_CONSTANT, HPE_INVALID_EOF_STATE, HPE_INVALID_VERSION, http_errno_description(), HTTP_PARSER_ERRNO, proxygen::HTTPException::INGRESS, ingressTxnID_, inRecvLastChunk_, proxygen::kErrorEOF, proxygen::kErrorParseBody, proxygen::kErrorParseHeader, proxygen::kErrorUnknown, folly::gen::move, msg_, proxygen::HTTPCodec::Callback::onError(), parser_, proxygen::HTTPException::setCurrentIngressBuf(), proxygen::HTTPException::setHttpStatusCode(), proxygen::HTTPException::setPartialMsg(), proxygen::Exception::setProxygenError(), and transportDirection_.
Referenced by isParsingHeaderOrTrailerName(), onBodyCB(), onChunkCompleteCB(), onChunkHeaderCB(), onHeaderFieldCB(), onHeadersCompleteCB(), onHeaderValueCB(), onIngress(), onIngressEOF(), onMessageBeginCB(), onMessageCompleteCB(), onReasonCB(), and onUrlCB().
|
staticprivate |
|
staticprivate |
|
private |
Definition at line 846 of file HTTP1xCodec.cpp.
References reason_.
Referenced by isParsingHeaderOrTrailerName(), and onReasonCB().
|
staticprivate |
Definition at line 1264 of file HTTP1xCodec.cpp.
References codec, http_parser::data, onParserError(), onReason(), and parser_.
Referenced by getParserSettings().
|
private |
Definition at line 840 of file HTTP1xCodec.cpp.
References url_.
Referenced by isParsingHeaderOrTrailerName(), and onUrlCB().
|
staticprivate |
Definition at line 1250 of file HTTP1xCodec.cpp.
References codec, http_parser::data, onParserError(), onURL(), and parser_.
Referenced by getParserSettings().
|
private |
Push out header name-value pair to hdrs and clear currentHeader*_
Definition at line 851 of file HTTP1xCodec.cpp.
References proxygen::HTTPHeaders::add(), proxygen::HTTPHeaders::addFromCodec(), folly::Range< Iter >::begin(), folly::Range< Iter >::clear(), currentHeaderName_, currentHeaderNameStringPiece_, currentHeaderValue_, LIKELY, folly::gen::move, and folly::Range< Iter >::size().
Referenced by isParsingHeaderOrTrailerName(), onHeaderField(), onHeadersComplete(), and onMessageComplete().
|
private |
Serialize websocket headers into a buffer
Definition at line 337 of file HTTP1xCodec.cpp.
References appendLiteral, generateWebsocketAccept(), generateWebsocketKey(), upgradeHeader_, and websockAcceptKey_.
Referenced by generateHeader(), and isParsingHeaderOrTrailerName().
void proxygen::HTTP1xCodec::setAllowedUpgradeProtocols | ( | std::list< std::string > | protocols | ) |
Definition at line 802 of file HTTP1xCodec.cpp.
References allowedNativeUpgrades_, proxygen::DOWNSTREAM, and transportDirection_.
Referenced by supportsPushTransactions().
|
inlineoverridevirtual |
Set the callback to notify on ingress events
callback | The callback object |
Implements proxygen::HTTPCodec.
Definition at line 40 of file HTTP1xCodec.h.
References callback_, isBusy(), isReusable(), onIngress(), onIngressEOF(), and setParserPaused().
Referenced by proxygen::RFC1867Codec::RFC1867Codec(), TEST(), and TEST_P().
|
overridevirtual |
Pause or resume the ingress parser
paused | Whether the caller wants the parser to be paused |
Implements proxygen::HTTPCodec.
Definition at line 141 of file HTTP1xCodec.cpp.
References HPE_OK, HPE_PAUSED, HTTP_PARSER_ERRNO, http_parser_pause(), parser_, parserError_, and parserPaused_.
Referenced by proxygen::RFC1867Codec::onBody(), proxygen::RFC1867Codec::onError(), proxygen::RFC1867Codec::onMessageComplete(), onMessageComplete(), proxygen::RFC1867Codec::onTrailersComplete(), setCallback(), and TEST().
|
static |
Definition at line 1380 of file HTTP1xCodec.cpp.
Referenced by proxygen::DefaultHTTPCodecFactory::getCodec(), proxygen::HTTPDefaultSessionCodecFactory::getCodec(), and supportsPushTransactions().
|
inlineoverridevirtual |
Check whether the codec supports the processing of multiple requests in parallel.
Implements proxygen::HTTPCodec.
Definition at line 50 of file HTTP1xCodec.h.
|
inlineoverridevirtual |
Check whether the codec supports pushing resources from server to client.
Implements proxygen::HTTPCodec.
Definition at line 51 of file HTTP1xCodec.h.
References generateBody(), generateChunkHeader(), generateChunkTerminator(), generateEOM(), generateGoaway(), generateHeader(), generateRstStream(), generateTrailers(), getAllowedUpgradeProtocols(), setAllowedUpgradeProtocols(), folly::size(), statusCode, string, supportsNextProtocol(), and fizz::detail::writeBuf().
|
private |
Definition at line 168 of file HTTP1xCodec.h.
Referenced by getAllowedUpgradeProtocols(), onHeadersComplete(), and setAllowedUpgradeProtocols().
|
private |
Definition at line 153 of file HTTP1xCodec.h.
Referenced by onBody(), onChunkComplete(), onChunkHeader(), onHeadersComplete(), onIngress(), onIngressEOF(), onMessageBegin(), onMessageComplete(), onParserError(), and setCallback().
|
private |
Definition at line 187 of file HTTP1xCodec.h.
Referenced by generateHeader(), and onHeadersComplete().
|
private |
Definition at line 161 of file HTTP1xCodec.h.
Referenced by onHeaderField(), onIngress(), and pushHeaderNameAndValue().
|
private |
Definition at line 162 of file HTTP1xCodec.h.
Referenced by onHeaderField(), onIngress(), and pushHeaderNameAndValue().
|
private |
Definition at line 163 of file HTTP1xCodec.h.
Referenced by onHeaderValue(), and pushHeaderNameAndValue().
|
private |
Definition at line 157 of file HTTP1xCodec.h.
Referenced by onBody(), onIngress(), and onParserError().
|
private |
Definition at line 185 of file HTTP1xCodec.h.
Referenced by generateGoaway(), generateHeader(), and generateRstStream().
|
private |
Definition at line 181 of file HTTP1xCodec.h.
Referenced by generateBody(), generateChunkHeader(), generateChunkTerminator(), generateEOM(), generateHeader(), and generateTrailers().
|
private |
Definition at line 155 of file HTTP1xCodec.h.
Referenced by createStream(), generateBody(), generateEOM(), generateHeader(), generateTrailers(), and onParserError().
|
private |
Definition at line 195 of file HTTP1xCodec.h.
Referenced by closeOnEgressComplete(), generateHeader(), isReusable(), and onHeadersComplete().
|
private |
Definition at line 189 of file HTTP1xCodec.h.
Referenced by generateHeader(), and onHeadersComplete().
|
private |
Definition at line 174 of file HTTP1xCodec.h.
Referenced by generateHeader().
|
private |
Definition at line 170 of file HTTP1xCodec.h.
Referenced by isParsingHeaderOrTrailerName(), isParsingHeaders(), onHeaderField(), onHeadersComplete(), onHeaderValue(), onMessageBegin(), and onMessageComplete().
|
private |
Definition at line 197 of file HTTP1xCodec.h.
Referenced by onHeadersComplete(), onIngress(), and onMessageBegin().
|
private |
Definition at line 169 of file HTTP1xCodec.h.
Referenced by onHeadersComplete(), onIngress(), and onMessageBegin().
|
private |
Definition at line 188 of file HTTP1xCodec.h.
Referenced by generateEOM(), generateHeader(), and onHeadersComplete().
|
private |
Definition at line 182 of file HTTP1xCodec.h.
Referenced by generateBody(), generateChunkHeader(), generateChunkTerminator(), generateEOM(), and generateTrailers().
|
private |
Definition at line 154 of file HTTP1xCodec.h.
Referenced by createStream(), generateHeader(), onBody(), onChunkComplete(), onChunkHeader(), onHeadersComplete(), onIngress(), onIngressEOF(), onMessageBegin(), onMessageComplete(), and onParserError().
|
private |
Definition at line 193 of file HTTP1xCodec.h.
Referenced by generateHeader(), isReusable(), onHeadersComplete(), and onMessageComplete().
|
private |
Definition at line 194 of file HTTP1xCodec.h.
Referenced by onIngress(), onIngressEOF(), and onMessageComplete().
|
private |
Definition at line 192 of file HTTP1xCodec.h.
Referenced by onBody(), onChunkComplete(), onChunkHeader(), onMessageComplete(), and onParserError().
|
private |
Definition at line 191 of file HTTP1xCodec.h.
Referenced by generateHeader(), onHeadersComplete(), onMessageBegin(), and onMessageComplete().
|
private |
Definition at line 184 of file HTTP1xCodec.h.
Referenced by generateHeader(), isReusable(), and onHeadersComplete().
|
private |
Definition at line 172 of file HTTP1xCodec.h.
Referenced by generateHeader(), and onHeadersComplete().
|
private |
Definition at line 183 of file HTTP1xCodec.h.
Referenced by generateEOM(), generateHeader(), and generateTrailers().
|
private |
Definition at line 190 of file HTTP1xCodec.h.
Referenced by generateHeader(), and onHeadersComplete().
|
private |
Definition at line 158 of file HTTP1xCodec.h.
Referenced by onHeaderField(), onHeadersComplete(), onIngress(), onMessageBegin(), and onParserError().
|
private |
Definition at line 196 of file HTTP1xCodec.h.
Referenced by onHeadersComplete(), and onMessageComplete().
|
private |
Definition at line 156 of file HTTP1xCodec.h.
Referenced by generateHeader(), HTTP1xCodec(), onBodyCB(), onChunkCompleteCB(), onChunkHeaderCB(), onHeaderFieldCB(), onHeadersComplete(), onHeadersCompleteCB(), onHeaderValueCB(), onIngress(), onIngressEOF(), onMessageBeginCB(), onMessageCompleteCB(), onParserError(), onReasonCB(), onUrlCB(), and setParserPaused().
|
private |
Definition at line 175 of file HTTP1xCodec.h.
Referenced by onIngress(), and onIngressEOF().
|
private |
Definition at line 178 of file HTTP1xCodec.h.
Referenced by isReusable(), onIngress(), onIngressEOF(), and setParserPaused().
|
private |
Definition at line 177 of file HTTP1xCodec.h.
Referenced by setParserPaused().
|
private |
Definition at line 176 of file HTTP1xCodec.h.
Referenced by onIngress(), and onIngressEOF().
|
private |
Definition at line 166 of file HTTP1xCodec.h.
Referenced by onHeadersComplete(), and onReason().
|
private |
Definition at line 179 of file HTTP1xCodec.h.
Referenced by generateEOM(), generateHeader(), isBusy(), onMessageBegin(), and onMessageComplete().
|
private |
Definition at line 180 of file HTTP1xCodec.h.
Referenced by generateEOM(), generateHeader(), isBusy(), onMessageBegin(), and onMessageComplete().
|
private |
Definition at line 160 of file HTTP1xCodec.h.
Referenced by onHeaderField(), onMessageBegin(), and onMessageComplete().
|
private |
Definition at line 171 of file HTTP1xCodec.h.
Referenced by createStream(), generateEOM(), generateHeader(), getTransportDirection(), onHeadersComplete(), onIngress(), onMessageBegin(), onMessageComplete(), onParserError(), and setAllowedUpgradeProtocols().
|
private |
Definition at line 167 of file HTTP1xCodec.h.
Referenced by generateHeader(), onHeadersComplete(), and serializeWebsocketHeader().
|
private |
Definition at line 159 of file HTTP1xCodec.h.
Referenced by onHeadersComplete(), and onMessageComplete().
|
private |
Definition at line 173 of file HTTP1xCodec.h.
Referenced by onHeadersComplete(), and onMessageComplete().
|
private |
Definition at line 164 of file HTTP1xCodec.h.
Referenced by onHeadersComplete(), and onURL().
|
private |
Definition at line 165 of file HTTP1xCodec.h.
Referenced by getUserAgent(), and onHeadersComplete().
|
mutableprivate |
Definition at line 103 of file HTTP1xCodec.h.
Referenced by isReusable(), onHeadersComplete(), and serializeWebsocketHeader().