#include <http.h>

Inheritance diagram for HttpStateData:
Collaboration diagram for HttpStateData:

Classes

class  ReuseDecision
 assists in making and relaying entry caching/sharing decision More...
 

Public Types

typedef CbcPointer< AsyncJobPointer
 
typedef CbcPointer< BodyProducerPointer
 
typedef CbcPointer< BodyConsumerPointer
 

Public Member Functions

 HttpStateData (FwdState *)
 
 ~HttpStateData () override
 
const Comm::ConnectionPointerdataConnection () const override
 
bool sendRequest ()
 
void processReplyHeader ()
 
void processReplyBody () override
 
void readReply (const CommIoCbParams &io)
 
void maybeReadVirginBody () override
 read response data from the network More...
 
ReuseDecision::Answers reusableReply (ReuseDecision &decision)
 
void processSurrogateControl (HttpReply *)
 
void noteMoreBodyDataAvailable (BodyPipe::Pointer) override
 
void noteBodyProductionEnded (BodyPipe::Pointer) override
 
void noteBodyProducerAborted (BodyPipe::Pointer) override
 
virtual bool abortOnData (const char *reason)
 
virtual HttpRequestPointer originalRequest ()
 a hack to reach HttpStateData::orignal_request More...
 
void noteAdaptationAnswer (const Adaptation::Answer &answer) override
 
void noteAdaptationAclCheckDone (Adaptation::ServiceGroupPointer group) override
 
void noteMoreBodySpaceAvailable (BodyPipe::Pointer) override
 
void noteBodyConsumerAborted (BodyPipe::Pointer) override
 
void swanSong () override
 
bool doneAll () const override
 whether positive goal has been reached More...
 
void serverComplete ()
 
void markParsedVirginReplyAsWhole (const char *reasonWeAreSure)
 
bool canBeCalled (AsyncCall &call) const
 whether we can be called More...
 
void callStart (AsyncCall &call)
 
virtual void callEnd ()
 called right after the called job method More...
 
virtual void callException (const std::exception &e)
 called when the job throws during an async call More...
 
void handleStopRequest ()
 process external request to terminate now (i.e. during this async call) More...
 
virtual void * toCbdata ()=0
 

Static Public Member Functions

static void httpBuildRequestHeader (HttpRequest *request, StoreEntry *entry, const AccessLogEntryPointer &al, HttpHeader *hdr_out, const Http::StateFlags &flags)
 
static void Start (const Pointer &job)
 
static void RegisterWithCacheManager ()
 

Public Attributes

CachePeer_peer = nullptr
 
int eof = 0
 
int lastChunk = 0
 
Http::StateFlags flags
 
SBuf inBuf
 I/O buffer for receiving server responses. More...
 
bool ignoreCacheControl = false
 
bool surrogateNoStore = false
 
StringupgradeHeaderOut = nullptr
 Upgrade header value sent to the origin server or cache peer. More...
 
StoreEntryentry = nullptr
 
FwdState::Pointer fwd
 
HttpRequestPointer request
 
const InstanceId< AsyncJobid
 job identifier More...
 

Protected Member Functions

void noteDelayAwareReadChance () override
 
void processReply ()
 
void proceedAfter1xx ()
 restores state and resumes processing after 1xx is ignored or forwarded More...
 
void handle1xx (HttpReply *msg)
 ignore or start forwarding the 1xx response (a.k.a., control message) More...
 
void drop1xx (const char *reason)
 
virtual void completeForwarding ()
 
bool startRequestBodyFlow ()
 
void handleRequestBodyProductionEnded ()
 
void sendMoreRequestBody ()
 
bool abortOnBadEntry (const char *abortReason)
 Entry-dependent callbacks use this check to quit if the entry went bad. More...
 
bool blockCaching ()
 whether to prevent caching of an otherwise cachable response More...
 
void startAdaptation (const Adaptation::ServiceGroupPointer &group, HttpRequest *cause)
 Initiate an asynchronous adaptation transaction which will call us back. More...
 
void adaptVirginReplyBody (const char *buf, ssize_t len)
 
void cleanAdaptation ()
 
virtual bool doneWithAdaptation () const
 
void handleMoreAdaptedBodyAvailable ()
 
void handleAdaptedBodyProductionEnded ()
 
void handleAdaptedBodyProducerAborted ()
 
void handleAdaptedHeader (Http::Message *msg)
 
void handleAdaptationCompleted ()
 
void handleAdaptationBlocked (const Adaptation::Answer &answer)
 
void handleAdaptationAborted (bool bypassable=false)
 
bool handledEarlyAdaptationAbort ()
 
void resumeBodyStorage ()
 called by StoreEntry when it has more buffer space available More...
 
void endAdaptedBodyConsumption ()
 called when the entire adapted response body is consumed More...
 
const HttpReplyvirginReply () const
 
HttpReplyvirginReply ()
 
HttpReplysetVirginReply (HttpReply *r)
 
HttpReplyfinalReply ()
 
HttpReplysetFinalReply (HttpReply *r)
 
void adaptOrFinalizeReply ()
 
void addVirginReplyBody (const char *buf, ssize_t len)
 
void storeReplyBody (const char *buf, ssize_t len)
 
size_t replyBodySpace (const MemBuf &readBuf, const size_t minSpace) const
 
size_t calcBufferSpaceToReserve (const size_t space, const size_t wantSpace) const
 determine how much space the buffer needs to reserve More...
 
void adjustBodyBytesRead (const int64_t delta)
 initializes bodyBytesRead stats if needed and applies delta More...
 
void delayRead ()
 
CbcPointer< Initiate > initiateAdaptation (Initiate *x)
 < starts freshly created initiate and returns a safe pointer to it More...
 
void clearAdaptation (CbcPointer< Initiate > &x)
 clears the pointer (does not call announceInitiatorAbort) More...
 
void announceInitiatorAbort (CbcPointer< Initiate > &x)
 inform the transaction about abnormal termination and clear the pointer More...
 
bool initiated (const CbcPointer< AsyncJob > &job) const
 Must(initiated(initiate)) instead of Must(initiate.set()), for clarity. More...
 
void deleteThis (const char *aReason)
 
void mustStop (const char *aReason)
 
bool done () const
 the job is destroyed in callEnd() when done() More...
 
virtual const char * status () const
 internal cleanup; do not call directly More...
 
void stopProducingFor (RefCount< BodyPipe > &, bool atEof)
 
void stopConsumingFrom (RefCount< BodyPipe > &)
 

Static Protected Member Functions

static void ReportAllJobs (StoreEntry *)
 writes a cache manager report about all jobs existing in this worker More...
 

Protected Attributes

int64_t currentOffset = 0
 
MemBufresponseBodyBuffer = nullptr
 
BodyPipe::Pointer requestBodySource
 
AsyncCall::Pointer requestSender
 
BodyPipe::Pointer virginBodyDestination
 
CbcPointer< Adaptation::InitiateadaptedHeadSource
 
BodyPipe::Pointer adaptedBodySource
 
bool adaptationAccessCheckPending = false
 
bool startedAdaptation = false
 
bool receivedWholeAdaptedReply = false
 handleAdaptedBodyProductionEnded() was called More...
 
bool receivedWholeRequestBody = false
 handleRequestBodyProductionEnded called More...
 
const char * doneWithFwd = nullptr
 
const char * stopReason
 reason for forcing done() to be true More...
 
const char * typeName
 kid (leaf) class name, for debugging More...
 
AsyncCall::Pointer inCall
 the asynchronous call being handled, if any More...
 
bool started_ = false
 Start() has finished successfully. More...
 
bool swanSang_ = false
 swanSong() was called More...
 

Private Types

enum  ConnectionStatus {
  INCOMPLETE_MSG ,
  COMPLETE_PERSISTENT_MSG ,
  COMPLETE_NONPERSISTENT_MSG
}
 

Private Member Functions

 CBDATA_CHILD (HttpStateData)
 
ConnectionStatus statusIfComplete () const
 
ConnectionStatus persistentConnStatus () const
 
void keepaliveAccounting (HttpReply *)
 
void checkDateSkew (HttpReply *)
 
bool continueAfterParsingHeader ()
 
void truncateVirginBody ()
 
void start () override
 called by AsyncStart; do not call directly More...
 
void haveParsedReplyHeaders () override
 called when we have final (possibly adapted) reply headers; kids extend More...
 
bool getMoreRequestBody (MemBuf &buf) override
 either fill buf with available [encoded] request body bytes or return false More...
 
void closeServer () override
 
bool doneWithServer () const override
 
void abortAll (const char *reason) override
 abnormal transaction termination; reason is for debugging only More...
 
bool mayReadVirginReplyBody () const override
 whether we may receive more virgin response body bytes More...
 
void abortTransaction (const char *reason)
 
bool maybeMakeSpaceAvailable (bool grow)
 
virtual void handleMoreRequestBodyAvailable ()
 
void handleRequestBodyProducerAborted () override
 
void writeReplyBody ()
 
bool decodeAndWriteReplyBody ()
 
bool finishingBrokenPost ()
 if broken posts are enabled for the request, try to fix and return true More...
 
bool finishingChunkedRequest ()
 if needed, write last-chunk to end the request body and return true More...
 
void doneSendingRequestBody () override
 
void requestBodyHandler (MemBuf &)
 
void sentRequestBody (const CommIoCbParams &io) override
 
void wroteLast (const CommIoCbParams &io)
 called after writing the very last request byte (body, last-chunk, etc) More...
 
void sendComplete ()
 successfully wrote the entire request (including body, last-chunk, etc.) More...
 
void httpStateConnClosed (const CommCloseCbParams &params)
 
void httpTimeout (const CommTimeoutCbParams &params)
 
void markPrematureReplyBodyEofFailure ()
 called on a premature EOF discovered when reading response body More...
 
mb_size_t buildRequestPrefix (MemBuf *mb)
 
void forwardUpgrade (HttpHeader &)
 
bool peerSupportsConnectionPinning () const
 
const char * blockSwitchingProtocols (const HttpReply &) const
 
void serverComplete2 ()
 
void sendBodyIsTooLargeError ()
 
void maybePurgeOthers ()
 
virtual void finalizedInCbdataChild ()=0
 hack: ensure CBDATA_CHILD() after a toCbdata()-defining CBDATA_INTERMEDIATE() More...
 

Static Private Member Functions

static bool decideIfWeDoRanges (HttpRequest *orig_request)
 

Private Attributes

Comm::ConnectionPointer serverConnection
 
AsyncCall::Pointer closeHandler
 
Http1::ResponseParserPointer hp
 Parser being used at present to parse the HTTP/ICY server response. More...
 
Http1::TeChunkedParserhttpChunkDecoder = nullptr
 
int64_t payloadSeen = 0
 amount of message payload/body received so far. More...
 
int64_t payloadTruncated = 0
 positive when we read more than we wanted More...
 
bool sawDateGoBack = false
 
bool completed = false
 
HttpReplytheVirginReply = nullptr
 
HttpReplytheFinalReply = nullptr
 

Detailed Description

Definition at line 22 of file http.h.

Member Typedef Documentation

◆ Pointer [1/3]

Definition at line 34 of file AsyncJob.h.

◆ Pointer [2/3]

Definition at line 25 of file BodyPipe.h.

◆ Pointer [3/3]

Definition at line 45 of file BodyPipe.h.

Member Enumeration Documentation

◆ ConnectionStatus

Enumerator
INCOMPLETE_MSG 
COMPLETE_PERSISTENT_MSG 
COMPLETE_NONPERSISTENT_MSG 

Definition at line 94 of file http.h.

Constructor & Destructor Documentation

◆ HttpStateData()

◆ ~HttpStateData()

HttpStateData::~HttpStateData ( )
override

Member Function Documentation

◆ abortAll()

void HttpStateData::abortAll ( const char *  reason)
overrideprivatevirtual

Implements Client.

Definition at line 2615 of file http.cc.

References debugs, AsyncJob::mustStop(), and serverConnection.

Referenced by abortTransaction().

◆ abortOnBadEntry()

◆ abortOnData()

bool Client::abortOnData ( const char *  reason)
virtualinherited

abnormal data transfer termination

Return values
truethe transaction will be terminated (abortAll called)
falsethe transaction will survive

Reimplemented in Ftp::Relay.

Definition at line 311 of file Client.cc.

References Client::abortAll().

Referenced by Client::abortOnBadEntry(), Client::handleAdaptationBlocked(), Client::sendBodyIsTooLargeError(), and Client::sentRequestBody().

◆ abortTransaction()

void HttpStateData::abortTransaction ( const char *  reason)
inlineprivate

Definition at line 115 of file http.h.

References abortAll().

Referenced by handleRequestBodyProducerAborted(), processReply(), processReplyBody(), and readReply().

◆ adaptOrFinalizeReply()

◆ adaptVirginReplyBody()

void Client::adaptVirginReplyBody ( const char *  buf,
ssize_t  len 
)
protectedinherited

◆ addVirginReplyBody()

void Client::addVirginReplyBody ( const char *  buf,
ssize_t  len 
)
protectedinherited

◆ adjustBodyBytesRead()

void Client::adjustBodyBytesRead ( const int64_t  delta)
protectedinherited

◆ announceInitiatorAbort()

void Adaptation::Initiator::announceInitiatorAbort ( CbcPointer< Initiate > &  x)
protectedinherited

Definition at line 38 of file Initiator.cc.

References CallJobHere.

Referenced by ClientHttpRequest::~ClientHttpRequest(), and Client::cleanAdaptation().

◆ blockCaching()

◆ blockSwitchingProtocols()

const char * HttpStateData::blockSwitchingProtocols ( const HttpReply reply) const
private
Return values
nilif the HTTP/101 (Switching Protocols) reply should be forwarded
reasonwhy an attempt to switch protocols should be stopped

Definition at line 824 of file http.cc.

References Http::CONNECTION, debugs, HttpHeader::getList(), HttpHeader::has(), HttpHeader::hasListMember(), Http::Message::header, strListGetItem(), Http::UPGRADE, and upgradeHeaderOut.

Referenced by handle1xx().

◆ buildRequestPrefix()

◆ calcBufferSpaceToReserve()

size_t Client::calcBufferSpaceToReserve ( const size_t  space,
const size_t  wantSpace 
) const
protectedinherited

◆ callEnd()

void AsyncJob::callEnd ( )
virtualinherited

◆ callException()

◆ callStart()

void AsyncJob::callStart ( AsyncCall call)
inherited

◆ canBeCalled()

bool AsyncJob::canBeCalled ( AsyncCall call) const
inherited

Definition at line 117 of file AsyncJob.cc.

References AsyncCall::cancel(), debugs, and AsyncJob::inCall.

◆ CBDATA_CHILD()

HttpStateData::CBDATA_CHILD ( HttpStateData  )
private

◆ checkDateSkew()

void HttpStateData::checkDateSkew ( HttpReply reply)
private

◆ cleanAdaptation()

◆ clearAdaptation()

void Adaptation::Initiator::clearAdaptation ( CbcPointer< Initiate > &  x)
protectedinherited

◆ closeServer()

void HttpStateData::closeServer ( )
overrideprivatevirtual

Use this to end communication with the server. The call cancels our closure handler and tells FwdState to forget about the connection.

Implements Client.

Definition at line 1702 of file http.cc.

References Comm::Connection::close(), closeHandler, comm_remove_close_handler(), debugs, Comm::Connection::fd, Client::fwd, Comm::IsConnOpen(), serverConnection, and FwdState::unregister().

Referenced by continueAfterParsingHeader(), drop1xx(), handleMoreRequestBodyAvailable(), httpTimeout(), readReply(), and wroteLast().

◆ completeForwarding()

void Client::completeForwarding ( )
protectedvirtualinherited

◆ continueAfterParsingHeader()

bool HttpStateData::continueAfterParsingHeader ( )
private

◆ dataConnection()

const Comm::ConnectionPointer & HttpStateData::dataConnection ( ) const
overridevirtual
Returns
primary or "request data connection"

Implements Client.

Definition at line 131 of file http.cc.

References serverConnection.

◆ decideIfWeDoRanges()

bool HttpStateData::decideIfWeDoRanges ( HttpRequest orig_request)
staticprivate

◆ decodeAndWriteReplyBody()

◆ delayRead()

void Client::delayRead ( )
protectedinherited

Defer reading until it is likely to become possible. Eventually, noteDelayAwareReadChance() will be called.

Definition at line 1029 of file Client.cc.

References asyncCall(), MemObject::delayRead(), Client::entry, StoreEntry::mem(), and Client::noteDelayAwareReadChance().

Referenced by readReply().

◆ deleteThis()

void AsyncJob::deleteThis ( const char *  aReason)
protectedinherited

◆ done()

bool AsyncJob::done ( ) const
protectedinherited

◆ doneAll()

bool Client::doneAll ( ) const
overridevirtualinherited

Reimplemented from AsyncJob.

Definition at line 217 of file Client.cc.

References AsyncJob::doneAll(), Client::doneWithAdaptation(), and Client::doneWithServer().

◆ doneSendingRequestBody()

void HttpStateData::doneSendingRequestBody ( )
overrideprivatevirtual

◆ doneWithAdaptation()

bool Client::doneWithAdaptation ( ) const
protectedvirtualinherited

◆ doneWithServer()

bool HttpStateData::doneWithServer ( ) const
overrideprivatevirtual

did we end communication?

Implements Client.

Definition at line 1715 of file http.cc.

References Comm::IsConnOpen(), and serverConnection.

Referenced by mayReadVirginReplyBody().

◆ drop1xx()

void HttpStateData::drop1xx ( const char *  reason)
protected

if possible, safely ignores the received 1xx control message otherwise, terminates the server connection

Definition at line 806 of file http.cc.

References FwdState::al, closeServer(), debugs, ERR_INVALID_RESP, FwdState::fail(), flags, Client::fwd, RefCount< C >::getRaw(), AsyncJob::mustStop(), proceedAfter1xx(), Client::request, Http::scBadGateway, and Http::StateFlags::serverSwitchedProtocols.

Referenced by handle1xx().

◆ endAdaptedBodyConsumption()

◆ finalizedInCbdataChild()

virtual void CbdataParent::finalizedInCbdataChild ( )
privatepure virtualinherited

◆ finalReply()

HttpReply * Client::finalReply ( )
protectedinherited

Definition at line 129 of file Client.cc.

References assert, and Client::theFinalReply.

Referenced by haveParsedReplyHeaders(), and reusableReply().

◆ finishingBrokenPost()

◆ finishingChunkedRequest()

bool HttpStateData::finishingChunkedRequest ( )
private

◆ forwardUpgrade()

◆ getMoreRequestBody()

◆ handle1xx()

◆ handleAdaptationAborted()

void Client::handleAdaptationAborted ( bool  bypassable = false)
protectedinherited

◆ handleAdaptationBlocked()

◆ handleAdaptationCompleted()

◆ handleAdaptedBodyProducerAborted()

◆ handleAdaptedBodyProductionEnded()

void Client::handleAdaptedBodyProductionEnded ( )
protectedinherited

◆ handleAdaptedHeader()

◆ handledEarlyAdaptationAbort()

bool Client::handledEarlyAdaptationAbort ( )
protectedinherited

If the store entry is still empty, fully handles adaptation abort, returning true. Otherwise just updates the request error detail and returns false.

Definition at line 901 of file Client.cc.

References Client::abortAll(), FwdState::al, debugs, HttpRequest::detailError(), FwdState::dontRetry(), Client::entry, ERR_ICAP_FAILURE, FwdState::fail(), Client::fwd, RefCount< C >::getRaw(), StoreEntry::isEmpty(), MakeNamedErrorDetail(), Client::request, and Http::scInternalServerError.

Referenced by Client::handleAdaptationAborted(), and Client::handleAdaptedBodyProducerAborted().

◆ handleMoreAdaptedBodyAvailable()

◆ handleMoreRequestBodyAvailable()

◆ handleRequestBodyProducerAborted()

◆ handleRequestBodyProductionEnded()

void Client::handleRequestBodyProductionEnded ( )
protectedinherited

◆ handleStopRequest()

void AsyncJob::handleStopRequest ( )
inlineinherited

Definition at line 73 of file AsyncJob.h.

References AsyncJob::mustStop().

◆ haveParsedReplyHeaders()

◆ httpBuildRequestHeader()

void HttpStateData::httpBuildRequestHeader ( HttpRequest request,
StoreEntry entry,
const AccessLogEntryPointer al,
HttpHeader hdr_out,
const Http::StateFlags flags 
)
static
Precondition
Handle X-Forwarded-For

If set to ON - append client IP or 'unknown'.

If set to OFF - append 'unknown'.

If set to TRANSPARENT - pass through unchanged.

If set to TRUNCATE - drop existing list and replace with client IP or 'unknown'.

If set to DELETE - do not copy through.

Definition at line 1835 of file http.cc.

References SquidConfig::Accel, RequestFlags::accelerated, HttpHeader::addEntry(), HttpHeader::addVia(), assert, AnyP::Uri::authority(), Http::AUTHORIZATION, base64_encode_final(), base64_encode_init(), base64_encode_len, base64_encode_update(), BBUF_SZ, SBuf::c_str(), RequestFlags::cachable, String::canGrowBy(), Http::StateFlags::chunked_request, String::clean(), HttpRequest::client_addr, Config, Http::CONNECTION, copyOneHeaderFromClientsideRequestToUpstreamRequest(), DBG_IMPORTANT, debugs, decideIfWeDoRanges(), HttpRequest::effectiveRequestUri(), Client::entry, HttpRequest::etag, flags, HttpRequest::flags, Http::FRONT_END_HTTPS, Http::StateFlags::front_end_https, HttpHeader::getCc(), HttpHeader::getEntry(), HttpHeader::getList(), getMaxAge(), AnyP::Uri::getScheme(), HttpHeader::has(), HttpHdrCc::hasMaxAge(), HttpHdrCc::hasNoCache(), Http::Message::header, hoRequest, Http::HOST, Http::Message::http_ver, httpFixupAuthentication(), httpHdrMangleList(), HttpHeaderInitPos, httpHeaderPutStrf(), Http::IF_MODIFIED_SINCE, Http::IF_NONE_MATCH, HttpRequest::ignoreRange(), Ip::Address::isNoAddr(), RequestFlags::isRanged, Http::StateFlags::keepalive, HttpRequest::lastmod, LOCAL_ARRAY, MAX_IPSTRLEN, MAX_URL, HttpHdrCc::maxAge(), HttpRequest::multipartRangeRequest(), Http::StateFlags::only_if_cached, HttpHdrCc::onlyIfCached(), opt_forwarded_for, HttpHeader::owner, HttpRequest::peer_domain, AnyP::PROTO_HTTPS, HttpHeader::putCc(), HttpHeader::putStr(), HttpHeader::putTime(), Client::request, ROR_REQUEST, String::size(), strListAdd(), Http::SURROGATE_CAPABILITY, SquidConfig::surrogate_id, String::termedBuf(), Http::StateFlags::toOrigin, Ip::Address::toStr(), Http::TRANSFER_ENCODING, HttpRequest::url, StoreEntry::url(), AnyP::Uri::userInfo(), SupportOrVeto::veto(), and Http::X_FORWARDED_FOR.

Referenced by buildRequestPrefix(), htcpClear(), htcpQuery(), and Http::Tunneler::writeRequest().

◆ httpStateConnClosed()

void HttpStateData::httpStateConnClosed ( const CommCloseCbParams params)
private

◆ httpTimeout()

◆ initiateAdaptation()

CbcPointer< Adaptation::Initiate > Adaptation::Initiator::initiateAdaptation ( Initiate x)
protectedinherited

◆ initiated()

bool Adaptation::Initiator::initiated ( const CbcPointer< AsyncJob > &  job) const
inlineprotectedinherited

Definition at line 52 of file Initiator.h.

References CbcPointer< Cbc >::set().

Referenced by ClientHttpRequest::startAdaptation(), and Client::startAdaptation().

◆ keepaliveAccounting()

◆ markParsedVirginReplyAsWhole()

void Client::markParsedVirginReplyAsWhole ( const char *  reasonWeAreSure)
inherited

remember that the received virgin reply was parsed in its entirety, including its body (if any)

Definition at line 158 of file Client.cc.

References assert, debugs, Client::fwd, FwdState::markStoredReplyAsWhole(), and Client::startedAdaptation.

Referenced by decodeAndWriteReplyBody(), ftpReadTransferDone(), and writeReplyBody().

◆ markPrematureReplyBodyEofFailure()

void HttpStateData::markPrematureReplyBodyEofFailure ( )
private

◆ maybeMakeSpaceAvailable()

bool HttpStateData::maybeMakeSpaceAvailable ( bool  grow)
private

determine if read buffer can have space made available for a read.

Parameters
growwhether to actually expand the buffer
Returns
whether the buffer can be grown to provide space regardless of whether the grow actually happened.

Definition at line 1609 of file http.cc.

References Client::calcBufferSpaceToReserve(), Config, DBG_DATA, debugs, Http::StateFlags::do_next_read, flags, Http::StateFlags::headers_parsed, inBuf, SBuf::length(), SquidConfig::maxReplyHeaderSize, processReply(), SquidConfig::readAheadGap, SBuf::reserveSpace(), serverConnection, and SBuf::spaceSize().

Referenced by maybeReadVirginBody(), and readReply().

◆ maybePurgeOthers()

◆ maybeReadVirginBody()

◆ mayReadVirginReplyBody()

bool HttpStateData::mayReadVirginReplyBody ( ) const
overrideprivatevirtual

Implements Client.

Definition at line 1574 of file http.cc.

References doneWithServer().

◆ mustStop()

◆ noteAdaptationAclCheckDone()

void Client::noteAdaptationAclCheckDone ( Adaptation::ServiceGroupPointer  group)
overridevirtualinherited

AccessCheck calls this back with a possibly nil service group to signal whether adaptation is needed and where it should start.

Reimplemented from Adaptation::Initiator.

Definition at line 957 of file Client.cc.

References Client::abortOnBadEntry(), Client::adaptationAccessCheckPending, debugs, Client::originalRequest(), Client::processReplyBody(), Client::request, Client::sendBodyIsTooLargeError(), Client::setFinalReply(), Client::startAdaptation(), and Client::virginReply().

◆ noteAdaptationAnswer()

void Client::noteAdaptationAnswer ( const Adaptation::Answer answer)
overridevirtualinherited

◆ noteBodyConsumerAborted()

void Client::noteBodyConsumerAborted ( BodyPipe::Pointer  )
overridevirtualinherited

◆ noteBodyProducerAborted()

void Client::noteBodyProducerAborted ( BodyPipe::Pointer  bp)
overridevirtualinherited

◆ noteBodyProductionEnded()

void Client::noteBodyProductionEnded ( BodyPipe::Pointer  bp)
overridevirtualinherited

◆ noteDelayAwareReadChance()

void HttpStateData::noteDelayAwareReadChance ( )
overrideprotectedvirtual

Called when a previously delayed dataConnection() read may be possible.

See also
delayRead()

Implements Client.

Definition at line 1163 of file http.cc.

References Http::StateFlags::do_next_read, flags, and maybeReadVirginBody().

◆ noteMoreBodyDataAvailable()

void Client::noteMoreBodyDataAvailable ( BodyPipe::Pointer  bp)
overridevirtualinherited

◆ noteMoreBodySpaceAvailable()

void Client::noteMoreBodySpaceAvailable ( BodyPipe::Pointer  )
overridevirtualinherited

◆ originalRequest()

◆ peerSupportsConnectionPinning()

bool HttpStateData::peerSupportsConnectionPinning ( ) const
private

◆ persistentConnStatus()

HttpStateData::ConnectionStatus HttpStateData::persistentConnStatus ( ) const
private
In chunked response we do not know the content length but we are absolutely sure about the end of response, so we are calling the statusIfComplete to decide if we can be persistent
If the body size is known, we must wait until we've gotten all of it.
If there is no message body or we got it all, we can be persistent

Definition at line 1113 of file http.cc.

References HttpReply::bodySize(), Http::StateFlags::chunked, COMPLETE_NONPERSISTENT_MSG, Http::Message::content_length, debugs, eof, flags, INCOMPLETE_MSG, Comm::IsConnOpen(), lastChunk, HttpRequest::method, payloadSeen, payloadTruncated, Client::request, serverConnection, statusIfComplete(), and Client::virginReply().

Referenced by processReplyBody().

◆ proceedAfter1xx()

◆ processReply()

void HttpStateData::processReply ( )
protected

processes the already read and buffered response data, possibly after waiting for asynchronous 1xx control message processing

Definition at line 1266 of file http.cc.

References abortTransaction(), Client::adaptOrFinalizeReply(), continueAfterParsingHeader(), debugs, EBIT_TEST, Client::entry, ENTRY_ABORTED, flags, StoreEntry::flags, Http::StateFlags::handling1xx, Http::StateFlags::headers_parsed, Must, processReplyBody(), and processReplyHeader().

Referenced by maybeMakeSpaceAvailable(), proceedAfter1xx(), and readReply().

◆ processReplyBody()

◆ processReplyHeader()

◆ processSurrogateControl()

◆ readReply()

◆ RegisterWithCacheManager()

void AsyncJob::RegisterWithCacheManager ( )
staticinherited

Definition at line 215 of file AsyncJob.cc.

References Mgr::RegisterAction(), and AsyncJob::ReportAllJobs().

Referenced by mainInitialize().

◆ replyBodySpace()

size_t Client::replyBodySpace ( const MemBuf readBuf,
const size_t  minSpace 
) const
protectedinherited

◆ ReportAllJobs()

void AsyncJob::ReportAllJobs ( StoreEntry e)
staticprotectedinherited

Definition at line 198 of file AsyncJob.cc.

References AllJobs().

Referenced by AsyncJob::RegisterWithCacheManager().

◆ requestBodyHandler()

void HttpStateData::requestBodyHandler ( MemBuf )
private

◆ resumeBodyStorage()

◆ reusableReply()

HttpStateData::ReuseDecision::Answers HttpStateData::reusableReply ( HttpStateData::ReuseDecision decision)

Definition at line 295 of file http.cc.

References HttpStateData::ReuseDecision::answer, RequestFlags::auth, RequestFlags::authSent, Http::Message::cache_control, HttpStateData::ReuseDecision::cacheNegatively, HttpStateData::ReuseDecision::cachePositively, Config, Http::CONTENT_TYPE, HttpReply::date, debugs, HttpStateData::ReuseDecision::doNotCacheButShare, EBIT_TEST, Client::entry, HttpReply::expires, Client::finalReply(), HttpRequest::flags, StoreEntry::flags, HttpHeader::getStr(), HttpHdrCc::hasMustRevalidate(), HttpHdrCc::hasNoCacheWithoutParameters(), HttpHdrCc::hasNoCacheWithParameters(), HttpHdrCc::hasNoStore(), HttpHdrCc::hasPrivate(), HttpHdrCc::hasPublic(), HttpHdrCc::hasSMaxAge(), Http::Message::header, ignoreCacheControl, HttpStateData::ReuseDecision::make(), SquidConfig::negativeTtl, REFRESH_OVERRIDE, refreshIsCachable(), RELEASE_REQUEST, Client::request, HttpStateData::ReuseDecision::reuseNot, sawDateGoBack, Http::scBadGateway, Http::scBadRequest, Http::scConflict, Http::scContentTooLarge, Http::scExpectationFailed, Http::scFailedDependency, Http::scForbidden, Http::scFound, Http::scGatewayTimeout, Http::scGone, Http::scHeaderTooLarge, Http::scInsufficientStorage, Http::scInternalServerError, Http::scInvalidHeader, Http::scLengthRequired, Http::scLocked, Http::scMethodNotAllowed, Http::scMisdirectedRequest, Http::scMovedPermanently, Http::scMultipleChoices, Http::scNoContent, Http::scNonAuthoritativeInformation, Http::scNotAcceptable, Http::scNotFound, Http::scNotImplemented, Http::scNotModified, Http::scOkay, Http::scPartialContent, Http::scPaymentRequired, Http::scPermanentRedirect, Http::scPreconditionFailed, Http::scProxyAuthenticationRequired, Http::scRequestedRangeNotSatisfied, Http::scRequestTimeout, Http::scSeeOther, Http::scServiceUnavailable, Http::scTemporaryRedirect, Http::scUnauthorized, Http::scUnprocessableEntity, Http::scUnsupportedMediaType, Http::scUriTooLong, Http::scUseProxy, HttpReply::sline, Http::StatusLine::status(), and surrogateNoStore.

Referenced by haveParsedReplyHeaders().

◆ sendBodyIsTooLargeError()

void Client::sendBodyIsTooLargeError ( )
privateinherited

◆ sendComplete()

void HttpStateData::sendComplete ( )
private

◆ sendMoreRequestBody()

◆ sendRequest()

◆ sentRequestBody()

void HttpStateData::sentRequestBody ( const CommIoCbParams io)
overrideprivatevirtual

◆ serverComplete()

◆ serverComplete2()

void Client::serverComplete2 ( )
privateinherited

◆ setFinalReply()

◆ setVirginReply()

HttpReply * Client::setVirginReply ( HttpReply r)
protectedinherited

◆ start()

void HttpStateData::start ( )
overrideprivatevirtual

◆ Start()

◆ startAdaptation()

◆ startRequestBodyFlow()

bool Client::startRequestBodyFlow ( )
protectedinherited

◆ status()

◆ statusIfComplete()

HttpStateData::ConnectionStatus HttpStateData::statusIfComplete ( ) const
private
If the reply wants to close the connection, it takes precedence
If we sent a Connection:close request header, then this can not be a persistent connection.
If we banned reuse, then this cannot be a persistent connection.
If we haven't sent the whole request then this can not be a persistent connection.
What does the reply have to say about keep-alive?

Definition at line 1063 of file http.cc.

References COMPLETE_NONPERSISTENT_MSG, COMPLETE_PERSISTENT_MSG, debugs, Client::entry, flags, Http::StateFlags::forceClose, Http::Message::header, httpHeaderHasConnDir(), HttpReply::keep_alive, Http::StateFlags::keepalive, HttpRequest::method, Client::request, Http::StateFlags::request_sent, StoreEntry::url(), and Client::virginReply().

Referenced by persistentConnStatus().

◆ stopConsumingFrom()

◆ stopProducingFor()

void BodyProducer::stopProducingFor ( RefCount< BodyPipe > &  p,
bool  atEof 
)
protectedinherited

◆ storeReplyBody()

void Client::storeReplyBody ( const char *  buf,
ssize_t  len 
)
protectedinherited

Definition at line 1054 of file Client.cc.

References Client::currentOffset, Client::entry, and StoreEntry::write().

Referenced by Client::addVirginReplyBody().

◆ swanSong()

◆ toCbdata()

virtual void * CbdataParent::toCbdata ( )
pure virtualinherited

◆ truncateVirginBody()

void HttpStateData::truncateVirginBody ( )
private

truncate what we read if we read too much so that writeReplyBody() writes no more than what we should have read

Definition at line 1367 of file http.cc.

References assert, SBuf::chop(), Http::Message::content_length, debugs, HttpReply::expectingBody(), flags, Http::StateFlags::headers_parsed, inBuf, SBuf::length(), HttpRequest::method, payloadSeen, payloadTruncated, Client::request, and Client::virginReply().

Referenced by writeReplyBody().

◆ virginReply() [1/2]

HttpReply * Client::virginReply ( )
protectedinherited

Definition at line 102 of file Client.cc.

References assert, and Client::theVirginReply.

◆ virginReply() [2/2]

◆ writeReplyBody()

void HttpStateData::writeReplyBody ( )
private

◆ wroteLast()

Member Data Documentation

◆ _peer

CachePeer* HttpStateData::_peer = nullptr

◆ adaptationAccessCheckPending

bool Client::adaptationAccessCheckPending = false
protectedinherited

◆ adaptedBodySource

◆ adaptedHeadSource

CbcPointer<Adaptation::Initiate> Client::adaptedHeadSource
protectedinherited

to get adapted response headers

Definition at line 186 of file Client.h.

Referenced by Client::cleanAdaptation(), Client::doneWithAdaptation(), Client::noteAdaptationAnswer(), and Client::startAdaptation().

◆ closeHandler

AsyncCall::Pointer HttpStateData::closeHandler
private

◆ completed

bool Client::completed = false
privateinherited

serverComplete() has been called

Definition at line 90 of file Client.h.

Referenced by Client::noteMoreBodySpaceAvailable(), and Client::serverComplete().

◆ currentOffset

int64_t Client::currentOffset = 0
protectedinherited

◆ doneWithFwd

const char* Client::doneWithFwd = nullptr
protectedinherited

whether we should not be talking to FwdState; XXX: clear fwd instead points to a string literal which is used only for debugging

Definition at line 199 of file Client.h.

Referenced by Client::completeForwarding(), httpStateConnClosed(), proceedAfter1xx(), and Client::swanSong().

◆ entry

◆ eof

◆ flags

◆ fwd

◆ hp

Http1::ResponseParserPointer HttpStateData::hp
private

Definition at line 152 of file http.h.

Referenced by processReplyHeader().

◆ httpChunkDecoder

Http1::TeChunkedParser* HttpStateData::httpChunkDecoder = nullptr
private

Definition at line 153 of file http.h.

Referenced by ~HttpStateData(), decodeAndWriteReplyBody(), and processReplyHeader().

◆ id

const InstanceId<AsyncJob> AsyncJob::id
inherited

Definition at line 75 of file AsyncJob.h.

◆ ignoreCacheControl

bool HttpStateData::ignoreCacheControl = false

Definition at line 69 of file http.h.

Referenced by haveParsedReplyHeaders(), processSurrogateControl(), and reusableReply().

◆ inBuf

◆ inCall

AsyncCall::Pointer AsyncJob::inCall
protectedinherited

◆ lastChunk

int HttpStateData::lastChunk = 0

Definition at line 66 of file http.h.

Referenced by decodeAndWriteReplyBody(), and persistentConnStatus().

◆ payloadSeen

int64_t HttpStateData::payloadSeen = 0
private

◆ payloadTruncated

int64_t HttpStateData::payloadTruncated = 0
private

Definition at line 158 of file http.h.

Referenced by persistentConnStatus(), truncateVirginBody(), and writeReplyBody().

◆ receivedWholeAdaptedReply

bool Client::receivedWholeAdaptedReply = false
protectedinherited

◆ receivedWholeRequestBody

bool Client::receivedWholeRequestBody = false
protectedinherited

◆ request

◆ requestBodySource

◆ requestSender

◆ responseBodyBuffer

MemBuf* Client::responseBodyBuffer = nullptr
protectedinherited

◆ sawDateGoBack

bool HttpStateData::sawDateGoBack = false
private

Whether we received a Date header older than that of a matching cached response.

Definition at line 162 of file http.h.

Referenced by haveParsedReplyHeaders(), and reusableReply().

◆ serverConnection

◆ started_

bool AsyncJob::started_ = false
protectedinherited

Definition at line 88 of file AsyncJob.h.

Referenced by AsyncJob::~AsyncJob(), AsyncJob::callEnd(), and AsyncJob::Start().

◆ startedAdaptation

bool Client::startedAdaptation = false
protectedinherited

◆ stopReason

const char* AsyncJob::stopReason
protectedinherited

◆ surrogateNoStore

bool HttpStateData::surrogateNoStore = false

Definition at line 70 of file http.h.

Referenced by processSurrogateControl(), and reusableReply().

◆ swanSang_

bool AsyncJob::swanSang_ = false
protectedinherited

Definition at line 89 of file AsyncJob.h.

Referenced by AsyncJob::~AsyncJob(), and AsyncJob::callEnd().

◆ theFinalReply

HttpReply* Client::theFinalReply = nullptr
privateinherited

adapted reply from ICAP or virgin reply

Definition at line 206 of file Client.h.

Referenced by Client::~Client(), Client::finalReply(), Client::haveParsedReplyHeaders(), Client::maybePurgeOthers(), and Client::setFinalReply().

◆ theVirginReply

HttpReply* Client::theVirginReply = nullptr
privateinherited

reply received from the origin server

Definition at line 205 of file Client.h.

Referenced by Client::~Client(), Client::setVirginReply(), and Client::virginReply().

◆ typeName

◆ upgradeHeaderOut

String* HttpStateData::upgradeHeaderOut = nullptr

Definition at line 73 of file http.h.

Referenced by ~HttpStateData(), blockSwitchingProtocols(), and buildRequestPrefix().

◆ virginBodyDestination


The documentation for this class was generated from the following files:

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors