#include <Client.h>


Public Types | |
typedef CbcPointer< AsyncJob > | Pointer |
typedef CbcPointer< BodyProducer > | Pointer |
typedef CbcPointer< BodyConsumer > | Pointer |
Public Member Functions | |
Client (FwdState *) | |
virtual | ~Client () |
virtual const Comm::ConnectionPointer & | dataConnection () const =0 |
virtual void | noteMoreBodyDataAvailable (BodyPipe::Pointer) |
virtual void | noteBodyProductionEnded (BodyPipe::Pointer) |
virtual void | noteBodyProducerAborted (BodyPipe::Pointer) |
virtual void | maybeReadVirginBody ()=0 |
read response data from the network More... | |
virtual void | abortAll (const char *reason)=0 |
abnormal transaction termination; reason is for debugging only More... | |
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 bool | getMoreRequestBody (MemBuf &buf) |
either fill buf with available [encoded] request body bytes or return false More... | |
virtual void | processReplyBody ()=0 |
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... | |
virtual void * | toCbdata ()=0 |
Static Public Member Functions | |
static Pointer | Start (AsyncJob *job) |
starts a freshly created job (i.e., makes the job asynchronous) More... | |
Public Attributes | |
StoreEntry * | entry = nullptr |
FwdState::Pointer | fwd |
HttpRequestPointer | request |
Protected Member Functions | |
virtual void | haveParsedReplyHeaders () |
called when we have final (possibly adapted) reply headers; kids extend More... | |
virtual void | completeForwarding () |
bool | startRequestBodyFlow () |
void | handleMoreRequestBodyAvailable () |
void | handleRequestBodyProductionEnded () |
virtual void | handleRequestBodyProducerAborted ()=0 |
void | sendMoreRequestBody () |
virtual void | sentRequestBody (const CommIoCbParams &io)=0 |
virtual void | doneSendingRequestBody ()=0 |
virtual void | closeServer ()=0 |
virtual bool | doneWithServer () const =0 |
virtual bool | mayReadVirginReplyBody () const =0 |
whether we may receive more virgin response body bytes More... | |
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 HttpReply * | virginReply () const |
HttpReply * | virginReply () |
HttpReply * | setVirginReply (HttpReply *r) |
HttpReply * | finalReply () |
HttpReply * | setFinalReply (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 void | start () |
called by AsyncStart; do not call directly 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 |
MemBuf * | responseBodyBuffer = nullptr |
BodyPipe::Pointer | requestBodySource |
AsyncCall::Pointer | requestSender |
BodyPipe::Pointer | virginBodyDestination |
CbcPointer< Adaptation::Initiate > | adaptedHeadSource |
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< AsyncJob > | id |
job identifier More... | |
Private Member Functions | |
void | serverComplete2 () |
void | sendBodyIsTooLargeError () |
void | maybePurgeOthers () |
Private Attributes | |
bool | completed = false |
HttpReply * | theVirginReply = nullptr |
HttpReply * | theFinalReply = nullptr |
Detailed Description
Client is a common base for classes such as HttpStateData and FtpStateData. All such classes must be able to consume request bodies from a BodyPipe or ICAP producer, adapt virgin responses using ICAP, and provide a consumer with responses.
Member Typedef Documentation
◆ Pointer [1/3]
|
inherited |
Definition at line 34 of file AsyncJob.h.
◆ Pointer [2/3]
|
inherited |
Definition at line 25 of file BodyPipe.h.
◆ Pointer [3/3]
|
inherited |
Definition at line 45 of file BodyPipe.h.
Constructor & Destructor Documentation
◆ Client()
Client::Client | ( | FwdState * | theFwdState | ) |
Definition at line 39 of file Client.cc.
References entry, FwdState::entry, fwd, and StoreEntry::lock().
◆ ~Client()
|
virtual |
Reimplemented in Ftp::Client.
Definition at line 48 of file Client.cc.
References adaptedBodySource, assert, entry, HTTPMSGUNLOCK(), NULL, requestBodySource, responseBodyBuffer, theFinalReply, theVirginReply, StoreEntry::unlock(), and virginBodyDestination.
Member Function Documentation
◆ abortAll()
|
pure virtual |
Implemented in HttpStateData, and Ftp::Client.
Referenced by abortOnData(), handleAdaptationAborted(), handleAdaptationBlocked(), and handledEarlyAdaptationAbort().
◆ abortOnBadEntry()
|
protected |
Definition at line 238 of file Client.cc.
References abortOnData(), debugs, entry, HERE(), and StoreEntry::isAccepting().
Referenced by handleAdaptationAborted(), handleAdaptationBlocked(), handleAdaptedBodyProducerAborted(), handleAdaptedBodyProductionEnded(), handleAdaptedHeader(), handleMoreAdaptedBodyAvailable(), noteAdaptationAclCheckDone(), and resumeBodyStorage().
◆ abortOnData()
|
virtual |
abnormal data transfer termination
- Return values
-
true the transaction will be terminated (abortAll called) false the transaction will survive
Reimplemented in Ftp::Relay.
Definition at line 291 of file Client.cc.
References abortAll().
Referenced by abortOnBadEntry(), handleAdaptationBlocked(), sendBodyIsTooLargeError(), and sentRequestBody().
◆ adaptOrFinalizeReply()
|
protected |
Definition at line 962 of file Client.cc.
References adaptationAccessCheckPending, FwdState::al, debugs, fwd, HERE(), Adaptation::methodRespmod, originalRequest(), Adaptation::pointPreCache, setFinalReply(), Adaptation::AccessCheck::Start(), and virginReply().
Referenced by HttpStateData::processReply().
◆ adaptVirginReplyBody()
|
protected |
Definition at line 606 of file Client.cc.
References MemBuf::append(), assert, MemBuf::consume(), MemBuf::content(), MemBuf::contentSize(), data, debugs, HERE(), MemBuf::init(), len, NULL, BodyPipe::putMoreData(), responseBodyBuffer, startedAdaptation, and virginBodyDestination.
Referenced by addVirginReplyBody().
◆ addVirginReplyBody()
|
protected |
Definition at line 995 of file Client.cc.
References adaptationAccessCheckPending, adaptVirginReplyBody(), adjustBodyBytesRead(), assert, data, len, startedAdaptation, and storeReplyBody().
Referenced by HttpStateData::decodeAndWriteReplyBody(), noteMoreBodySpaceAvailable(), and HttpStateData::writeReplyBody().
◆ adjustBodyBytesRead()
|
protected |
Definition at line 980 of file Client.cc.
References HierarchyLogEntry::bodyBytesRead, HttpRequest::hier, Must, and originalRequest().
Referenced by addVirginReplyBody().
◆ announceInitiatorAbort()
|
protectedinherited |
Definition at line 38 of file Initiator.cc.
References CallJobHere.
Referenced by ClientHttpRequest::~ClientHttpRequest(), and cleanAdaptation().
◆ blockCaching()
|
protected |
Definition at line 529 of file Client.cc.
References SquidConfig::accessList, ACLFilledChecklist::al, FwdState::al, Acl::Answer::allowed(), Config, debugs, entry, ACLChecklist::fastCheck(), MemObject::freshestReply(), fwd, HTTPMSGLOCK(), StoreEntry::mem(), originalRequest(), ACLFilledChecklist::reply, and SquidConfig::storeMiss.
Referenced by setFinalReply().
◆ calcBufferSpaceToReserve()
|
protected |
Definition at line 1020 of file Client.cc.
References BodyPipe::buf(), debugs, SBuf::maxSize, min(), NULL, MemBuf::potentialSpaceSize(), responseBodyBuffer, and virginBodyDestination.
Referenced by HttpStateData::maybeMakeSpaceAvailable().
◆ callEnd()
|
virtualinherited |
called right after the called job method
Reimplemented in Adaptation::Icap::Xaction.
Definition at line 136 of file AsyncJob.cc.
References AsyncCall::debugLevel, debugs, AsyncCall::debugSection, AsyncJob::done(), HERE(), AsyncJob::inCall, NULL, AsyncJob::status(), AsyncJob::swanSong(), and AsyncJob::typeName.
Referenced by Adaptation::Icap::Xaction::callEnd(), and AsyncJob::deleteThis().
◆ callException()
|
virtualinherited |
Reimplemented in ClientHttpRequest, Ftp::Server, Ipc::Inquirer, Ipc::Forwarder, Adaptation::Icap::Xaction, Adaptation::Icap::ServiceRep, Adaptation::Icap::ModXact, and ConnStateData.
Definition at line 127 of file AsyncJob.cc.
References cbdataReferenceValid(), debugs, Must, AsyncJob::mustStop(), and CbdataParent::toCbdata().
Referenced by ConnStateData::callException(), Adaptation::Icap::Xaction::callException(), Ipc::Forwarder::callException(), Ipc::Inquirer::callException(), and Ftp::Server::callException().
◆ callStart()
|
inherited |
called just before the called method
Definition at line 114 of file AsyncJob.cc.
References cbdataReferenceValid(), AsyncCall::debugLevel, debugs, AsyncCall::debugSection, AsyncJob::inCall, Must, AsyncJob::status(), CbdataParent::toCbdata(), and AsyncJob::typeName.
◆ canBeCalled()
|
inherited |
Definition at line 101 of file AsyncJob.cc.
References AsyncCall::cancel(), debugs, HERE(), AsyncJob::inCall, and NULL.
◆ cleanAdaptation()
|
protected |
Definition at line 581 of file Client.cc.
References adaptationAccessCheckPending, adaptedBodySource, adaptedHeadSource, Adaptation::Initiator::announceInitiatorAbort(), assert, debugs, doneWithAdaptation(), HERE(), NULL, BodyConsumer::stopConsumingFrom(), BodyProducer::stopProducingFor(), and virginBodyDestination.
Referenced by handleAdaptationCompleted(), and swanSong().
◆ clearAdaptation()
|
protectedinherited |
Definition at line 32 of file Initiator.cc.
References CbcPointer< Cbc >::clear().
Referenced by ClientHttpRequest::handleAdaptedHeader(), ClientHttpRequest::noteAdaptationAnswer(), and noteAdaptationAnswer().
◆ closeServer()
|
protectedpure virtual |
Use this to end communication with the server. The call cancels our closure handler and tells FwdState to forget about the connection.
Implemented in HttpStateData, and Ftp::Client.
Referenced by handleAdaptationCompleted(), serverComplete(), and swanSong().
◆ completeForwarding()
|
protectedvirtual |
default calls fwd->complete()
Reimplemented in Ftp::Relay, and Ftp::Gateway.
Definition at line 210 of file Client.cc.
References assert, FwdState::complete(), debugs, doneWithFwd, fwd, HERE(), and NULL.
Referenced by Ftp::Gateway::completeForwarding(), Ftp::Relay::completeForwarding(), handleAdaptationCompleted(), and serverComplete2().
◆ dataConnection()
|
pure virtual |
- Returns
- primary or "request data connection"
Implemented in HttpStateData, and Ftp::Client.
Referenced by sendMoreRequestBody().
◆ deleteThis()
|
protectedinherited |
Definition at line 49 of file AsyncJob.cc.
References asyncCall(), AsyncJob::callEnd(), debugs, AsyncJob::inCall, JobMemFun(), Must, NULL, AsyncJob::stopReason, and AsyncJob::typeName.
Referenced by ConnStateData::connStateClosed().
◆ done()
|
protectedinherited |
Definition at line 90 of file AsyncJob.cc.
References AsyncJob::doneAll(), NULL, and AsyncJob::stopReason.
Referenced by AsyncJob::callEnd(), HappyConnOpener::checkForNewConnection(), and Downloader::downloadFinished().
◆ doneAll()
|
virtual |
Reimplemented from AsyncJob.
Definition at line 197 of file Client.cc.
References AsyncJob::doneAll(), doneWithAdaptation(), and doneWithServer().
◆ doneSendingRequestBody()
|
protectedpure virtual |
Implemented in HttpStateData, and Ftp::Client.
Definition at line 320 of file Client.cc.
References assert, debugs, HERE(), NULL, requestBodySource, and BodyConsumer::stopConsumingFrom().
Referenced by Ftp::Client::doneSendingRequestBody(), HttpStateData::doneSendingRequestBody(), handleRequestBodyProductionEnded(), and sentRequestBody().
◆ doneWithAdaptation()
|
protectedvirtual |
did we end ICAP communication?
Definition at line 598 of file Client.cc.
References adaptationAccessCheckPending, adaptedBodySource, adaptedHeadSource, and virginBodyDestination.
Referenced by cleanAdaptation(), doneAll(), handleAdaptedHeader(), noteBodyConsumerAborted(), and serverComplete2().
◆ doneWithServer()
|
protectedpure virtual |
did we end communication?
Implemented in HttpStateData, and Ftp::Client.
Referenced by doneAll(), serverComplete(), and swanSong().
◆ endAdaptedBodyConsumption()
|
protected |
Definition at line 803 of file Client.cc.
References adaptedBodySource, handleAdaptationCompleted(), and BodyConsumer::stopConsumingFrom().
Referenced by handleAdaptedBodyProductionEnded(), and resumeBodyStorage().
◆ finalReply()
|
protected |
Definition at line 130 of file Client.cc.
References assert, and theFinalReply.
Referenced by HttpStateData::haveParsedReplyHeaders(), and HttpStateData::reusableReply().
◆ getMoreRequestBody()
|
virtual |
Reimplemented in HttpStateData.
Definition at line 418 of file Client.cc.
References buf, BodyPipe::getMoreData(), Must, NULL, and requestBodySource.
Referenced by HttpStateData::getMoreRequestBody(), and sendMoreRequestBody().
◆ handleAdaptationAborted()
|
protected |
Definition at line 851 of file Client.cc.
References abortAll(), abortOnBadEntry(), debugs, entry, handledEarlyAdaptationAbort(), HERE(), and StoreEntry::isEmpty().
Referenced by noteAdaptationAnswer().
◆ handleAdaptationBlocked()
|
protected |
Definition at line 890 of file Client.cc.
References abortAll(), abortOnBadEntry(), abortOnData(), aclGetDenyInfoPage(), FwdState::al, Config, debugs, SquidConfig::denyInfoList, HttpRequest::detailError(), FwdState::dontRetry(), entry, ERR_ACCESS_DENIED, ERR_ICAP_FAILURE, ERR_NONE, FwdState::fail(), fwd, RefCount< C >::getRaw(), HERE(), StoreEntry::isEmpty(), MakeNamedErrorDetail(), request, Adaptation::Answer::ruleId, Http::scForbidden, and String::termedBuf().
Referenced by noteAdaptationAnswer().
◆ handleAdaptationCompleted()
|
protected |
Definition at line 832 of file Client.cc.
References cleanAdaptation(), closeServer(), completeForwarding(), debugs, HERE(), and mayReadVirginReplyBody().
Referenced by endAdaptedBodyConsumption(), handleAdaptedBodyProducerAborted(), handleAdaptedHeader(), and noteBodyConsumerAborted().
◆ handleAdaptedBodyProducerAborted()
|
protected |
Definition at line 810 of file Client.cc.
References abortOnBadEntry(), adaptedBodySource, debugs, entry, BodyPipe::exhausted(), handleAdaptationCompleted(), handledEarlyAdaptationAbort(), StoreEntry::lengthWentBad(), Must, and BodyConsumer::stopConsumingFrom().
Referenced by noteBodyProducerAborted().
◆ handleAdaptedBodyProductionEnded()
|
protected |
Definition at line 791 of file Client.cc.
References abortOnBadEntry(), adaptedBodySource, endAdaptedBodyConsumption(), BodyPipe::exhausted(), and NULL.
Referenced by noteBodyProductionEnded().
◆ handleAdaptedHeader()
|
protected |
Definition at line 694 of file Client.cc.
References abortOnBadEntry(), adaptedBodySource, assert, Http::Message::body_pipe, debugs, doneWithAdaptation(), BodyPipe::expectNoConsumption(), handleAdaptationCompleted(), HERE(), NULL, BodyPipe::setConsumerIfNotLate(), and setFinalReply().
Referenced by noteAdaptationAnswer().
◆ handledEarlyAdaptationAbort()
|
protected |
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 abortAll(), FwdState::al, debugs, HttpRequest::detailError(), FwdState::dontRetry(), entry, ERR_ICAP_FAILURE, FwdState::fail(), fwd, RefCount< C >::getRaw(), StoreEntry::isEmpty(), MakeNamedErrorDetail(), request, and Http::scInternalServerError.
Referenced by handleAdaptationAborted(), and handleAdaptedBodyProducerAborted().
◆ handleMoreAdaptedBodyAvailable()
|
protected |
Definition at line 744 of file Client.cc.
References abortOnBadEntry(), adaptedBodySource, assert, asyncCall(), BodyPipeCheckout::buf, BodyPipe::buf(), StoreEntry::bytesWanted(), BodyPipeCheckout::checkIn(), MemBuf::consume(), BodyPipe::consumedSize(), MemBuf::contentSize(), currentOffset, debugs, StoreEntry::deferProducer(), entry, HERE(), StoreIOBuffer::length, resumeBodyStorage(), and StoreEntry::write().
Referenced by noteMoreBodyDataAvailable(), and resumeBodyStorage().
◆ handleMoreRequestBodyAvailable()
|
protected |
Definition at line 299 of file Client.cc.
References debugs, HERE(), requestSender, and sendMoreRequestBody().
Referenced by noteMoreBodyDataAvailable().
◆ handleRequestBodyProducerAborted()
|
protectedpure virtual |
Implemented in HttpStateData, Ftp::Relay, and Ftp::Gateway.
Definition at line 331 of file Client.cc.
References debugs, FwdState::dontRetry(), fwd, HERE(), NULL, requestBodySource, requestSender, and BodyConsumer::stopConsumingFrom().
Referenced by Ftp::Gateway::handleRequestBodyProducerAborted(), Ftp::Relay::handleRequestBodyProducerAborted(), HttpStateData::handleRequestBodyProducerAborted(), and noteBodyProducerAborted().
◆ handleRequestBodyProductionEnded()
|
protected |
Definition at line 309 of file Client.cc.
References debugs, doneSendingRequestBody(), HERE(), receivedWholeRequestBody, and requestSender.
Referenced by noteBodyProductionEnded().
◆ haveParsedReplyHeaders()
|
protectedvirtual |
called when got final headers
Reimplemented in HttpStateData, and Ftp::Gateway.
Definition at line 517 of file Client.cc.
References HttpReply::contentRange(), currentOffset, maybePurgeOthers(), Must, HttpHdrRangeSpec::offset, HttpHdrContRange::spec, and theFinalReply.
Referenced by Ftp::Gateway::haveParsedReplyHeaders(), HttpStateData::haveParsedReplyHeaders(), and setFinalReply().
◆ initiateAdaptation()
|
protectedinherited |
Definition at line 23 of file Initiator.cc.
References Adaptation::Initiate::initiator(), and Ident::Start().
Referenced by ClientHttpRequest::startAdaptation(), and startAdaptation().
◆ initiated()
|
inlineprotectedinherited |
Definition at line 52 of file Initiator.h.
References CbcPointer< Cbc >::set().
Referenced by ClientHttpRequest::startAdaptation(), and startAdaptation().
◆ maybePurgeOthers()
|
private |
Definition at line 496 of file Client.cc.
References SBuf::c_str(), Http::CONTENT_LOCATION, debugs, HttpRequest::effectiveRequestUri(), RefCount< C >::getRaw(), Http::LOCATION, HttpRequest::method, purgeEntriesByHeader(), purgeEntriesByUrl(), HttpRequestMethod::purgesOthers(), request, HttpReply::sline, Http::StatusLine::status(), and theFinalReply.
Referenced by haveParsedReplyHeaders().
◆ maybeReadVirginBody()
|
pure virtual |
Implemented in HttpStateData, and Ftp::Client.
Referenced by noteMoreBodySpaceAvailable().
◆ mayReadVirginReplyBody()
|
protectedpure virtual |
Implemented in HttpStateData, Ftp::Relay, and Ftp::Gateway.
Referenced by handleAdaptationCompleted().
◆ mustStop()
|
protectedinherited |
Definition at line 69 of file AsyncJob.cc.
References debugs, AsyncJob::inCall, Must, NULL, AsyncJob::stopReason, and AsyncJob::typeName.
Referenced by HttpStateData::abortAll(), AsyncJob::callException(), HttpStateData::continueAfterParsingHeader(), HttpStateData::drop1xx(), HttpStateData::handleMoreRequestBodyAvailable(), HttpStateData::httpStateConnClosed(), HttpStateData::httpTimeout(), Comm::ConnOpener::noteAbort(), HttpStateData::proceedAfter1xx(), ConnStateData::proxyProtocolError(), HttpStateData::readReply(), HttpStateData::start(), and HttpStateData::wroteLast().
◆ noteAdaptationAclCheckDone()
|
virtual |
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 abortOnBadEntry(), adaptationAccessCheckPending, debugs, HERE(), originalRequest(), processReplyBody(), request, sendBodyIsTooLargeError(), setFinalReply(), startAdaptation(), and virginReply().
◆ noteAdaptationAnswer()
|
virtual |
called with the initial adaptation decision (adapt, block, error); virgin and/or adapted body transmission may continue after this
Implements Adaptation::Initiator.
Definition at line 674 of file Client.cc.
References adaptedHeadSource, Adaptation::Answer::akBlock, Adaptation::Answer::akError, Adaptation::Answer::akForward, Adaptation::Initiator::clearAdaptation(), Adaptation::Answer::final, RefCount< C >::getRaw(), handleAdaptationAborted(), handleAdaptationBlocked(), handleAdaptedHeader(), Adaptation::Answer::kind, and Adaptation::Answer::message.
◆ noteBodyConsumerAborted()
|
virtual |
Implements BodyProducer.
Definition at line 662 of file Client.cc.
References doneWithAdaptation(), handleAdaptationCompleted(), BodyProducer::stopProducingFor(), and virginBodyDestination.
◆ noteBodyProducerAborted()
|
virtual |
Implements BodyConsumer.
Definition at line 278 of file Client.cc.
References adaptedBodySource, handleAdaptedBodyProducerAborted(), handleRequestBodyProducerAborted(), and requestBodySource.
◆ noteBodyProductionEnded()
|
virtual |
Implements BodyConsumer.
Definition at line 264 of file Client.cc.
References adaptedBodySource, handleAdaptedBodyProductionEnded(), handleRequestBodyProductionEnded(), and requestBodySource.
◆ noteMoreBodyDataAvailable()
|
virtual |
Implements BodyConsumer.
Definition at line 250 of file Client.cc.
References adaptedBodySource, handleMoreAdaptedBodyAvailable(), handleMoreRequestBodyAvailable(), and requestBodySource.
◆ noteMoreBodySpaceAvailable()
|
virtual |
Implements BodyProducer.
Definition at line 648 of file Client.cc.
References addVirginReplyBody(), completed, maybeReadVirginBody(), NULL, responseBodyBuffer, and serverComplete2().
◆ originalRequest()
|
virtual |
Definition at line 547 of file Client.cc.
References request.
Referenced by adaptOrFinalizeReply(), adjustBodyBytesRead(), blockCaching(), HttpStateData::finishingBrokenPost(), HttpStateData::handle1xx(), noteAdaptationAclCheckDone(), serverComplete(), and startRequestBodyFlow().
◆ processReplyBody()
|
pure virtual |
Implemented in HttpStateData, Ftp::Relay, and Ftp::Gateway.
Referenced by noteAdaptationAclCheckDone().
◆ replyBodySpace()
- Deprecated:
- use SBuf I/O API and calcBufferSpaceToReserve() instead
Definition at line 1055 of file Client.cc.
References BodyPipe::buf(), debugs, min(), NULL, MemBuf::potentialSpaceSize(), responseBodyBuffer, MemBuf::spaceSize(), and virginBodyDestination.
◆ resumeBodyStorage()
|
protected |
Definition at line 728 of file Client.cc.
References abortOnBadEntry(), adaptedBodySource, endAdaptedBodyConsumption(), BodyPipe::exhausted(), handleMoreAdaptedBodyAvailable(), and NULL.
Referenced by handleMoreAdaptedBodyAvailable().
◆ sendBodyIsTooLargeError()
|
private |
Definition at line 951 of file Client.cc.
References abortOnData(), FwdState::al, FwdState::dontRetry(), ERR_TOO_BIG, FwdState::fail(), fwd, RefCount< C >::getRaw(), request, and Http::scForbidden.
Referenced by noteAdaptationAclCheckDone().
◆ sendMoreRequestBody()
|
protected |
Definition at line 392 of file Client.cc.
References assert, buf, conn, dataConnection(), debugs, getMoreRequestBody(), HERE(), Comm::IsConnOpen(), JobCallback, NULL, requestBodySource, requestSender, sentRequestBody(), and Comm::Write().
Referenced by handleMoreRequestBodyAvailable(), and sentRequestBody().
◆ sentRequestBody()
|
protectedpure virtual |
Implemented in HttpStateData, and Ftp::Client.
Definition at line 344 of file Client.cc.
References abortOnData(), FwdState::al, StatCounters::all, DBG_IMPORTANT, debugs, doneSendingRequestBody(), EBIT_TEST, entry, ENTRY_ABORTED, Comm::ERR_CLOSING, ERR_WRITE_ERROR, BodyPipe::exhausted(), FwdState::fail(), CommCommonCbParams::fd, fd_bytes(), FD_WRITE, CommCommonCbParams::flag, StoreEntry::flags, fwd, HERE(), HttpRequest::hier, HierarchyLogEntry::notePeerWrite(), NULL, receivedWholeRequestBody, request, FwdState::request, requestBodySource, requestSender, Http::scBadGateway, sendMoreRequestBody(), StatCounters::server, CommIoCbParams::size, statCounter, CommCommonCbParams::xerrno, ErrorState::xerrno, and xstrerr().
Referenced by sendMoreRequestBody(), Ftp::Client::sentRequestBody(), and HttpStateData::sentRequestBody().
◆ serverComplete()
void Client::serverComplete | ( | ) |
call when no server communication is expected
Definition at line 160 of file Client.cc.
References assert, closeServer(), completed, debugs, doneWithServer(), HERE(), HttpRequest::hier, NULL, originalRequest(), requestBodySource, responseBodyBuffer, serverComplete2(), BodyConsumer::stopConsumingFrom(), and HierarchyLogEntry::stopPeerClock().
Referenced by ftpReadQuit(), HttpStateData::processReplyBody(), and Ftp::Relay::serverComplete().
◆ serverComplete2()
|
private |
Continuation of serverComplete
Definition at line 182 of file Client.cc.
References completeForwarding(), debugs, doneWithAdaptation(), HERE(), NULL, BodyProducer::stopProducingFor(), and virginBodyDestination.
Referenced by noteMoreBodySpaceAvailable(), and serverComplete().
◆ setFinalReply()
Definition at line 137 of file Client.cc.
References FwdState::al, assert, blockCaching(), debugs, EBIT_TEST, entry, StoreEntry::flags, fwd, haveParsedReplyHeaders(), HERE(), HTTPMSGLOCK(), StoreEntry::release(), RELEASE_REQUEST, StoreEntry::replaceHttpReply(), AccessLogEntry::reply, StoreEntry::startWriting(), and theFinalReply.
Referenced by adaptOrFinalizeReply(), handleAdaptedHeader(), and noteAdaptationAclCheckDone().
◆ setVirginReply()
Definition at line 117 of file Client.cc.
References FwdState::al, assert, debugs, fwd, HERE(), HTTPMSGLOCK(), AccessLogEntry::reply, and theVirginReply.
Referenced by HttpStateData::processReplyHeader().
◆ start()
|
protectedvirtualinherited |
Reimplemented in Ipc::Port, Ftp::Server, HappyConnOpener, Rock::Rebuild, Rock::HeaderUpdater, Snmp::Inquirer, Server, Http::One::Server, Security::PeerConnector, PeerPoolMgr, Mgr::StoreToCommWriter, Mgr::Inquirer, Mgr::Filler, Mgr::ActionWriter, Log::TcpLogger, Ipc::UdsSender, Ipc::Strand, Ipc::Inquirer, Ipc::Forwarder, Ipc::Coordinator, HttpStateData, Downloader, Comm::TcpAcceptor, Comm::ConnOpener, Http::Tunneler, Ftp::Relay, Ftp::Gateway, Ftp::Client, ConnStateData, Adaptation::Iterator, Adaptation::Icap::Xaction, Adaptation::Icap::OptXact, Adaptation::Icap::ModXact, Adaptation::Icap::Launcher, Adaptation::Ecap::XactionRep, and Adaptation::AccessCheck.
Definition at line 43 of file AsyncJob.cc.
Referenced by Adaptation::AccessCheck::start(), Adaptation::Icap::Launcher::start(), Adaptation::Icap::Xaction::start(), Adaptation::Iterator::start(), ConnStateData::start(), Http::Tunneler::start(), Ipc::UdsSender::start(), PeerPoolMgr::start(), Security::PeerConnector::start(), Ipc::Port::start(), and AsyncJob::Start().
◆ Start()
|
staticinherited |
Definition at line 23 of file AsyncJob.cc.
References CallJobHere, and AsyncJob::start().
Referenced by Ftp::Server::AcceptCtrlConnection(), Ftp::Server::checkDataConnPre(), clientListenerConnectionOpened(), Ftp::Client::connectDataChannel(), FwdState::connectStart(), Adaptation::Icap::Xaction::dnsLookupDone(), Log::TcpLogger::doConnect(), FwdState::establishTunnelThruProxy(), TunnelStateData::establishTunnelThruProxy(), Ipc::Coordinator::handleCacheMgrRequest(), PeerPoolMgr::handleOpenedConnection(), Ipc::Coordinator::handleSnmpRequest(), httpAccept(), httpsAccept(), httpStart(), idnsInitVC(), Ftp::Gateway::listenForDataChannel(), Ftp::Server::listenForDataConnection(), Adaptation::Icap::Xaction::noteCommConnected(), Log::TcpLogger::Open(), HappyConnOpener::openFreshConnection(), PeerPoolMgr::openNewConnection(), peerProbeConnect(), Mgr::FunAction::respond(), Mgr::InfoAction::respond(), FwdState::secureConnectionToPeer(), TunnelStateData::secureConnectionToPeer(), Ipc::SendMessage(), Mgr::Inquirer::sendResponse(), snmpConstructReponse(), SquidMain(), CacheManager::start(), Ident::Start(), Adaptation::AccessCheck::Start(), Rock::Rebuild::Start(), Security::PeerConnector::startCertDownloading(), TunnelStateData::startConnecting(), Ftp::StartGateway(), Ftp::StartRelay(), PeerPoolMgrsRr::syncConfig(), and Rock::SwapDir::updateHeaders().
◆ startAdaptation()
|
protected |
Definition at line 555 of file Client.cc.
References adaptedHeadSource, FwdState::al, assert, Http::Message::body_pipe, debugs, HttpReply::expectingBody(), fwd, HERE(), Adaptation::Initiator::initiateAdaptation(), Adaptation::Initiator::initiated(), HttpRequest::method, Must, BodyPipe::setBodySize(), size, startedAdaptation, virginBodyDestination, and virginReply().
Referenced by noteAdaptationAclCheckDone().
◆ startRequestBodyFlow()
|
protected |
Definition at line 219 of file Client.cc.
References assert, Http::Message::body_pipe, debugs, HERE(), NULL, originalRequest(), requestBodySource, BodyPipe::setConsumerIfNotLate(), and BodyPipe::status().
Referenced by HttpStateData::sendRequest().
◆ status()
|
protectedvirtualinherited |
for debugging, starts with space
Reimplemented in HappyConnOpener, Security::PeerConnector, Ipc::Inquirer, Comm::TcpAcceptor, Http::Tunneler, Adaptation::Initiate, Adaptation::Icap::Xaction, Adaptation::Icap::ServiceRep, and Adaptation::Ecap::XactionRep.
Definition at line 159 of file AsyncJob.cc.
References buf, NULL, and AsyncJob::stopReason.
Referenced by AsyncJob::callEnd(), AsyncJob::callStart(), Adaptation::Initiate::status(), and Comm::TcpAcceptor::status().
◆ stopConsumingFrom()
Definition at line 118 of file BodyPipe.cc.
References assert, BodyPipe::clearConsumer(), debugs, and NULL.
Referenced by ClientHttpRequest::~ClientHttpRequest(), cleanAdaptation(), doneSendingRequestBody(), endAdaptedBodyConsumption(), ClientHttpRequest::endRequestSatisfaction(), handleAdaptedBodyProducerAborted(), handleRequestBodyProducerAborted(), BodySink::noteBodyProducerAborted(), ClientHttpRequest::noteBodyProducerAborted(), BodySink::noteBodyProductionEnded(), serverComplete(), and swanSong().
◆ stopProducingFor()
Definition at line 107 of file BodyPipe.cc.
References assert, BodyPipe::clearProducer(), debugs, and NULL.
Referenced by ConnStateData::~ConnStateData(), cleanAdaptation(), ConnStateData::finishDechunkingRequest(), noteBodyConsumerAborted(), and serverComplete2().
◆ storeReplyBody()
|
protected |
Definition at line 1011 of file Client.cc.
References currentOffset, data, entry, len, and StoreEntry::write().
Referenced by addVirginReplyBody().
◆ swanSong()
|
virtual |
Reimplemented from AsyncJob.
Reimplemented in Ftp::Relay.
Definition at line 69 of file Client.cc.
References adaptedBodySource, assert, cleanAdaptation(), closeServer(), doneWithFwd, doneWithServer(), fwd, FwdState::handleUnregisteredServerEnd(), NULL, requestBodySource, BodyConsumer::stopConsumingFrom(), AsyncJob::swanSong(), and virginBodyDestination.
Referenced by Ftp::Relay::swanSong().
◆ toCbdata()
|
pure virtualinherited |
Implemented in HttpStateData, ClientHttpRequest, and BodySink.
Referenced by AsyncJob::callException(), and AsyncJob::callStart().
◆ virginReply() [1/2]
|
protected |
Definition at line 103 of file Client.cc.
References assert, and theVirginReply.
◆ virginReply() [2/2]
|
protected |
Definition at line 110 of file Client.cc.
References assert, and theVirginReply.
Referenced by adaptOrFinalizeReply(), HttpStateData::continueAfterParsingHeader(), HttpStateData::handleMoreRequestBodyAvailable(), noteAdaptationAclCheckDone(), HttpStateData::persistentConnStatus(), startAdaptation(), HttpStateData::statusIfComplete(), and HttpStateData::truncateVirginBody().
Member Data Documentation
◆ adaptationAccessCheckPending
|
protected |
Definition at line 177 of file Client.h.
Referenced by adaptOrFinalizeReply(), addVirginReplyBody(), cleanAdaptation(), doneWithAdaptation(), noteAdaptationAclCheckDone(), and HttpStateData::processReplyBody().
◆ adaptedBodySource
|
protected |
to consume adated response body
Definition at line 175 of file Client.h.
Referenced by ~Client(), cleanAdaptation(), doneWithAdaptation(), endAdaptedBodyConsumption(), handleAdaptedBodyProducerAborted(), handleAdaptedBodyProductionEnded(), handleAdaptedHeader(), handleMoreAdaptedBodyAvailable(), noteBodyProducerAborted(), noteBodyProductionEnded(), noteMoreBodyDataAvailable(), resumeBodyStorage(), and swanSong().
◆ adaptedHeadSource
|
protected |
to get adapted response headers
Definition at line 174 of file Client.h.
Referenced by cleanAdaptation(), doneWithAdaptation(), noteAdaptationAnswer(), and startAdaptation().
◆ completed
|
private |
serverComplete() has been called
Definition at line 86 of file Client.h.
Referenced by noteMoreBodySpaceAvailable(), and serverComplete().
◆ currentOffset
|
protected |
Our current offset in the StoreEntry
Definition at line 160 of file Client.h.
Referenced by Ftp::Gateway::getCurrentOffset(), handleMoreAdaptedBodyAvailable(), haveParsedReplyHeaders(), Ftp::Gateway::setCurrentOffset(), and storeReplyBody().
◆ doneWithFwd
|
protected |
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 completeForwarding(), HttpStateData::httpStateConnClosed(), HttpStateData::proceedAfter1xx(), and swanSong().
◆ entry
StoreEntry* Client::entry = nullptr |
Definition at line 164 of file Client.h.
Referenced by Client(), Ftp::Gateway::Gateway(), HttpStateData::HttpStateData(), Ftp::Relay::Relay(), ~Client(), abortOnBadEntry(), blockCaching(), HttpStateData::buildRequestPrefix(), HttpStateData::continueAfterParsingHeader(), ftpFail(), ftpSendReply(), ftpWriteTransferDone(), handleAdaptationAborted(), handleAdaptationBlocked(), handleAdaptedBodyProducerAborted(), handledEarlyAdaptationAbort(), handleMoreAdaptedBodyAvailable(), HttpStateData::handleMoreRequestBodyAvailable(), HttpStateData::handleRequestBodyProducerAborted(), HttpStateData::haveParsedReplyHeaders(), HttpStateData::httpBuildRequestHeader(), HttpStateData::httpTimeout(), HttpStateData::keepaliveAccounting(), HttpStateData::peerSupportsConnectionPinning(), HttpStateData::processReplyBody(), HttpStateData::processReplyHeader(), HttpStateData::processSurrogateControl(), HttpStateData::readReply(), HttpStateData::reusableReply(), sentRequestBody(), setFinalReply(), HttpStateData::statusIfComplete(), storeReplyBody(), and HttpStateData::wroteLast().
◆ fwd
FwdState::Pointer Client::fwd |
Definition at line 165 of file Client.h.
Referenced by Client(), HttpStateData::HttpStateData(), adaptOrFinalizeReply(), blockCaching(), HttpStateData::buildRequestPrefix(), HttpStateData::closeServer(), completeForwarding(), HttpStateData::continueAfterParsingHeader(), HttpStateData::drop1xx(), HttpStateData::finishingBrokenPost(), HttpStateData::forwardUpgrade(), ftpFail(), ftpSendReply(), HttpStateData::handle1xx(), handleAdaptationBlocked(), handledEarlyAdaptationAbort(), HttpStateData::handleRequestBodyProducerAborted(), handleRequestBodyProducerAborted(), HttpStateData::haveParsedReplyHeaders(), HttpStateData::httpTimeout(), HttpStateData::proceedAfter1xx(), HttpStateData::processReplyBody(), HttpStateData::readReply(), sendBodyIsTooLargeError(), sentRequestBody(), setFinalReply(), setVirginReply(), startAdaptation(), swanSong(), and HttpStateData::wroteLast().
◆ id
|
protectedinherited |
Definition at line 72 of file AsyncJob.h.
◆ inCall
|
protectedinherited |
Definition at line 71 of file AsyncJob.h.
Referenced by AsyncJob::callEnd(), AsyncJob::callStart(), AsyncJob::canBeCalled(), AsyncJob::deleteThis(), and AsyncJob::mustStop().
◆ receivedWholeRequestBody
|
protected |
Definition at line 180 of file Client.h.
Referenced by HttpStateData::finishingChunkedRequest(), HttpStateData::getMoreRequestBody(), handleRequestBodyProductionEnded(), and sentRequestBody().
◆ request
HttpRequestPointer Client::request |
Definition at line 166 of file Client.h.
Referenced by Ftp::Gateway::Gateway(), HttpStateData::HttpStateData(), HttpStateData::buildRequestPrefix(), HttpStateData::checkDateSkew(), HttpStateData::continueAfterParsingHeader(), HttpStateData::decideIfWeDoRanges(), HttpStateData::drop1xx(), HttpStateData::forwardUpgrade(), ftpFail(), ftpReadType(), ftpSendPassive(), ftpSendReply(), ftpSendStor(), ftpSendType(), ftpSendUser(), ftpTrySlashHack(), HttpStateData::handle1xx(), handleAdaptationBlocked(), handledEarlyAdaptationAbort(), HttpStateData::handleMoreRequestBodyAvailable(), HttpStateData::haveParsedReplyHeaders(), HttpStateData::httpBuildRequestHeader(), HttpStateData::keepaliveAccounting(), maybePurgeOthers(), noteAdaptationAclCheckDone(), originalRequest(), HttpStateData::peerSupportsConnectionPinning(), HttpStateData::persistentConnStatus(), HttpStateData::proceedAfter1xx(), HttpStateData::processReplyBody(), HttpStateData::processReplyHeader(), HttpStateData::processSurrogateControl(), HttpStateData::readReply(), HttpStateData::reusableReply(), sendBodyIsTooLargeError(), HttpStateData::sendRequest(), sentRequestBody(), HttpStateData::statusIfComplete(), HttpStateData::truncateVirginBody(), and HttpStateData::wroteLast().
◆ requestBodySource
|
protected |
to consume request body
Definition at line 169 of file Client.h.
Referenced by ~Client(), doneSendingRequestBody(), getMoreRequestBody(), HttpStateData::getMoreRequestBody(), HttpStateData::handleMoreRequestBodyAvailable(), handleRequestBodyProducerAborted(), noteBodyProducerAborted(), noteBodyProductionEnded(), noteMoreBodyDataAvailable(), sendMoreRequestBody(), HttpStateData::sendRequest(), sentRequestBody(), serverComplete(), startRequestBodyFlow(), and swanSong().
◆ requestSender
|
protected |
set if we are expecting Comm::Write to call us back
Definition at line 170 of file Client.h.
Referenced by HttpStateData::finishingBrokenPost(), HttpStateData::finishingChunkedRequest(), handleMoreRequestBodyAvailable(), handleRequestBodyProducerAborted(), handleRequestBodyProductionEnded(), sendMoreRequestBody(), HttpStateData::sendRequest(), and sentRequestBody().
◆ responseBodyBuffer
|
protected |
Data temporarily buffered for ICAP
Definition at line 161 of file Client.h.
Referenced by ~Client(), adaptVirginReplyBody(), calcBufferSpaceToReserve(), noteMoreBodySpaceAvailable(), replyBodySpace(), and serverComplete().
◆ startedAdaptation
|
protected |
Definition at line 178 of file Client.h.
Referenced by adaptVirginReplyBody(), addVirginReplyBody(), and startAdaptation().
◆ stopReason
|
protectedinherited |
Definition at line 69 of file AsyncJob.h.
Referenced by AsyncJob::deleteThis(), AsyncJob::done(), AsyncJob::mustStop(), AsyncJob::status(), and HappyConnOpener::status().
◆ theFinalReply
|
private |
adapted reply from ICAP or virgin reply
Definition at line 191 of file Client.h.
Referenced by ~Client(), finalReply(), haveParsedReplyHeaders(), maybePurgeOthers(), and setFinalReply().
◆ theVirginReply
|
private |
reply received from the origin server
Definition at line 190 of file Client.h.
Referenced by ~Client(), setVirginReply(), and virginReply().
◆ typeName
|
protectedinherited |
Definition at line 70 of file AsyncJob.h.
Referenced by AsyncJob::AsyncJob(), Adaptation::Icap::Xaction::Xaction(), AsyncJob::~AsyncJob(), AsyncJob::callEnd(), AsyncJob::callStart(), AsyncJob::deleteThis(), and AsyncJob::mustStop().
◆ virginBodyDestination
|
protected |
to provide virgin response body
Definition at line 173 of file Client.h.
Referenced by ~Client(), adaptVirginReplyBody(), calcBufferSpaceToReserve(), cleanAdaptation(), doneWithAdaptation(), noteBodyConsumerAborted(), replyBodySpace(), serverComplete2(), startAdaptation(), and swanSong().
The documentation for this class was generated from the following files: