#include <http.h>

Inheritance diagram for HttpStateData:
Collaboration diagram for HttpStateData:


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...
void handleStopRequest ()
 process external request to terminate now (i.e. during this 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 void Start (const Pointer &job)

Public Attributes

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

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...
bool started_ = false
 Start() has finished successfully. More...
bool swanSang_ = false
 swanSong() was called More...

Private Types

enum  ConnectionStatus {

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


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)

Implements Client.

Definition at line 2611 of file http.cc.

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

Referenced by abortTransaction().

◆ abortOnBadEntry()

◆ abortOnData()

bool Client::abortOnData ( const char *  reason)

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)

Definition at line 113 of file http.h.

References abortAll().

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

◆ adaptOrFinalizeReply()

◆ adaptVirginReplyBody()

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

◆ addVirginReplyBody()

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

◆ adjustBodyBytesRead()

void Client::adjustBodyBytesRead ( const int64_t  delta)

◆ announceInitiatorAbort()

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

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
Return values
nilif the HTTP/101 (Switching Protocols) reply should be forwarded
reasonwhy an attempt to switch protocols should be stopped

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

◆ callEnd()

void AsyncJob::callEnd ( )

◆ callException()

◆ callStart()

void AsyncJob::callStart ( AsyncCall call)

◆ canBeCalled()

bool AsyncJob::canBeCalled ( AsyncCall call) const

Definition at line 102 of file AsyncJob.cc.

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

◆ checkDateSkew()

void HttpStateData::checkDateSkew ( HttpReply reply)

◆ cleanAdaptation()

◆ clearAdaptation()

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

◆ closeServer()

void HttpStateData::closeServer ( )

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 1698 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 ( )

◆ continueAfterParsingHeader()

bool HttpStateData::continueAfterParsingHeader ( )

◆ dataConnection()

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

Implements Client.

Definition at line 138 of file http.cc.

References serverConnection.

◆ decideIfWeDoRanges()

bool HttpStateData::decideIfWeDoRanges ( HttpRequest orig_request)

◆ decodeAndWriteReplyBody()

◆ deleteThis()

void AsyncJob::deleteThis ( const char *  aReason)

◆ done()

bool AsyncJob::done ( ) const

◆ doneAll()

bool Client::doneAll ( ) const

Reimplemented from AsyncJob.

Definition at line 197 of file Client.cc.

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

◆ doneSendingRequestBody()

void HttpStateData::doneSendingRequestBody ( )

◆ doneWithAdaptation()

bool Client::doneWithAdaptation ( ) const

◆ doneWithServer()

bool HttpStateData::doneWithServer ( ) const

did we end communication?

Implements Client.

Definition at line 1711 of file http.cc.

References Comm::IsConnOpen(), and serverConnection.

Referenced by mayReadVirginReplyBody().

◆ drop1xx()

void HttpStateData::drop1xx ( const char *  reason)

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

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

◆ finalReply()

HttpReply * Client::finalReply ( )

Definition at line 130 of file Client.cc.

References assert, and Client::theFinalReply.

Referenced by haveParsedReplyHeaders(), and reusableReply().

◆ finishingBrokenPost()

◆ finishingChunkedRequest()

bool HttpStateData::finishingChunkedRequest ( )

◆ forwardUpgrade()

◆ getMoreRequestBody()

◆ handle1xx()

◆ handleAdaptationAborted()

void Client::handleAdaptationAborted ( bool  bypassable = false)

◆ handleAdaptationBlocked()

◆ handleAdaptationCompleted()

◆ handleAdaptedBodyProducerAborted()

◆ handleAdaptedBodyProductionEnded()

void Client::handleAdaptedBodyProductionEnded ( )

◆ handleAdaptedHeader()

◆ handledEarlyAdaptationAbort()

bool Client::handledEarlyAdaptationAbort ( )

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 870 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 ( )

◆ handleStopRequest()

void AsyncJob::handleStopRequest ( )

Definition at line 71 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 
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 1831 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(), 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)

◆ httpTimeout()

◆ initiateAdaptation()

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

◆ initiated()

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

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)

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

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

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

Implements Client.

Definition at line 1570 of file http.cc.

References doneWithServer().

◆ mustStop()

◆ noteAdaptationAclCheckDone()

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

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 926 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)

◆ noteBodyConsumerAborted()

void Client::noteBodyConsumerAborted ( BodyPipe::Pointer  )

◆ noteBodyProducerAborted()

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

◆ noteBodyProductionEnded()

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

◆ noteMoreBodyDataAvailable()

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

◆ noteMoreBodySpaceAvailable()

void Client::noteMoreBodySpaceAvailable ( BodyPipe::Pointer  )

◆ operator delete()

void HttpStateData::operator delete ( void *  address)

Definition at line 24 of file http.h.

◆ operator new()

void* HttpStateData::operator new ( size_t  size)

Definition at line 24 of file http.h.

◆ originalRequest()

◆ peerSupportsConnectionPinning()

bool HttpStateData::peerSupportsConnectionPinning ( ) const

◆ persistentConnStatus()

HttpStateData::ConnectionStatus HttpStateData::persistentConnStatus ( ) const
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 1129 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 ( )

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

Definition at line 1285 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, HERE(), Must, processReplyBody(), processReplyHeader(), PROF_start, and PROF_stop.

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

◆ processReplyBody()

◆ processReplyHeader()

◆ processSurrogateControl()

◆ readReply()

◆ replyBodySpace()

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

◆ requestBodyHandler()

void HttpStateData::requestBodyHandler ( MemBuf )

◆ resumeBodyStorage()

◆ reusableReply()

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

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

◆ sendComplete()

void HttpStateData::sendComplete ( )

◆ sendMoreRequestBody()

◆ sendRequest()

◆ sentRequestBody()

void HttpStateData::sentRequestBody ( const CommIoCbParams io)

Implements Client.

Definition at line 2602 of file http.cc.

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

Referenced by sendRequest().

◆ serverComplete()

◆ serverComplete2()

void Client::serverComplete2 ( )

◆ setFinalReply()

◆ setVirginReply()

HttpReply * Client::setVirginReply ( HttpReply r)

◆ start()

void HttpStateData::start ( )

◆ Start()

◆ startAdaptation()

◆ startRequestBodyFlow()

bool Client::startRequestBodyFlow ( )

◆ status()

◆ statusIfComplete()

HttpStateData::ConnectionStatus HttpStateData::statusIfComplete ( ) const
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?
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 1078 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 

◆ storeReplyBody()

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

Definition at line 1014 of file Client.cc.

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

Referenced by Client::addVirginReplyBody().

◆ swanSong()

◆ toCbdata()

void* HttpStateData::toCbdata ( )

Implements CbdataParent.

Definition at line 24 of file http.h.

◆ truncateVirginBody()

void HttpStateData::truncateVirginBody ( )

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

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

Definition at line 103 of file Client.cc.

References assert, and Client::theVirginReply.

◆ virginReply() [2/2]

◆ writeReplyBody()

void HttpStateData::writeReplyBody ( )

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

Definition at line 1418 of file http.cc.

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

Referenced by processReplyBody().

◆ wroteLast()

Member Data Documentation

◆ _peer

CachePeer* HttpStateData::_peer

◆ adaptationAccessCheckPending

bool Client::adaptationAccessCheckPending = false

◆ adaptedBodySource

◆ adaptedHeadSource

CbcPointer<Adaptation::Initiate> Client::adaptedHeadSource

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

Definition at line 24 of file http.h.

◆ closeHandler

AsyncCall::Pointer HttpStateData::closeHandler

◆ completed

bool Client::completed = false

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

◆ doneWithFwd

const char* Client::doneWithFwd = nullptr

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

Definition at line 149 of file http.h.

Referenced by processReplyHeader().

◆ httpChunkDecoder

Http1::TeChunkedParser* HttpStateData::httpChunkDecoder

Definition at line 150 of file http.h.

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

◆ id

const InstanceId<AsyncJob> AsyncJob::id

Definition at line 73 of file AsyncJob.h.

◆ ignoreCacheControl

bool HttpStateData::ignoreCacheControl

◆ inBuf

◆ inCall

AsyncCall::Pointer AsyncJob::inCall

◆ lastChunk

int HttpStateData::lastChunk

Definition at line 66 of file http.h.

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

◆ payloadSeen

int64_t HttpStateData::payloadSeen

◆ payloadTruncated

int64_t HttpStateData::payloadTruncated

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

◆ request

◆ requestBodySource

◆ requestSender

◆ responseBodyBuffer

MemBuf* Client::responseBodyBuffer = nullptr

◆ sawDateGoBack

bool HttpStateData::sawDateGoBack

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

◆ started_

bool AsyncJob::started_ = false

Definition at line 83 of file AsyncJob.h.

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

◆ startedAdaptation

bool Client::startedAdaptation = false

◆ stopReason

const char* AsyncJob::stopReason

◆ surrogateNoStore

bool HttpStateData::surrogateNoStore

Definition at line 71 of file http.h.

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

◆ swanSang_

bool AsyncJob::swanSang_ = false

Definition at line 84 of file AsyncJob.h.

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

◆ theFinalReply

HttpReply* Client::theFinalReply = nullptr

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

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:






Web Site Translations