#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

void * operator new (size_t size)
 
void operator delete (void *address)
 
void * toCbdata () noexcept
 
 HttpStateData (FwdState *)
 
 ~HttpStateData ()
 
virtual const Comm::ConnectionPointerdataConnection () const
 
bool sendRequest ()
 
void processReplyHeader ()
 
void processReplyBody ()
 
void readReply (const CommIoCbParams &io)
 
virtual void maybeReadVirginBody ()
 read response data from the network More...
 
ReuseDecision::Answers reusableReply (ReuseDecision &decision)
 
void processSurrogateControl (HttpReply *)
 
virtual void noteMoreBodyDataAvailable (BodyPipe::Pointer)
 
virtual void noteBodyProductionEnded (BodyPipe::Pointer)
 
virtual void noteBodyProducerAborted (BodyPipe::Pointer)
 
virtual bool abortOnData (const char *reason)
 
virtual HttpRequestPointer originalRequest ()
 a hack to reach HttpStateData::orignal_request More...
 
virtual void noteAdaptationAnswer (const Adaptation::Answer &answer)
 
virtual void noteAdaptationAclCheckDone (Adaptation::ServiceGroupPointer group)
 
virtual void noteMoreBodySpaceAvailable (BodyPipe::Pointer)
 
virtual void noteBodyConsumerAborted (BodyPipe::Pointer)
 
virtual void swanSong ()
 
virtual bool doneAll () const
 whether positive goal has been reached More...
 
void serverComplete ()
 
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...
 

Static Public Member Functions

static void httpBuildRequestHeader (HttpRequest *request, StoreEntry *entry, const AccessLogEntryPointer &al, HttpHeader *hdr_out, const Http::StateFlags &flags)
 
static Pointer Start (AsyncJob *job)
 starts a freshly created job (i.e., makes the job asynchronous) More...
 

Public Attributes

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

Protected Member Functions

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...
 
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 > &)
 

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 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...
 
const InstanceId< AsyncJobid
 job identifier More...
 

Private Types

enum  ConnectionStatus {
  INCOMPLETE_MSG,
  COMPLETE_PERSISTENT_MSG,
  COMPLETE_NONPERSISTENT_MSG
}
 

Private Member Functions

ConnectionStatus statusIfComplete () const
 
ConnectionStatus persistentConnStatus () const
 
void keepaliveAccounting (HttpReply *)
 
void checkDateSkew (HttpReply *)
 
bool continueAfterParsingHeader ()
 
void truncateVirginBody ()
 
virtual void start ()
 called by AsyncStart; do not call directly More...
 
virtual void haveParsedReplyHeaders ()
 called when we have final (possibly adapted) reply headers; kids extend More...
 
virtual bool getMoreRequestBody (MemBuf &buf)
 either fill buf with available [encoded] request body bytes or return false More...
 
virtual void closeServer ()
 
virtual bool doneWithServer () const
 
virtual void abortAll (const char *reason)
 abnormal transaction termination; reason is for debugging only More...
 
virtual bool mayReadVirginReplyBody () const
 whether we may receive more virgin response body bytes More...
 
void abortTransaction (const char *reason)
 
bool maybeMakeSpaceAvailable (bool grow)
 
virtual void handleMoreRequestBodyAvailable ()
 
virtual void handleRequestBodyProducerAborted ()
 
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 ()
 
void requestBodyHandler (MemBuf &)
 
virtual void sentRequestBody (const CommIoCbParams &io)
 
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)
 
mb_size_t buildRequestPrefix (MemBuf *mb)
 
void forwardUpgrade (HttpHeader &)
 
bool peerSupportsConnectionPinning () const
 
const char * blockSwitchingProtocols (const HttpReply &) const
 
void serverComplete2 ()
 
void sendBodyIsTooLargeError ()
 
void maybePurgeOthers ()
 

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
 
int64_t payloadSeen
 amount of message payload/body received so far. More...
 
int64_t payloadTruncated
 positive when we read more than we wanted More...
 
bool sawDateGoBack
 
bool completed = false
 
HttpReplytheVirginReply = nullptr
 
HttpReplytheFinalReply = nullptr
 

Static Private Attributes

static cbdata_type CBDATA_HttpStateData = CBDATA_UNKNOWN
 

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 92 of file http.h.

Constructor & Destructor Documentation

◆ HttpStateData()

◆ ~HttpStateData()

HttpStateData::~HttpStateData ( )

Member Function Documentation

◆ abortAll()

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

Implements Client.

Definition at line 2652 of file http.cc.

References debugs, HERE(), 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 291 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 113 of file http.h.

References abortAll().

Referenced by handleRequestBodyProducerAborted(), 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 870 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 101 of file AsyncJob.cc.

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

◆ checkDateSkew()

void HttpStateData::checkDateSkew ( HttpReply reply)
private

◆ cleanAdaptation()

◆ clearAdaptation()

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

◆ closeServer()

void HttpStateData::closeServer ( )
privatevirtual

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 1733 of file http.cc.

References Comm::Connection::close(), closeHandler, comm_remove_close_handler(), debugs, Comm::Connection::fd, Client::fwd, HERE(), Comm::IsConnOpen(), NULL, 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
virtual
Returns
primary or "request data connection"

Implements Client.

Definition at line 147 of file http.cc.

References serverConnection.

◆ decideIfWeDoRanges()

bool HttpStateData::decideIfWeDoRanges ( HttpRequest orig_request)
staticprivate

◆ decodeAndWriteReplyBody()

◆ deleteThis()

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

◆ done()

bool AsyncJob::done ( ) const
protectedinherited

◆ doneAll()

bool Client::doneAll ( ) const
virtualinherited

Reimplemented from AsyncJob.

Definition at line 197 of file Client.cc.

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

◆ doneSendingRequestBody()

void HttpStateData::doneSendingRequestBody ( )
privatevirtual

◆ doneWithAdaptation()

bool Client::doneWithAdaptation ( ) const
protectedvirtualinherited

◆ doneWithServer()

bool HttpStateData::doneWithServer ( ) const
privatevirtual

did we end communication?

Implements Client.

Definition at line 1746 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 852 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()

void Client::endAdaptedBodyConsumption ( )
protectedinherited

◆ finalReply()

HttpReply * Client::finalReply ( )
protectedinherited

Definition at line 130 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 867 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

◆ 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 1866 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(), CC_NO_CACHE, Http::StateFlags::chunked_request, String::clean(), HttpRequest::client_addr, Config, Http::CONNECTION, copyOneHeaderFromClientsideRequestToUpstreamRequest(), DBG_IMPORTANT, debugs, decideIfWeDoRanges(), EBIT_SET, 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, HttpHdrCc::mask, MAX_IPSTRLEN, MAX_URL, HttpHdrCc::maxAge(), HttpRequest::multipartRangeRequest(), NULL, 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(), 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()

◆ 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 1640 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
privatevirtual

Implements Client.

Definition at line 1605 of file http.cc.

References doneWithServer().

◆ mustStop()

◆ noteAdaptationAclCheckDone()

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

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 923 of file Client.cc.

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

◆ noteAdaptationAnswer()

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

◆ noteBodyConsumerAborted()

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

◆ noteBodyProducerAborted()

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

◆ noteBodyProductionEnded()

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

◆ noteMoreBodyDataAvailable()

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

◆ noteMoreBodySpaceAvailable()

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

◆ operator delete()

void HttpStateData::operator delete ( void *  address)
inline

Definition at line 24 of file http.h.

◆ operator new()

void* HttpStateData::operator new ( size_t  size)
inline

Definition at line 24 of file http.h.

◆ 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 1168 of file http.cc.

References HttpReply::bodySize(), Http::StateFlags::chunked, COMPLETE_NONPERSISTENT_MSG, Http::Message::content_length, debugs, eof, flags, HERE(), 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 1324 of file http.cc.

References Client::adaptOrFinalizeReply(), continueAfterParsingHeader(), debugs, flags, Http::StateFlags::handling1xx, Http::StateFlags::headers_parsed, HERE(), Must, processReplyBody(), processReplyHeader(), PROF_start, and PROF_stop.

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

◆ processReplyBody()

◆ processReplyHeader()

void HttpStateData::processReplyHeader ( )

◆ processSurrogateControl()

◆ readReply()

◆ replyBodySpace()

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

◆ requestBodyHandler()

void HttpStateData::requestBodyHandler ( MemBuf )
private

◆ resumeBodyStorage()

◆ reusableReply()

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

Definition at line 321 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, HERE(), ignoreCacheControl, HttpStateData::ReuseDecision::make(), SquidConfig::negativeTtl, NULL, REFRESH_OVERRIDE, refreshIsCachable(), RELEASE_REQUEST, Client::request, HttpStateData::ReuseDecision::reuseNot, sawDateGoBack, Http::scBadGateway, Http::scBadRequest, Http::scConflict, 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::scPayloadTooLarge, 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)
privatevirtual

Implements Client.

Definition at line 2643 of file http.cc.

References StatCounters::http, Client::sentRequestBody(), StatCounters::server, CommIoCbParams::size, and statCounter.

Referenced by sendRequest().

◆ serverComplete()

◆ serverComplete2()

void Client::serverComplete2 ( )
privateinherited

◆ setFinalReply()

◆ setVirginReply()

HttpReply * Client::setVirginReply ( HttpReply r)
protectedinherited

◆ start()

void HttpStateData::start ( )
privatevirtual

◆ Start()

◆ startAdaptation()

◆ startRequestBodyFlow()

bool Client::startRequestBodyFlow ( )
protectedinherited

◆ status()

const char * AsyncJob::status ( ) const
protectedvirtualinherited

◆ 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?
Bug:
XXX BUG? If the origin server (HTTP/1.0) does not send a keep-alive header, but keeps the connection open anyway, what happens? We'll return here and http.c waits for an EOF before changing store_status to STORE_OK. Combine this with ENTRY_FWD_HDR_WAIT and an error status code, and we might have to wait until the server times out the socket.

Definition at line 1117 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 1011 of file Client.cc.

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

Referenced by Client::addVirginReplyBody().

◆ swanSong()

◆ toCbdata()

void* HttpStateData::toCbdata ( )
inlinevirtualnoexcept

Implements CbdataParent.

Definition at line 24 of file http.h.

◆ 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 1424 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 103 of file Client.cc.

References assert, and Client::theVirginReply.

◆ virginReply() [2/2]

◆ writeReplyBody()

void HttpStateData::writeReplyBody ( )
private

Call this when there is data from the origin server which should be sent to either StoreEntry, or to ICAP...

Definition at line 1452 of file http.cc.

References Client::addVirginReplyBody(), SBuf::consume(), data, inBuf, len, SBuf::length(), SBuf::rawContent(), and truncateVirginBody().

Referenced by processReplyBody().

◆ wroteLast()

Member Data Documentation

◆ _peer

CachePeer* HttpStateData::_peer

◆ adaptationAccessCheckPending

bool Client::adaptationAccessCheckPending = false
protectedinherited

◆ adaptedBodySource

◆ adaptedHeadSource

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

to get adapted response headers

Definition at line 174 of file Client.h.

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

◆ CBDATA_HttpStateData

cbdata_type HttpStateData::CBDATA_HttpStateData = CBDATA_UNKNOWN
staticprivate

Definition at line 24 of file http.h.

◆ closeHandler

AsyncCall::Pointer HttpStateData::closeHandler
private

◆ completed

bool Client::completed = false
privateinherited

serverComplete() has been called

Definition at line 86 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 184 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 149 of file http.h.

Referenced by processReplyHeader().

◆ httpChunkDecoder

Http1::TeChunkedParser* HttpStateData::httpChunkDecoder
private

Definition at line 150 of file http.h.

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

◆ id

const InstanceId<AsyncJob> AsyncJob::id
protectedinherited

Definition at line 72 of file AsyncJob.h.

◆ ignoreCacheControl

bool HttpStateData::ignoreCacheControl

◆ inBuf

◆ inCall

AsyncCall::Pointer AsyncJob::inCall
protectedinherited

◆ lastChunk

int HttpStateData::lastChunk

Definition at line 66 of file http.h.

Referenced by decodeAndWriteReplyBody(), persistentConnStatus(), and processReplyBody().

◆ payloadSeen

int64_t HttpStateData::payloadSeen
private

◆ payloadTruncated

int64_t HttpStateData::payloadTruncated
private

Definition at line 155 of file http.h.

Referenced by persistentConnStatus(), and truncateVirginBody().

◆ read_sz

size_t HttpStateData::read_sz

Definition at line 68 of file http.h.

◆ receivedWholeRequestBody

bool Client::receivedWholeRequestBody = false
protectedinherited

◆ request

◆ requestBodySource

◆ requestSender

◆ responseBodyBuffer

MemBuf* Client::responseBodyBuffer = nullptr
protectedinherited

◆ sawDateGoBack

bool HttpStateData::sawDateGoBack
private

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

Definition at line 159 of file http.h.

Referenced by haveParsedReplyHeaders(), and reusableReply().

◆ serverConnection

◆ startedAdaptation

bool Client::startedAdaptation = false
protectedinherited

◆ stopReason

const char* AsyncJob::stopReason
protectedinherited

◆ surrogateNoStore

bool HttpStateData::surrogateNoStore

Definition at line 71 of file http.h.

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

◆ theFinalReply

HttpReply* Client::theFinalReply = nullptr
privateinherited

adapted reply from ICAP or virgin reply

Definition at line 191 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 190 of file Client.h.

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

◆ typeName

◆ upgradeHeaderOut

String* HttpStateData::upgradeHeaderOut = nullptr

Definition at line 74 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