proxygen
|
#include <HTTPTransaction.h>
Classes | |
struct | Chunk |
class | PrioritySample |
struct | PrioritySampleSummary |
class | RateLimitCallback |
class | Transport |
Public Types | |
using | Handler = HTTPTransactionHandler |
using | PushHandler = HTTPPushTransactionHandler |
using | TransportCallback = HTTPTransactionTransportCallback |
Static Private Attributes | |
static uint64_t | egressBufferLimit_ |
Additional Inherited Members | |
![]() | |
virtual std::chrono::steady_clock::time_point | getCurTime () |
![]() | |
DelayedDestructionBase () | |
uint32_t | getDestructorGuardCount () const |
Definition at line 324 of file HTTPTransaction.h.
Definition at line 328 of file HTTPTransaction.h.
Definition at line 329 of file HTTPTransaction.h.
Definition at line 433 of file HTTPTransaction.h.
proxygen::HTTPTransaction::HTTPTransaction | ( | TransportDirection | direction, |
HTTPCodec::StreamID | id, | ||
uint32_t | seqNo, | ||
Transport & | transport, | ||
HTTP2PriorityQueueBase & | egressQueue, | ||
folly::HHWheelTimer * | timer = nullptr , |
||
const folly::Optional< std::chrono::milliseconds > & | defaultTimeout = folly::Optional<std::chrono::milliseconds>() , |
||
HTTPSessionStats * | stats = nullptr , |
||
bool | useFlowControl = false , |
||
uint32_t | receiveInitialWindowSize = 0 , |
||
uint32_t | sendInitialWindowSize = 0 , |
||
http2::PriorityUpdate | priority = http2::DefaultPriority , |
||
folly::Optional< HTTPCodec::StreamID > | assocStreamId = HTTPCodec::NoStream , |
||
folly::Optional< HTTPCodec::ExAttributes > | exAttributes = HTTPCodec::NoExAttributes |
||
) |
readBufLimit and sendWindow are only used if useFlowControl is true. Furthermore, if flow control is enabled, no guarantees can be made on the borders of the L7 chunking/data frames of the outbound messages.
priority is only used by SPDY. The -1 default makes sure that all plain HTTP transactions land up in the same queue as the control data.
Definition at line 31 of file HTTPTransaction.cpp.
References proxygen::HTTP2PriorityQueueBase::addTransaction(), assocStreamId_, currentDepth_, egressQueue_, egressState_, exAttributes_, id_, ingressState_, insertDepth_, isRemoteInitiated(), isUpstream(), priorityFallback_, queueHandle_, proxygen::HTTPSessionStats::recordTransactionOpened(), refreshTimeout(), stats_, and proxygen::http2::PriorityUpdate::streamDependency.
|
override |
Definition at line 131 of file HTTPTransaction.cpp.
References folly::HHWheelTimer::Callback::cancelTimeout(), dequeue(), egressQueue_, isEnqueued(), folly::HHWheelTimer::Callback::isScheduled(), queueHandle_, proxygen::HTTPSessionStats::recordTransactionClosed(), proxygen::HTTP2PriorityQueueBase::removeTransaction(), and stats_.
|
privatedelete |
|
inlinevirtual |
Add a callback waiting for this transaction to have a transport with replay protection.
Definition at line 1176 of file HTTPTransaction.h.
References transport_.
|
inlinevirtual |
Here's the logic: 1) state machine says sendHeaders is OK AND 2a) this is an upstream (allows for mid-stream headers) OR 2b) this downstream has not sent a response 2c) this downstream has only sent 1xx responses
Definition at line 781 of file HTTPTransaction.h.
References proxygen::StateMachine< T >::canTransit().
Referenced by proxygen::RequestHandlerAdaptor::onError().
|
private |
Check if deferredIngress_ points to some queue before pushing HTTPEvent to it.
Definition at line 1257 of file HTTPTransaction.cpp.
References deferredIngress_.
Referenced by onIngressBody(), onIngressChunkComplete(), onIngressChunkHeader(), onIngressEOM(), onIngressHeadersComplete(), onIngressTrailers(), and onIngressUpgrade().
|
inline |
Definition at line 1142 of file HTTPTransaction.h.
|
inlineprivate |
Definition at line 1284 of file HTTPTransaction.h.
Referenced by markEgressComplete(), sendDeferredBody(), and ~HTTPTransaction().
void proxygen::HTTPTransaction::describe | ( | std::ostream & | os | ) | const |
Write a description of the transaction to a stream
Definition at line 1305 of file HTTPTransaction.cpp.
References proxygen::HTTPTransaction::Transport::describe(), id_, and transport_.
Referenced by proxygen::operator<<().
|
inlinevirtual |
Check whether more response is expected. One or more 1xx status responses can be received prior to the regular response. Note: 101 is handled by the codec using a separate onUpgrade callback
Definition at line 554 of file HTTPTransaction.h.
References uint32_t.
Referenced by onIngressEOM(), and proxygen::HTTPSession::onMessageComplete().
|
private |
Flushes any pending window updates. This can happen from setReceiveWindow or sendHeaders depending on transaction state.
Definition at line 1335 of file HTTPTransaction.cpp.
References direction_, proxygen::DOWNSTREAM, egressState_, proxygen::Window::getCapacity(), proxygen::Window::getSize(), ingressState_, isIngressEOMSeen(), recvToAck_, recvWindow_, proxygen::HTTPTransaction::Transport::sendWindowUpdate(), transport_, and useFlowControl_.
Referenced by processIngressBody(), sendHeadersWithOptionalEOM(), and setReceiveWindow().
|
inline |
Returns the associated transaction ID for pushed transactions, 0 otherwise
Definition at line 1048 of file HTTPTransaction.h.
Referenced by proxygen::HTTPSession::onAbort().
|
inline |
Returns the control channel transaction ID for this transaction, folly::none otherwise
Definition at line 1056 of file HTTPTransaction.h.
References proxygen::HTTPCodec::NoStream.
Referenced by onExTransaction(), proxygen::HTTPSession::onHeadersComplete(), and proxygen::HTTPDownstreamSession::setupOnHeadersComplete().
|
inline |
Definition at line 541 of file HTTPTransaction.h.
References transport_.
Referenced by proxygen::RequestHandlerAdaptor::getCurrentTransportInfo().
|
inline |
Definition at line 503 of file HTTPTransaction.h.
Referenced by proxygen::HTTPSession::onError().
|
inline |
Definition at line 1064 of file HTTPTransaction.h.
|
inline |
Get a set of exTransactions associated with this transaction.
Definition at line 1078 of file HTTPTransaction.h.
Referenced by proxygen::HTTPSession::onAbort().
|
inline |
Definition at line 484 of file HTTPTransaction.h.
Referenced by proxygen::HTTPSession::onError(), onExTransaction(), onPushedTransaction(), and proxygen::HTTPDownstreamSession::setupOnHeadersComplete().
HPACKTableInfo & proxygen::HTTPTransaction::getHPACKTableInfo | ( | ) |
|
inline |
Definition at line 469 of file HTTPTransaction.h.
Referenced by proxygen::HTTPSession::createTransaction(), proxygen::HTTPSession::newExTransaction(), proxygen::HTTPSession::newPushedTransaction(), onExTransaction(), onPushedTransaction(), proxygen::HTTPDownstreamSession::setupOnHeadersComplete(), and TEST_F().
|
inline |
Returns the transaction timeout if exists. An OptionalEmptyException is raised if the timeout isn't set.
Definition at line 1041 of file HTTPTransaction.h.
|
inline |
Definition at line 507 of file HTTPTransaction.h.
|
inline |
Definition at line 519 of file HTTPTransaction.h.
References transport_.
Referenced by TEST_F().
|
inlinenoexcept |
Definition at line 527 of file HTTPTransaction.h.
References transport_.
|
inline |
Definition at line 576 of file HTTPTransaction.h.
References folly::pushmi::operators::error(), uint16_t, and uint32_t.
Referenced by proxygen::HTTPSession::onEgressMessageFinished().
|
inline |
Definition at line 523 of file HTTPTransaction.h.
References transport_.
|
inlinenoexcept |
Definition at line 532 of file HTTPTransaction.h.
References transport_.
|
inline |
Definition at line 488 of file HTTPTransaction.h.
Referenced by TEST_F().
|
inline |
Definition at line 499 of file HTTPTransaction.h.
bool proxygen::HTTPTransaction::getPrioritySampleSummary | ( | HTTPTransaction::PrioritySampleSummary & | summary | ) | const |
Definition at line 1536 of file HTTPTransaction.cpp.
References prioritySample_.
|
inline |
Definition at line 492 of file HTTPTransaction.h.
References std::tr1::make_tuple().
|
inline |
Get a set of server-pushed transactions associated with this transaction.
Definition at line 1071 of file HTTPTransaction.h.
Referenced by proxygen::HTTPSession::onAbort().
|
inlinevirtual |
int32_t proxygen::HTTPTransaction::getRecvToAck | ( | ) | const |
|
inline |
Definition at line 471 of file HTTPTransaction.h.
Referenced by proxygen::HTTPSession::onEgressMessageFinished().
|
inline |
Definition at line 545 of file HTTPTransaction.h.
Referenced by proxygen::HTTPSession::createTransaction().
|
inlinenoexcept |
Definition at line 537 of file HTTPTransaction.h.
References transport_.
Referenced by proxygen::RequestHandlerAdaptor::getSetupTransportInfo().
|
inline |
|
inline |
|
inline |
Does this transaction have an idle timeout set?
Definition at line 1033 of file HTTPTransaction.h.
|
inline |
Definition at line 1220 of file HTTPTransaction.h.
|
inlineprivate |
Definition at line 1289 of file HTTPTransaction.h.
Referenced by sendDeferredBody().
|
inline |
HTTPTransaction will not detach until it has 0 pending byte events. If you call incrementPendingByteEvents, you must make a corresponding call to decrementPendingByteEvents or the transaction will never be destroyed.
Definition at line 1137 of file HTTPTransaction.h.
References max.
Referenced by TEST_F().
|
inline |
Definition at line 515 of file HTTPTransaction.h.
References proxygen::DOWNSTREAM.
Referenced by proxygen::HTTPSession::onMessageComplete().
|
inline |
Definition at line 753 of file HTTPTransaction.h.
Referenced by onDelayedDestroy(), onError(), onIngressTimeout(), and sendHeadersWithOptionalEOM().
|
inline |
Definition at line 746 of file HTTPTransaction.h.
Referenced by notifyTransportPendingEgress(), and sendDeferredBody().
|
inline |
Definition at line 768 of file HTTPTransaction.h.
|
inline |
Definition at line 941 of file HTTPTransaction.h.
|
inline |
Definition at line 738 of file HTTPTransaction.h.
|
inlineprivate |
Definition at line 1282 of file HTTPTransaction.h.
Referenced by markEgressComplete(), notifyTransportPendingEgress(), onDelayedDestroy(), onWriteReady(), sendBody(), sendEOM(), and ~HTTPTransaction().
|
private |
Definition at line 483 of file HTTPTransaction.cpp.
References ingressPaused_, isExpectingWindowUpdate(), and isIngressEOMSeen().
Referenced by updateReadTimeout().
|
private |
Definition at line 479 of file HTTPTransaction.cpp.
References proxygen::Window::getSize(), sendWindow_, and useFlowControl_.
Referenced by isExpectingIngress(), onError(), onIngressTimeout(), and sendBodyNow().
|
inline |
Definition at line 1015 of file HTTPTransaction.h.
|
inline |
Definition at line 947 of file HTTPTransaction.h.
|
inline |
Definition at line 724 of file HTTPTransaction.h.
Referenced by onDelayedDestroy(), onError(), processIngressBody(), processIngressChunkComplete(), processIngressChunkHeader(), processIngressEOM(), processIngressHeadersComplete(), processIngressTrailers(), processIngressUpgrade(), and resumeIngress().
|
inline |
Definition at line 717 of file HTTPTransaction.h.
|
inline |
Definition at line 731 of file HTTPTransaction.h.
Referenced by flushWindowUpdate(), isExpectingIngress(), onError(), onIngressBody(), onIngressEOM(), proxygen::HTTPSession::onPushMessageBegin(), and processIngressBody().
|
inline |
Definition at line 905 of file HTTPTransaction.h.
References uint64_t.
Referenced by proxygen::HTTPSession::onExMessageBegin().
|
inline |
Definition at line 709 of file HTTPTransaction.h.
|
inline |
Definition at line 1195 of file HTTPTransaction.h.
References uint64_t.
Referenced by sendBodyNow().
|
inline |
True if this transaction is a server push transaction
Definition at line 1011 of file HTTPTransaction.h.
Referenced by proxygen::HTTPSession::createTransaction(), proxygen::HTTPSession::decrementTransactionCount(), onIngressHeadersComplete(), proxygen::HTTPSession::onMessageBegin(), and sendHeadersWithOptionalEOM().
|
inline |
Definition at line 760 of file HTTPTransaction.h.
References proxygen::DOWNSTREAM, and proxygen::UPSTREAM.
Referenced by HTTPTransaction(), and proxygen::HTTPSession::onHeadersComplete().
|
inline |
Definition at line 1019 of file HTTPTransaction.h.
|
inline |
Definition at line 511 of file HTTPTransaction.h.
References proxygen::UPSTREAM.
Referenced by HTTPTransaction(), onIngressEOM(), onIngressHeadersComplete(), and sendAbort().
|
private |
Causes isEgressComplete() to return true, removes any queued egress, and cancels the write timeout.
Definition at line 503 of file HTTPTransaction.cpp.
References folly::IOBufQueue::chainLength(), deferredEgressBody_, dequeue(), egressState_, int64_t, isEnqueued(), folly::IOBufQueue::move(), proxygen::HTTPTransaction::Transport::notifyEgressBodyBuffered(), and transport_.
Referenced by onEgressTimeout(), onError(), onIngressTimeout(), processIngressEOM(), and sendAbort().
|
private |
Causes isIngressComplete() to return true, removes any queued ingress, and cancels the read timeout.
Definition at line 496 of file HTTPTransaction.cpp.
References folly::HHWheelTimer::Callback::cancelTimeout(), deferredIngress_, and ingressState_.
Referenced by onError(), onIngressTimeout(), and sendAbort().
|
private |
Definition at line 888 of file HTTPTransaction.cpp.
References count, egressLimitBytesPerMs_, egressRateLimited_, proxygen::getCurrentTime(), int64_t, proxygen::millisecondsBetween(), notifyTransportPendingEgress(), numLimitedBytesEgressed_, rateLimitCallback_, folly::HHWheelTimer::scheduleTimeout(), startRateLimit_, and timer_.
Referenced by sendDeferredBody().
|
private |
Definition at line 1253 of file HTTPTransaction.cpp.
References deferredIngress_, and ingressPaused_.
Referenced by onIngressBody(), onIngressChunkComplete(), onIngressChunkHeader(), onIngressEOM(), onIngressHeadersComplete(), onIngressTrailers(), and onIngressUpgrade().
|
inlinevirtual |
Definition at line 1189 of file HTTPTransaction.h.
References int32_t, and transport_.
|
inlinevirtual |
Create a new extended transaction associated with this transaction, and assign the given handler and priority.
Definition at line 984 of file HTTPTransaction.h.
References transport_.
Referenced by proxygen::RequestHandlerAdaptor::newExMessage().
|
inlinevirtual |
Create a new pushed transaction associated with this transaction, and assign the given handler and priority.
Definition at line 965 of file HTTPTransaction.h.
References transport_.
Referenced by proxygen::RequestHandlerAdaptor::newPushedResponse(), and TEST_F().
|
private |
Definition at line 1181 of file HTTPTransaction.cpp.
References folly::IOBufQueue::chainLength(), proxygen::HTTP2PriorityQueueBase::clearPendingEgress(), deferredEgressBody_, egressQueue_, egressRateLimited_, proxygen::Window::getSize(), folly::gen::guard(), int64_t, isEgressEOMQueued(), isEnqueued(), proxygen::HTTPTransaction::Transport::notifyEgressBodyBuffered(), proxygen::HTTPTransaction::Transport::notifyPendingEgress(), queueHandle_, sendWindow_, proxygen::HTTP2PriorityQueueBase::signalPendingEgress(), transport_, updateHandlerPauseState(), and useFlowControl_.
Referenced by maybeDelayForRateLimit(), onIngressSetSendWindow(), onIngressWindowUpdate(), rateLimitTimeoutExpired(), sendBody(), sendDeferredBody(), and sendEOM().
|
overrideprivatevirtual |
Implement onDelayedDestroy in subclasses. onDelayedDestroy() is invoked when the object is potentially being destroyed.
delayed | This parameter is true if destruction was delayed because of a DestructorGuard object, or false if onDelayedDestroy() is being called directly from the destructor. |
Implements folly::DelayedDestructionBase.
Definition at line 111 of file HTTPTransaction.cpp.
References deleting_, proxygen::HTTPTransaction::Transport::detach(), proxygen::HTTPTransactionHandler::detachTransaction(), proxygen::Window::getOutstanding(), handler_, isEgressComplete(), isEnqueued(), isIngressComplete(), proxygen::HTTPTransaction::Transport::notifyIngressBodyProcessed(), pendingByteEvents_, recvWindow_, transport_, and transportCallback_.
|
private |
void proxygen::HTTPTransaction::onEgressBodyFirstByte | ( | ) |
Invoked by the session when the first byte is flushed.
Definition at line 701 of file HTTPTransaction.cpp.
References proxygen::HTTPTransactionTransportCallback::firstByteFlushed(), g(), and transportCallback_.
Referenced by proxygen::HTTPSessionBase::handleLastByteEvents().
void proxygen::HTTPTransaction::onEgressBodyLastByte | ( | ) |
Invoked by the session when the last byte is flushed.
Definition at line 708 of file HTTPTransaction.cpp.
References g(), proxygen::HTTPTransactionTransportCallback::lastByteFlushed(), and transportCallback_.
Referenced by proxygen::HTTPSessionBase::handleLastByteEvents().
void proxygen::HTTPTransaction::onEgressHeaderFirstByte | ( | ) |
Invoked by the session when the first header byte is flushed.
Definition at line 694 of file HTTPTransaction.cpp.
References proxygen::HTTPTransactionTransportCallback::firstHeaderByteFlushed(), g(), and transportCallback_.
void proxygen::HTTPTransaction::onEgressLastByteAck | ( | std::chrono::milliseconds | latency | ) |
Invoked when the ACK_LATENCY event is delivered
latency | the time between the moment when the last byte was sent and the moment when we received the ACK from the client |
Definition at line 722 of file HTTPTransaction.cpp.
References g(), proxygen::HTTPTransactionTransportCallback::lastByteAcked(), and transportCallback_.
void proxygen::HTTPTransaction::onEgressTimeout | ( | ) |
Invoked by the session when there is a timeout on the egress stream.
Definition at line 681 of file HTTPTransaction.cpp.
References proxygen::HTTPException::EGRESS, g(), handler_, id_, proxygen::kErrorTimeout, markEgressComplete(), onError(), and proxygen::Exception::setProxygenError().
void proxygen::HTTPTransaction::onEgressTrackedByte | ( | ) |
Invoked by the session when the tracked byte is flushed.
Definition at line 715 of file HTTPTransaction.cpp.
References g(), proxygen::HTTPTransactionTransportCallback::trackedByteFlushed(), and transportCallback_.
void proxygen::HTTPTransaction::onError | ( | const HTTPException & | error | ) |
Invoked by the session when there is an error (e.g., invalid syntax, TCP RST) in either the ingress or egress stream. Note that this message is processed immediately even if this transaction normally would queue ingress.
error | Details for the error. This exception also has information about whether the error applies to the ingress, egress, or both directions of the transaction |
Definition at line 536 of file HTTPTransaction.cpp.
References aborted_, proxygen::HTTPException::EGRESS, proxygen::FLOW_CONTROL_ERROR, g(), proxygen::HTTPException::getCodecStatusCode(), proxygen::HTTPException::getDirection(), proxygen::Exception::getProxygenError(), handler_, proxygen::HTTPException::hasCodecStatusCode(), proxygen::HTTPException::INGRESS, proxygen::HTTPException::INGRESS_AND_EGRESS, ingressErrorSeen_, isEgressComplete(), isExpectingWindowUpdate(), isIngressComplete(), isIngressEOMSeen(), proxygen::kErrorStreamAbort, proxygen::kErrorWriteTimeout, markEgressComplete(), markIngressComplete(), proxygen::HTTPTransactionHandler::onError(), and sendAbort().
Referenced by proxygen::HTTPSessionBase::handleErrorDirectly(), proxygen::HTTPSession::onAbort(), onEgressTimeout(), proxygen::HTTPSession::onError(), onIngressBody(), onIngressEOM(), onIngressTimeout(), proxygen::HTTPSession::onMessageBegin(), sendBodyNow(), proxygen::HTTPSession::shutdownTransport(), TEST(), and validateIngressStateTransition().
bool proxygen::HTTPTransaction::onExTransaction | ( | HTTPTransaction * | txn | ) |
Invoked by the session when a new ExTransaction arrives. The txn's handler will be notified and is responsible for installing a handler. If no handler is installed in the callback, the transaction will be aborted.
Definition at line 1279 of file HTTPTransaction.cpp.
References proxygen::ERROR, exTransactions_, g(), getControlStream(), getHandler(), getID(), handler_, id_, and proxygen::HTTPTransactionHandler::onExTransaction().
void proxygen::HTTPTransaction::onGoaway | ( | ErrorCode | code | ) |
Invoked by the session when a GOAWAY frame is received. TODO: we may consider exposing the additional debug data here in the future.
code | The error code received in the GOAWAY frame |
Definition at line 610 of file HTTPTransaction.cpp.
References g(), handler_, and proxygen::HTTPTransactionHandler::onGoaway().
Referenced by proxygen::HTTPSession::onGoaway().
void proxygen::HTTPTransaction::onIngressBody | ( | std::unique_ptr< folly::IOBuf > | chain, |
uint16_t | padding | ||
) |
Invoked by the session when some or all of the ingress entity-body has been parsed.
Definition at line 217 of file HTTPTransaction.cpp.
References proxygen::HTTPEvent::BODY, proxygen::HTTPTransactionTransportCallback::bodyBytesReceived(), checkCreateDeferredIngress(), folly::IOBuf::computeChainDataLength(), deferredIngress_, proxygen::ERROR, expectedContentLengthRemaining_, proxygen::FLOW_CONTROL_ERROR, FOLLY_SCOPED_TRACE_SECTION, proxygen::Window::free(), g(), proxygen::Window::getCapacity(), proxygen::Window::getOutstanding(), handler_, folly::Optional< Value >::hasValue(), id_, proxygen::HTTPException::INGRESS, isIngressEOMSeen(), proxygen::kErrorParseBody, folly::gen::move, mustQueueIngress(), onError(), processIngressBody(), recvToAck_, recvWindow_, proxygen::Window::reserve(), sendAbort(), proxygen::Exception::setProxygenError(), proxygen::STREAM_CLOSED, transportCallback_, useFlowControl_, validateIngressStateTransition(), and folly::Optional< Value >::value().
Referenced by proxygen::HTTPSessionBase::onBodyImpl(), and DownstreamTransactionTest::setupRequestResponseFlow().
void proxygen::HTTPTransaction::onIngressChunkComplete | ( | ) |
Invoked by the session when the CRLF terminating a chunk has been parsed.
Definition at line 336 of file HTTPTransaction.cpp.
References checkCreateDeferredIngress(), proxygen::HTTPEvent::CHUNK_COMPLETE, deferredIngress_, id_, mustQueueIngress(), processIngressChunkComplete(), and validateIngressStateTransition().
Referenced by proxygen::HTTPSession::onChunkComplete().
void proxygen::HTTPTransaction::onIngressChunkHeader | ( | size_t | length | ) |
Invoked by the session when a chunk header has been parsed.
Definition at line 310 of file HTTPTransaction.cpp.
References checkCreateDeferredIngress(), proxygen::HTTPEvent::CHUNK_HEADER, deferredIngress_, id_, mustQueueIngress(), processIngressChunkHeader(), and validateIngressStateTransition().
Referenced by proxygen::HTTPSession::onChunkHeader().
void proxygen::HTTPTransaction::onIngressEOM | ( | ) |
Invoked by the session when the ingress message is complete.
Definition at line 414 of file HTTPTransaction.cpp.
References checkCreateDeferredIngress(), deferredIngress_, proxygen::ERROR, expectedContentLengthRemaining_, extraResponseExpected(), handler_, folly::Optional< Value >::hasValue(), id_, proxygen::HTTPException::INGRESS, isIngressEOMSeen(), isUpstream(), proxygen::kErrorParseBody, proxygen::HTTPEvent::MESSAGE_COMPLETE, mustQueueIngress(), onError(), processIngressEOM(), sendAbort(), proxygen::Exception::setProxygenError(), proxygen::STREAM_CLOSED, updateReadTimeout(), validateIngressStateTransition(), and folly::Optional< Value >::value().
Referenced by proxygen::HTTPSession::onMessageComplete(), and DownstreamTransactionTest::setupRequestResponseFlow().
void proxygen::HTTPTransaction::onIngressHeadersComplete | ( | std::unique_ptr< HTTPMessage > | msg | ) |
Invoked by the session when the ingress headers are complete
Definition at line 158 of file HTTPTransaction.cpp.
References checkCreateDeferredIngress(), proxygen::CONNECT, deferredIngress_, proxygen::ERROR, expectedContentLengthRemaining_, g(), proxygen::HTTPTransaction::Transport::getCodec(), proxygen::HTTPCodec::getHPACKTableInfo(), proxygen::HTTPCodec::getProtocol(), proxygen::HEAD, proxygen::HTTPTransactionTransportCallback::headerBytesReceived(), proxygen::HTTPEvent::HEADERS_COMPLETE, headRequest_, proxygen::HTTP_2, proxygen::HTTP_HEADER_CONTENT_LENGTH, id_, isPushed(), isUpstream(), lastResponseStatus_, folly::gen::move, mustQueueIngress(), processIngressHeadersComplete(), proxygen::RFC2616::responseBodyMustBeEmpty(), seqNo_, transport_, transportCallback_, updateIngressHPACKTableInfo(), and validateIngressStateTransition().
void proxygen::HTTPTransaction::onIngressSetSendWindow | ( | uint32_t | newWindowSize | ) |
Invoked by the session when the remote endpoint signals that we should change our send window. This is only for versions of HTTP that support per transaction flow control.
Definition at line 665 of file HTTPTransaction.cpp.
References proxygen::ERROR, proxygen::FLOW_CONTROL_ERROR, proxygen::Window::getCapacity(), proxygen::Window::getOutstanding(), notifyTransportPendingEgress(), sendAbort(), sendWindow_, proxygen::Window::setCapacity(), updateReadTimeout(), and useFlowControl_.
Referenced by proxygen::HTTPSession::onSetSendWindow().
void proxygen::HTTPTransaction::onIngressTimeout | ( | ) |
Invoked by the session when there is a timeout on the ingress stream. Note that each transaction has its own timer but the session is the effective target of the timer.
Definition at line 622 of file HTTPTransaction.cpp.
References g(), handler_, id_, proxygen::HTTPException::INGRESS, proxygen::HTTPException::INGRESS_AND_EGRESS, isEgressComplete(), isExpectingWindowUpdate(), proxygen::kErrorTimeout, proxygen::kErrorWriteTimeout, markEgressComplete(), markIngressComplete(), onError(), pauseIngress(), proxygen::PROTOCOL_ERROR, proxygen::HTTPException::setCodecStatusCode(), and proxygen::Exception::setProxygenError().
void proxygen::HTTPTransaction::onIngressTrailers | ( | std::unique_ptr< HTTPHeaders > | trailers | ) |
Invoked by the session when the ingress trailers have been parsed.
Definition at line 362 of file HTTPTransaction.cpp.
References checkCreateDeferredIngress(), deferredIngress_, id_, folly::gen::move, mustQueueIngress(), processIngressTrailers(), proxygen::HTTPEvent::TRAILERS_COMPLETE, and validateIngressStateTransition().
Referenced by proxygen::HTTPSession::onTrailersComplete().
void proxygen::HTTPTransaction::onIngressUpgrade | ( | UpgradeProtocol | protocol | ) |
Invoked by the session when the session and transaction need to be upgraded to a different protocol
Definition at line 389 of file HTTPTransaction.cpp.
References checkCreateDeferredIngress(), deferredIngress_, id_, mustQueueIngress(), processIngressUpgrade(), proxygen::HTTPEvent::UPGRADE, and validateIngressStateTransition().
Referenced by proxygen::HTTPSession::onMessageComplete().
void proxygen::HTTPTransaction::onIngressWindowUpdate | ( | uint32_t | amount | ) |
Invoked by the session when the remote endpoint of this transaction signals that it has consumed 'amount' bytes. This is only for versions of HTTP that support per transaction flow control.
Definition at line 647 of file HTTPTransaction.cpp.
References proxygen::ERROR, proxygen::FLOW_CONTROL_ERROR, proxygen::Window::free(), g(), proxygen::Window::getCapacity(), proxygen::Window::getOutstanding(), notifyTransportPendingEgress(), sendAbort(), sendWindow_, updateReadTimeout(), and useFlowControl_.
Referenced by proxygen::HTTPSession::onWindowUpdate().
void proxygen::HTTPTransaction::onPriorityUpdate | ( | const http2::PriorityUpdate & | priority | ) |
Notify of priority change, will not generate a PRIORITY frame
Definition at line 1374 of file HTTPTransaction.cpp.
References currentDepth_, egressQueue_, priority_, priorityFallback_, queueHandle_, proxygen::http2::PriorityUpdate::streamDependency, and proxygen::HTTP2PriorityQueueBase::updatePriority().
Referenced by updateAndSendPriority().
bool proxygen::HTTPTransaction::onPushedTransaction | ( | HTTPTransaction * | txn | ) |
Invoked by the session (upstream only) when a new pushed transaction arrives. The txn's handler will be notified and is responsible for installing a handler. If no handler is installed in the callback, the pushed transaction will be aborted.
Definition at line 1263 of file HTTPTransaction.cpp.
References assocStreamId_, g(), getHandler(), getID(), handler_, id_, proxygen::HTTPTransactionHandler::onPushedTransaction(), and pushedTransactions_.
Referenced by proxygen::HTTPSession::onPushMessageBegin().
bool proxygen::HTTPTransaction::onWriteReady | ( | uint32_t | maxEgress, |
double | ratio | ||
) |
Notify this transaction that it is ok to egress. Returns true if there is additional pending egress
Definition at line 801 of file HTTPTransaction.cpp.
References cumulativeRatio_, egressCalls_, g(), isEnqueued(), prioritySample_, sendDeferredBody(), and updateRelativeWeight().
Referenced by DownstreamTransactionTest::setupRequestResponseFlow().
|
privatedelete |
void proxygen::HTTPTransaction::pauseEgress | ( | ) |
Pause egress generation. HTTPTransaction may call its Handler's onEgressPaused() method if there is a state change as a result of this call.
On receiving onEgressPaused(), the Handler should make a best effort to stop invoking the HTTPTransaction's egress generating methods. If the Handler does invoke any of those methods while the transaction is paused, however, the transaction will forward them anyway, unless it is a body event. If flow control is enabled, body events will be buffered for later transmission when egress is unpaused.
Definition at line 1150 of file HTTPTransaction.cpp.
References egressPaused_, g(), and updateHandlerPauseState().
Referenced by proxygen::HTTPSession::resumeTransactions(), and proxygen::HTTPSession::updateWriteBufSize().
|
virtual |
Pause ingress processing. Upon pause, the HTTPTransaction will call its Transport's pauseIngress() method. The Transport should make a best effort to stop invoking the HTTPTransaction's onIngress* callbacks. If the Transport does invoke any of those methods while the transaction is paused, however, the transaction will queue the ingress events and data and delay delivery to the Handler until the transaction is unpaused.
Definition at line 1072 of file HTTPTransaction.cpp.
References folly::HHWheelTimer::Callback::cancelTimeout(), g(), ingressPaused_, proxygen::HTTPTransaction::Transport::pauseIngress(), and transport_.
Referenced by ProxyService::ProxyHandler::onEgressPaused(), onIngressTimeout(), proxygen::RequestHandlerAdaptor::pauseIngress(), and TEST_F().
|
private |
Definition at line 280 of file HTTPTransaction.cpp.
References aborted_, flushWindowUpdate(), FOLLY_SCOPED_TRACE_SECTION, g(), proxygen::Window::getCapacity(), handler_, proxygen::HTTPTransaction::Transport::isDraining(), isIngressComplete(), isIngressEOMSeen(), folly::gen::move, proxygen::HTTPTransaction::Transport::notifyIngressBodyProcessed(), proxygen::HTTPTransactionHandler::onBody(), recvToAck_, recvWindow_, refreshTimeout(), transport_, uint32_t, and useFlowControl_.
Referenced by onIngressBody(), and resumeIngress().
|
private |
Definition at line 351 of file HTTPTransaction.cpp.
References aborted_, g(), handler_, isIngressComplete(), proxygen::HTTPTransactionHandler::onChunkComplete(), and refreshTimeout().
Referenced by onIngressChunkComplete(), and resumeIngress().
|
private |
Definition at line 325 of file HTTPTransaction.cpp.
References aborted_, g(), handler_, isIngressComplete(), proxygen::HTTPTransactionHandler::onChunkHeader(), and refreshTimeout().
Referenced by onIngressChunkHeader(), and resumeIngress().
|
private |
Definition at line 458 of file HTTPTransaction.cpp.
References aborted_, g(), handler_, isIngressComplete(), markEgressComplete(), proxygen::HTTPTransactionHandler::onEOM(), updateReadTimeout(), and validateIngressStateTransition().
Referenced by onIngressEOM(), and resumeIngress().
|
private |
Definition at line 205 of file HTTPTransaction.cpp.
References aborted_, g(), handler_, isIngressComplete(), folly::gen::move, proxygen::HTTPTransactionHandler::onHeadersComplete(), and refreshTimeout().
Referenced by onIngressHeadersComplete(), and resumeIngress().
|
private |
Definition at line 378 of file HTTPTransaction.cpp.
References aborted_, g(), handler_, isIngressComplete(), folly::gen::move, proxygen::HTTPTransactionHandler::onTrailers(), and refreshTimeout().
Referenced by onIngressTrailers(), and resumeIngress().
|
private |
Definition at line 404 of file HTTPTransaction.cpp.
References aborted_, g(), handler_, isIngressComplete(), and proxygen::HTTPTransactionHandler::onUpgrade().
Referenced by onIngressUpgrade(), and resumeIngress().
|
private |
Definition at line 939 of file HTTPTransaction.cpp.
References egressRateLimited_, and notifyTransportPendingEgress().
|
inline |
Schedule or refresh the timeout for this transaction
Definition at line 1100 of file HTTPTransaction.h.
References timer_.
Referenced by HTTPTransaction(), processIngressBody(), processIngressChunkComplete(), processIngressChunkHeader(), processIngressHeadersComplete(), processIngressTrailers(), proxygen::RequestHandlerAdaptor::refreshTimeout(), setIdleTimeout(), and updateReadTimeout().
|
inline |
Remove the exTxn ID from the control stream txn.
Definition at line 1093 of file HTTPTransaction.h.
Referenced by proxygen::HTTPSession::detach().
|
inline |
Remove the pushed txn ID from the set of pushed txns associated with this txn.
Definition at line 1086 of file HTTPTransaction.h.
Referenced by proxygen::HTTPSession::detach().
|
inlinevirtual |
Remove a callback waiting for replay protection (if it was canceled).
Definition at line 1184 of file HTTPTransaction.h.
References transport_.
void proxygen::HTTPTransaction::reset | ( | bool | useFlowControl, |
uint32_t | receiveInitialWindowSize, | ||
uint32_t | receiveStreamWindowSize, | ||
uint32_t | sendInitialWindowSize | ||
) |
Definition at line 148 of file HTTPTransaction.cpp.
References recvWindow_, sendWindow_, proxygen::Window::setCapacity(), setReceiveWindow(), and useFlowControl_.
Referenced by proxygen::HTTPSession::onNativeProtocolUpgradeImpl().
void proxygen::HTTPTransaction::resumeEgress | ( | ) |
Resume egress generation. The Handler's onEgressResumed() will not be invoked if the HTTP/2 send window is full or there is too much buffered egress data on this transaction already. In that case, once the send window is not full or the buffer usage decreases, the handler will finally get onEgressResumed().
Definition at line 1161 of file HTTPTransaction.cpp.
References egressPaused_, g(), and updateHandlerPauseState().
|
virtual |
Resume ingress processing. Only useful after a call to pauseIngress().
Definition at line 1084 of file HTTPTransaction.cpp.
References proxygen::HTTPEvent::BODY, proxygen::HTTPEvent::CHUNK_COMPLETE, proxygen::HTTPEvent::CHUNK_HEADER, folly::IOBuf::computeChainDataLength(), data, deferredIngress_, proxygen::Window::free(), g(), proxygen::HTTPEvent::getEvent(), proxygen::HTTPEvent::HEADERS_COMPLETE, ingressPaused_, inResume_, isIngressComplete(), maxDeferredIngress_, proxygen::HTTPEvent::MESSAGE_BEGIN, proxygen::HTTPEvent::MESSAGE_COMPLETE, folly::gen::move, processIngressBody(), processIngressChunkComplete(), processIngressChunkHeader(), processIngressEOM(), processIngressHeadersComplete(), processIngressTrailers(), processIngressUpgrade(), recvWindow_, proxygen::HTTPTransaction::Transport::resumeIngress(), folly::size(), proxygen::HTTPEvent::TRAILERS_COMPLETE, transport_, updateReadTimeout(), and proxygen::HTTPEvent::UPGRADE.
Referenced by ProxyService::ProxyHandler::onEgressResumed(), proxygen::RequestHandlerAdaptor::resumeIngress(), and TEST_F().
|
virtual |
Terminate the transaction. Depending on the underlying protocol, this may cause the connection to close or write egress bytes. This method does not actually write the message out on the wire immediately. All writes happen at the end of the event loop at the earliest.
This function may also cause additional callbacks such as detachTransaction() to the handler either immediately or after it returns.
Definition at line 1047 of file HTTPTransaction.cpp.
References proxygen::CANCEL, proxygen::INTERNAL_ERROR, and isUpstream().
Referenced by proxygen::HTTPSessionBase::handleErrorDirectly(), proxygen::CodecErrorResponseHandler::onError(), ProxyService::ProxyHandler::onError(), onError(), onIngressBody(), onIngressEOM(), onIngressSetSendWindow(), onIngressWindowUpdate(), proxygen::RequestHandlerAdaptor::sendAbort(), proxygen::HTTPHandlerBase::terminate(), and TEST_F().
|
private |
Implementation of sending an abort for this transaction.
Definition at line 1052 of file HTTPTransaction.cpp.
References aborted_, g(), proxygen::HTTPTransactionTransportCallback::headerBytesGenerated(), markEgressComplete(), markIngressComplete(), proxygen::HTTPTransaction::Transport::sendAbort(), folly::size(), transport_, transportCallback_, and wangle::HTTPHeaderSize::uncompressed.
|
virtual |
Send part or all of the egress message body to the Transport. If flow control is enabled, the chunk boundaries may not be respected. This method does not actually write the message out on the wire immediately. All writes happen at the end of the event loop at the earliest. Note: This method may be called zero or more times per message.
body | Message body data; the Transport will take care of applying any necessary protocol framing, such as chunk headers. |
Reimplemented in proxygen::MockHTTPTransaction.
Definition at line 784 of file HTTPTransaction.cpp.
References actualResponseLength_, folly::IOBufQueue::append(), folly::IOBuf::computeChainDataLength(), deferredEgressBody_, egressState_, folly::gen::guard(), isEnqueued(), folly::gen::move, proxygen::HTTPTransaction::Transport::notifyEgressBodyBuffered(), notifyTransportPendingEgress(), proxygen::StateMachine< T >::transit(), transport_, and folly::Optional< Value >::value().
Referenced by ProxyService::ProxyHandler::onBody(), proxygen::HTTPDirectResponseHandler::onHeadersComplete(), proxygen::RequestHandlerAdaptor::sendBody(), proxygen::HTTPHandlerBase::sendBody(), proxygen::HTTPHandlerBase::sendChunkedReplyWithBody(), CurlService::CurlClient::sendRequest(), and DownstreamTransactionTest::setupRequestResponseFlow().
|
private |
|
private |
Definition at line 955 of file HTTPTransaction.cpp.
References egressLimitBytesPerMs_, egressState_, enableLastByteFlushedTracking_, proxygen::FLOW_CONTROL_ERROR, proxygen::Window::getCapacity(), proxygen::Window::getSize(), id_, proxygen::HTTPException::INGRESS_AND_EGRESS, ingressErrorSeen_, isExpectingWindowUpdate(), isPrioritySampled(), proxygen::kErrorEOF, folly::gen::move, numLimitedBytesEgressed_, onError(), proxygen::Window::reserve(), proxygen::HTTPTransaction::Transport::sendBody(), sendEOMNow(), sendWindow_, proxygen::HTTPException::setCodecStatusCode(), proxygen::Exception::setProxygenError(), string, trailers_, proxygen::StateMachine< T >::transit(), transport_, updateReadTimeout(), updateTransactionBytesSent(), and useFlowControl_.
Referenced by sendDeferredBody().
|
inlinevirtual |
Write any protocol framing required for the subsequent call(s) to sendBody(). This method does not actually write the message out on the wire immediately. All writes happen at the end of the event loop at the earliest.
length | Length in bytes of the body data to follow. |
Definition at line 825 of file HTTPTransaction.h.
References proxygen::StateMachine< T >::transit(), and transport_.
Referenced by proxygen::HTTPHandlerBase::sendChunkedReplyWithBody(), and proxygen::RequestHandlerAdaptor::sendChunkHeader().
|
inlinevirtual |
Write any protocol syntax needed to terminate the data. This method does not actually write the message out on the wire immediately. All writes happen at the end of the event loop at the earliest. Frame begun by the last call to sendChunkHeader().
Definition at line 840 of file HTTPTransaction.h.
References proxygen::StateMachine< T >::transit().
Referenced by proxygen::HTTPHandlerBase::sendChunkedReplyWithBody(), and proxygen::RequestHandlerAdaptor::sendChunkTerminator().
|
private |
Definition at line 814 of file HTTPTransaction.cpp.
References proxygen::HTTPTransactionTransportCallback::bodyBytesGenerated(), folly::IOBufQueue::chainLength(), chunkHeaders_, deferredEgressBody_, dequeue(), proxygen::Window::getSize(), hasPendingEOM(), proxygen::HTTPTransaction::Chunk::headerSent, int32_t, isEgressEOMQueued(), proxygen::HTTPTransaction::Chunk::length, maybeDelayForRateLimit(), folly::gen::move, notifyTransportPendingEgress(), sendBodyNow(), proxygen::HTTPTransaction::Transport::sendChunkHeader(), proxygen::HTTPTransaction::Transport::sendChunkTerminator(), sendEOMNow(), sendWindow_, folly::IOBufQueue::split(), transport_, transportCallback_, uint32_t, and useFlowControl_.
Referenced by onWriteReady().
|
virtual |
Finalize the egress message; depending on the protocol used by the Transport, this may involve sending an explicit "end of message" indicator. This method does not actually write the message out on the wire immediately. All writes happen at the end of the event loop at the earliest.
If the ingress message also is complete, the transaction may detach itself from the Handler and Transport and delete itself as part of this method.
Note: Either this method or sendAbort() should be called once per message.
Definition at line 1003 of file HTTPTransaction.cpp.
References aborted_, actualResponseLength_, proxygen::HTTPTransactionTransportCallback::bodyBytesGenerated(), folly::IOBufQueue::chainLength(), chunkHeaders_, deferredEgressBody_, egressPaused_, egressState_, proxygen::ERROR, expectedResponseLength_, g(), ingressPaused_, ingressState_, isEnqueued(), proxygen::HTTPTransaction::Transport::notifyPendingEgress(), notifyTransportPendingEgress(), sendEOMNow(), proxygen::StateMachine< T >::transit(), transport_, and transportCallback_.
Referenced by proxygen::HTTPDirectResponseHandler::onEOM(), ProxyService::ProxyHandler::onEOM(), proxygen::HTTPHandlerBase::sendChunkedReplyWithBody(), proxygen::RequestHandlerAdaptor::sendEOM(), proxygen::HTTPHandlerBase::sendEOM(), proxygen::HTTPHandlerBase::sendReplyCode(), proxygen::HTTPHandlerBase::sendReplyWithBody(), proxygen::HTTPHandlerBase::sendRequest(), CurlService::CurlClient::sendRequest(), DownstreamTransactionTest::setupRequestResponseFlow(), and TEST_F().
|
private |
Definition at line 944 of file HTTPTransaction.cpp.
References egressState_, proxygen::HTTPTransaction::Transport::sendEOM(), trailers_, proxygen::StateMachine< T >::transit(), and transport_.
Referenced by sendBodyNow(), sendDeferredBody(), and sendEOM().
|
virtual |
Send the egress message headers to the Transport. This method does not actually write the message out on the wire immediately. All writes happen at the end of the event loop at the earliest. Note: This method should be called once per message unless the first headers sent indicate a 1xx status.
sendHeaders will not set EOM flag in header frame, whereas sendHeadersWithEOM will. sendHeadersWithOptionalEOM backs both of them.
headers | Message headers |
Definition at line 780 of file HTTPTransaction.cpp.
References sendHeadersWithOptionalEOM().
Referenced by proxygen::HTTPDirectResponseHandler::onHeadersComplete(), proxygen::HTTPHandlerBase::sendChunkedReplyWithBody(), proxygen::HTTPHandlerBase::sendHeaders(), proxygen::RequestHandlerAdaptor::sendHeaders(), proxygen::MockHTTPPushHandler::sendPushHeaders(), proxygen::HTTPHandlerBase::sendRequest(), CurlService::CurlClient::sendRequest(), and DownstreamTransactionTest::setupRequestResponseFlow().
|
virtual |
Definition at line 776 of file HTTPTransaction.cpp.
References sendHeadersWithOptionalEOM().
|
virtual |
Definition at line 729 of file HTTPTransaction.cpp.
References proxygen::HTTPTransactionTransportCallback::bodyBytesGenerated(), egressState_, proxygen::ERROR, expectedResponseLength_, flushWindowUpdate(), proxygen::HTTPTransaction::Transport::getCodec(), proxygen::HTTPMessage::getHeaders(), proxygen::HTTPCodec::getHPACKTableInfo(), proxygen::HTTPMessage::getMethod(), proxygen::HTTPCodec::getProtocol(), proxygen::HTTPHeaders::getSingleOrEmpty(), proxygen::HTTPMessage::getStatusCode(), proxygen::HEAD, proxygen::HTTPTransactionTransportCallback::headerBytesGenerated(), headRequest_, proxygen::HTTP_2, proxygen::HTTP_HEADER_CONTENT_LENGTH, isEgressComplete(), isPushed(), proxygen::HTTPMessage::isRequest(), proxygen::HTTPMessage::isResponse(), lastResponseStatus_, proxygen::HTTPTransaction::Transport::sendHeaders(), folly::size(), proxygen::StateMachine< T >::transit(), transport_, transportCallback_, and updateEgressHPACKTableInfo().
Referenced by sendHeaders(), and sendHeadersWithEOM().
|
inlinevirtual |
Send message trailers to the Transport. This method does not actually write the message out on the wire immediately. All writes happen at the end of the event loop at the earliest. Note: This method may be called at most once per message.
trailers | Message trailers. |
Definition at line 853 of file HTTPTransaction.h.
References proxygen::StateMachine< T >::transit().
Referenced by proxygen::ResponseBuilder::send(), proxygen::HTTPHandlerBase::sendChunkedReplyWithBody(), and proxygen::HTTPHandlerBase::sendReplyWithBody().
void proxygen::HTTPTransaction::setEgressRateLimit | ( | uint64_t | bitsPerSecond | ) |
Specify a rate limit for egressing bytes. The transaction will buffer extra bytes if doing so would cause it to go over the specified rate limit. Setting to a value of 0 will cause no rate-limiting to occur.
Definition at line 1172 of file HTTPTransaction.cpp.
References egressLimitBytesPerMs_, proxygen::getCurrentTime(), numLimitedBytesEgressed_, and startRateLimit_.
|
inlinevirtual |
Definition at line 477 of file HTTPTransaction.h.
References handler().
Referenced by proxygen::HTTPSessionBase::handleErrorDirectly(), proxygen::HTTPSession::newExTransaction(), proxygen::HTTPSession::newPushedTransaction(), proxygen::MockHTTPTransaction::setHandlerUnmocked(), proxygen::HTTPDownstreamSession::setupOnHeadersComplete(), DownstreamTransactionTest::setupRequestResponseFlow(), TEST(), and TEST_F().
void proxygen::HTTPTransaction::setIdleTimeout | ( | std::chrono::milliseconds | transactionTimeout | ) |
Sets a transaction timeout value. If such a timeout was set, this timeout will be used instead of the default timeout interval configured in transactionIdleTimeouts_.
Definition at line 1295 of file HTTPTransaction.cpp.
References count, refreshTimeout(), and transactionTimeout_.
|
inline |
Definition at line 1224 of file HTTPTransaction.h.
References int32_t, statusCode, and uint32_t.
Referenced by proxygen::HTTPHandlerBase::sendBodyWithLastByteTracking().
void proxygen::HTTPTransaction::setPrioritySampled | ( | bool | sampled | ) |
Definition at line 1495 of file HTTPTransaction.cpp.
References prioritySample_.
Referenced by proxygen::HTTPSession::createTransaction().
|
virtual |
Change the size of the receive window and propagate the change to the remote end using a window update.
TODO: when HTTPSession sends a SETTINGS frame indicating a different initial window, it should call this function on all its transactions.
Definition at line 1315 of file HTTPTransaction.cpp.
References flushWindowUpdate(), proxygen::Window::getCapacity(), int32_t, recvToAck_, recvWindow_, proxygen::Window::setCapacity(), and useFlowControl_.
Referenced by proxygen::HTTPSession::createTransaction(), and reset().
|
inline |
Invoked by the handlers that are interested in tracking performance stats.
Definition at line 702 of file HTTPTransaction.h.
|
inline |
Definition at line 953 of file HTTPTransaction.h.
References proxygen::DOWNSTREAM, and transport_.
|
inline |
Definition at line 1116 of file HTTPTransaction.h.
Referenced by proxygen::HTTPSession::decrementTransactionCount().
|
inline |
Tests if the first byte has already been sent, and if it hasn't yet then it marks it as sent.
Definition at line 1110 of file HTTPTransaction.h.
Referenced by proxygen::HTTPSessionBase::handleLastByteEvents().
|
inline |
Tests if the very first byte of Header has already been set. If it hasn't yet, it marks it as sent.
Definition at line 1126 of file HTTPTransaction.h.
|
inlineoverridevirtualnoexcept |
Timeout callback for this transaction. The timer is active until the ingress message is complete or terminated by error.
Implements folly::HHWheelTimer::Callback.
Definition at line 1152 of file HTTPTransaction.h.
References int8_t, and transport_.
Referenced by TEST_F().
void proxygen::HTTPTransaction::updateAndSendPriority | ( | int8_t | newPriority | ) |
Change the priority of this transaction, may generate a PRIORITY frame
Definition at line 1359 of file HTTPTransaction.cpp.
References egressQueue_, proxygen::HTTPTransaction::Transport::getCodec(), proxygen::HTTPCodec::mapPriorityToDependency(), proxygen::HTTPMessage::normalizePriority(), priority_, queueHandle_, proxygen::HTTPTransaction::Transport::sendPriority(), proxygen::http2::PriorityUpdate::streamDependency, transport_, and proxygen::HTTP2PriorityQueueBase::updatePriority().
void proxygen::HTTPTransaction::updateAndSendPriority | ( | const http2::PriorityUpdate & | pri | ) |
Definition at line 1368 of file HTTPTransaction.cpp.
References onPriorityUpdate(), priority_, proxygen::HTTPTransaction::Transport::sendPriority(), and transport_.
void proxygen::HTTPTransaction::updateContentionsCount | ( | uint64_t | contentions | ) |
Definition at line 1503 of file HTTPTransaction.cpp.
References proxygen::HTTP2PriorityQueueBase::BaseNode::calculateDepth(), prioritySample_, and queueHandle_.
Referenced by proxygen::HTTPSession::runLoopCallback().
|
private |
Update the HPACKTableInfo (tableInfo_) struct
Definition at line 1240 of file HTTPTransaction.cpp.
References proxygen::HPACKTableInfo::egressBytesStored_, proxygen::HPACKTableInfo::egressHeadersStored_, proxygen::HPACKTableInfo::egressHeaderTableSize_, and tableInfo_.
Referenced by sendHeadersWithOptionalEOM().
|
private |
Invokes the handler's onEgressPaused/Resumed if the handler's pause state needs updating
Definition at line 1205 of file HTTPTransaction.cpp.
References folly::IOBufQueue::chainLength(), deferredEgressBody_, egressPaused_, egressRateLimited_, flowControlPaused_, proxygen::Window::getSize(), handler_, handlerEgressPaused_, int64_t, proxygen::HTTPTransactionHandler::onEgressPaused(), proxygen::HTTPTransactionHandler::onEgressResumed(), proxygen::HTTPSessionStats::recordTransactionStalled(), sendWindow_, stats_, and useFlowControl_.
Referenced by notifyTransportPendingEgress(), pauseEgress(), and resumeEgress().
|
private |
Definition at line 1231 of file HTTPTransaction.cpp.
References proxygen::HPACKTableInfo::ingressBytesStored_, proxygen::HPACKTableInfo::ingressHeadersStored_, proxygen::HPACKTableInfo::ingressHeaderTableSize_, and tableInfo_.
Referenced by onIngressHeadersComplete().
|
private |
Definition at line 488 of file HTTPTransaction.cpp.
References folly::HHWheelTimer::Callback::cancelTimeout(), isExpectingIngress(), and refreshTimeout().
Referenced by onIngressEOM(), onIngressSetSendWindow(), onIngressWindowUpdate(), processIngressEOM(), resumeIngress(), and sendBodyNow().
void proxygen::HTTPTransaction::updateRelativeWeight | ( | double | ratio | ) |
Definition at line 1509 of file HTTPTransaction.cpp.
References prioritySample_.
Referenced by onWriteReady().
void proxygen::HTTPTransaction::updateSessionBytesSheduled | ( | uint64_t | bytes | ) |
Definition at line 1514 of file HTTPTransaction.cpp.
References egressPaused_, egressRateLimited_, firstHeaderByteSent_, flowControlPaused_, and prioritySample_.
Referenced by proxygen::HTTPSession::runLoopCallback().
void proxygen::HTTPTransaction::updateTransactionBytesSent | ( | uint64_t | bytes | ) |
Definition at line 1529 of file HTTPTransaction.cpp.
References prioritySample_.
Referenced by sendBodyNow().
|
private |
Validates the ingress state transition. Returns false and sends an abort with PROTOCOL_ERROR if the transition fails. Otherwise it returns true.
Definition at line 517 of file HTTPTransaction.cpp.
References g(), id_, proxygen::HTTPException::INGRESS_AND_EGRESS, ingressState_, proxygen::INTERNAL_ERROR, proxygen::kErrorIngressStateTransition, onError(), proxygen::Exception::setProxygenError(), and proxygen::StateMachine< T >::transit().
Referenced by onIngressBody(), onIngressChunkComplete(), onIngressChunkHeader(), onIngressEOM(), onIngressHeadersComplete(), onIngressTrailers(), onIngressUpgrade(), and processIngressEOM().
|
private |
Definition at line 1473 of file HTTPTransaction.h.
Referenced by onError(), processIngressBody(), processIngressChunkComplete(), processIngressChunkHeader(), processIngressEOM(), processIngressHeadersComplete(), processIngressTrailers(), processIngressUpgrade(), sendAbort(), and sendEOM().
|
private |
Definition at line 1465 of file HTTPTransaction.h.
Referenced by sendBody(), and sendEOM().
|
private |
ID of request transaction (for pushed txns only)
Definition at line 1416 of file HTTPTransaction.h.
Referenced by HTTPTransaction(), and onPushedTransaction().
|
private |
Definition at line 1396 of file HTTPTransaction.h.
Referenced by sendDeferredBody(), and sendEOM().
|
private |
Definition at line 1451 of file HTTPTransaction.h.
Referenced by onWriteReady().
|
private |
Definition at line 1450 of file HTTPTransaction.h.
Referenced by HTTPTransaction(), and onPriorityUpdate().
|
private |
Queue to hold any body bytes to be sent out while egress to the remote is supposed to be paused.
Definition at line 1356 of file HTTPTransaction.h.
Referenced by markEgressComplete(), notifyTransportPendingEgress(), sendBody(), sendDeferredBody(), sendEOM(), and updateHandlerPauseState().
|
private |
Queue to hold any events that we receive from the Transaction while the ingress is supposed to be paused.
Definition at line 1348 of file HTTPTransaction.h.
Referenced by checkCreateDeferredIngress(), markIngressComplete(), mustQueueIngress(), onIngressBody(), onIngressChunkComplete(), onIngressChunkHeader(), onIngressEOM(), onIngressHeadersComplete(), onIngressTrailers(), onIngressUpgrade(), and resumeIngress().
|
private |
Definition at line 1474 of file HTTPTransaction.h.
Referenced by onDelayedDestroy().
|
private |
Definition at line 1358 of file HTTPTransaction.h.
Referenced by flushWindowUpdate().
|
staticprivate |
Definition at line 1484 of file HTTPTransaction.h.
|
private |
Definition at line 1452 of file HTTPTransaction.h.
Referenced by onWriteReady().
|
private |
Definition at line 1486 of file HTTPTransaction.h.
Referenced by maybeDelayForRateLimit(), sendBodyNow(), and setEgressRateLimit().
|
private |
Definition at line 1468 of file HTTPTransaction.h.
Referenced by pauseEgress(), resumeEgress(), sendEOM(), updateHandlerPauseState(), and updateSessionBytesSheduled().
|
private |
Reference to our priority queue
Definition at line 1401 of file HTTPTransaction.h.
Referenced by HTTPTransaction(), notifyTransportPendingEgress(), onPriorityUpdate(), updateAndSendPriority(), and ~HTTPTransaction().
|
private |
Definition at line 1471 of file HTTPTransaction.h.
Referenced by maybeDelayForRateLimit(), notifyTransportPendingEgress(), rateLimitTimeoutExpired(), updateHandlerPauseState(), and updateSessionBytesSheduled().
|
private |
Definition at line 1363 of file HTTPTransaction.h.
Referenced by flushWindowUpdate(), HTTPTransaction(), markEgressComplete(), sendBody(), sendBodyNow(), sendEOM(), sendEOMNow(), and sendHeadersWithOptionalEOM().
|
private |
Definition at line 1482 of file HTTPTransaction.h.
Referenced by sendBodyNow().
|
private |
Attributes of http2 Ex_HEADERS
Definition at line 1421 of file HTTPTransaction.h.
Referenced by HTTPTransaction().
|
private |
Definition at line 1463 of file HTTPTransaction.h.
Referenced by onIngressBody(), onIngressEOM(), and onIngressHeadersComplete().
|
private |
Definition at line 1464 of file HTTPTransaction.h.
Referenced by sendEOM(), and sendHeadersWithOptionalEOM().
|
private |
Set of all exTransaction IDs associated with this transaction.
Definition at line 1431 of file HTTPTransaction.h.
Referenced by onExTransaction().
|
private |
Definition at line 1475 of file HTTPTransaction.h.
|
private |
Definition at line 1476 of file HTTPTransaction.h.
Referenced by updateSessionBytesSheduled().
|
private |
Definition at line 1469 of file HTTPTransaction.h.
Referenced by updateHandlerPauseState(), and updateSessionBytesSheduled().
Definition at line 1361 of file HTTPTransaction.h.
Referenced by onDelayedDestroy(), onEgressTimeout(), onError(), onExTransaction(), onGoaway(), onIngressBody(), onIngressEOM(), onIngressTimeout(), onPushedTransaction(), processIngressBody(), processIngressChunkComplete(), processIngressChunkHeader(), processIngressEOM(), processIngressHeadersComplete(), processIngressTrailers(), processIngressUpgrade(), and updateHandlerPauseState().
|
private |
Definition at line 1470 of file HTTPTransaction.h.
Referenced by updateHandlerPauseState().
|
private |
Definition at line 1481 of file HTTPTransaction.h.
Referenced by onIngressHeadersComplete(), and sendHeadersWithOptionalEOM().
|
private |
Definition at line 1359 of file HTTPTransaction.h.
Referenced by describe(), HTTPTransaction(), onEgressTimeout(), onExTransaction(), onIngressBody(), onIngressChunkComplete(), onIngressChunkHeader(), onIngressEOM(), onIngressHeadersComplete(), onIngressTimeout(), onIngressTrailers(), onIngressUpgrade(), onPushedTransaction(), sendBodyNow(), and validateIngressStateTransition().
|
private |
Definition at line 1478 of file HTTPTransaction.h.
|
private |
Definition at line 1479 of file HTTPTransaction.h.
Referenced by onError(), and sendBodyNow().
|
private |
Definition at line 1467 of file HTTPTransaction.h.
Referenced by isExpectingIngress(), mustQueueIngress(), pauseIngress(), resumeIngress(), and sendEOM().
|
private |
Definition at line 1365 of file HTTPTransaction.h.
Referenced by flushWindowUpdate(), HTTPTransaction(), markIngressComplete(), sendEOM(), and validateIngressStateTransition().
|
private |
Definition at line 1477 of file HTTPTransaction.h.
Referenced by resumeIngress().
|
private |
Information about this transaction's priority.
insertDepth_ is the depth of this node in the tree when the txn was created currentDepth_ is the depth of this node in the tree after the last onPriorityUpdate. It may not reflect its real position in realtime, since after the last onPriorityUpdate, it may get reparented as parent transactions complete. cumulativeRatio_ / egressCalls_ is the average relative weight of this txn during egress
Definition at line 1449 of file HTTPTransaction.h.
Referenced by HTTPTransaction().
|
private |
If this transaction represents a request (ie, it is backed by an HTTPUpstreamSession) , this field indicates the last response status received from the server. If this transaction represents a response, this field indicates the last status we've sent. For instances, this could take on multiple 1xx values, and then take on 200.
Definition at line 1461 of file HTTPTransaction.h.
Referenced by onIngressHeadersComplete(), and sendHeadersWithOptionalEOM().
|
private |
Definition at line 1350 of file HTTPTransaction.h.
Referenced by resumeIngress().
|
private |
Definition at line 1488 of file HTTPTransaction.h.
Referenced by maybeDelayForRateLimit(), sendBodyNow(), and setEgressRateLimit().
|
private |
Definition at line 1462 of file HTTPTransaction.h.
Referenced by onDelayedDestroy().
|
private |
Priority of this transaction
Definition at line 1436 of file HTTPTransaction.h.
Referenced by onPriorityUpdate(), and updateAndSendPriority().
|
private |
Definition at line 1480 of file HTTPTransaction.h.
Referenced by HTTPTransaction(), and onPriorityUpdate().
|
private |
Definition at line 1497 of file HTTPTransaction.h.
Referenced by getPrioritySampleSummary(), onWriteReady(), setPrioritySampled(), updateContentionsCount(), updateRelativeWeight(), updateSessionBytesSheduled(), and updateTransactionBytesSent().
|
private |
Set of all push transactions IDs associated with this transaction.
Definition at line 1426 of file HTTPTransaction.h.
Referenced by onPushedTransaction().
|
private |
Handle to our position in the priority queue.
Definition at line 1406 of file HTTPTransaction.h.
Referenced by HTTPTransaction(), notifyTransportPendingEgress(), onPriorityUpdate(), updateAndSendPriority(), updateContentionsCount(), and ~HTTPTransaction().
|
private |
Definition at line 1342 of file HTTPTransaction.h.
Referenced by maybeDelayForRateLimit().
|
private |
bytes we need to acknowledge to the remote end using a window update
Definition at line 1411 of file HTTPTransaction.h.
Referenced by flushWindowUpdate(), getRecvToAck(), onIngressBody(), processIngressBody(), and setReceiveWindow().
|
private |
The recv window and associated data. This keeps track of how many bytes we are allowed to buffer.
Definition at line 1376 of file HTTPTransaction.h.
Referenced by flushWindowUpdate(), onDelayedDestroy(), onIngressBody(), processIngressBody(), reset(), resumeIngress(), and setReceiveWindow().
|
private |
The send window and associated data. This keeps track of how many bytes we are allowed to send and have outstanding.
Definition at line 1382 of file HTTPTransaction.h.
Referenced by isExpectingWindowUpdate(), notifyTransportPendingEgress(), onIngressSetSendWindow(), onIngressWindowUpdate(), reset(), sendBodyNow(), sendDeferredBody(), and updateHandlerPauseState().
|
private |
Definition at line 1360 of file HTTPTransaction.h.
Referenced by onIngressHeadersComplete().
|
private |
Definition at line 1487 of file HTTPTransaction.h.
Referenced by maybeDelayForRateLimit(), and setEgressRateLimit().
|
private |
Definition at line 1368 of file HTTPTransaction.h.
Referenced by HTTPTransaction(), updateHandlerPauseState(), and ~HTTPTransaction().
|
private |
Definition at line 1370 of file HTTPTransaction.h.
Referenced by getHPACKTableInfo(), updateEgressHPACKTableInfo(), and updateIngressHPACKTableInfo().
|
private |
Definition at line 1495 of file HTTPTransaction.h.
Referenced by maybeDelayForRateLimit().
|
private |
Trailers to send, if any.
Definition at line 1389 of file HTTPTransaction.h.
Referenced by sendBodyNow(), and sendEOMNow().
|
private |
Optional transaction timeout value.
Definition at line 1493 of file HTTPTransaction.h.
Referenced by setIdleTimeout().
|
private |
Definition at line 1362 of file HTTPTransaction.h.
Referenced by describe(), flushWindowUpdate(), markEgressComplete(), notifyTransportPendingEgress(), onDelayedDestroy(), onIngressHeadersComplete(), pauseIngress(), processIngressBody(), resumeIngress(), sendAbort(), sendBody(), sendBodyNow(), sendDeferredBody(), sendEOM(), sendEOMNow(), sendHeadersWithOptionalEOM(), and updateAndSendPriority().
|
private |
Definition at line 1384 of file HTTPTransaction.h.
Referenced by onDelayedDestroy(), onEgressBodyFirstByte(), onEgressBodyLastByte(), onEgressHeaderFirstByte(), onEgressLastByteAck(), onEgressTrackedByte(), onIngressBody(), onIngressHeadersComplete(), sendAbort(), sendDeferredBody(), sendEOM(), and sendHeadersWithOptionalEOM().
|
private |
Definition at line 1472 of file HTTPTransaction.h.
Referenced by flushWindowUpdate(), isExpectingWindowUpdate(), notifyTransportPendingEgress(), onIngressBody(), onIngressSetSendWindow(), onIngressWindowUpdate(), processIngressBody(), reset(), sendBodyNow(), sendDeferredBody(), setReceiveWindow(), and updateHandlerPauseState().