88 Initiator::swanSong();
118 debugs(11,5,
this <<
" setting virgin reply to " << rep);
138 debugs(11,5,
this <<
" setting final reply to " << rep);
161 debugs(11, 3, reasonWeAreSure);
169 debugs(11,5,
"serverComplete " <<
this);
190 debugs(11,5,
"serverComplete2 " <<
this);
218 debugs(11,5,
"completing forwarding for " <<
fwd);
235 if (storedWholeReply)
249 debugs(11,3,
"expecting request body from " <<
254 debugs(11,3,
"aborting on partially consumed request body: " <<
267 debugs(11,5,
"entry is not Accepting!");
328 debugs(9,3,
"waiting for request body write to complete");
339 debugs(9,3,
"waiting for request body write to complete");
346 debugs(9,3,
"done sending request body");
358 debugs(9,3,
"fyi: request body aborted while we were sending");
370 debugs(11, 5,
"sentRequestBody: FD " << io.
fd <<
": size " << io.
size <<
": errflag " << io.
flag <<
".");
371 debugs(32,3,
"sentRequestBody called");
385 debugs(9,3,
"detected while-we-were-sending abort");
398 abortOnData(
"I/O error while sending request body");
403 abortOnData(
"store entry aborted while sending request body");
412 debugs(9,3,
"waiting for body production end or abort");
424 debugs(9,3,
"cannot send request body to closing " << conn);
435 debugs(9,3,
"will wait for more request body bytes or eof");
454 const char *host1 = strchr(url1,
':');
455 const char *host2 = strchr(url2,
':');
457 if (host1 && host2) {
462 }
while (*host1 ==
'/' && *host2 ==
'/');
468 while (*host1 && *host1 !=
'/' && *host1 == *host2) {
472 return *host1 == *host2;
492 const char *absUrl =
nullptr;
500 if (*hdrUrl ==
'/') {
508 absUrl = absUrlMaker.
c_str();
532 const char *reqUrl = tmp.
c_str();
565 debugs(20, 3,
"store_miss prohibits caching");
583 debugs(11, 5,
"Client::startAdaptation() called");
593 debugs(93, 6,
"will send virgin reply body to " <<
637 debugs(11,3,
"ICAP does not want more virgin body");
704 switch (answer.
kind) {
722 if (
abortOnBadEntry(
"entry went bad while waiting for adapted headers")) {
736 debugs(11,5,
this <<
" setting adapted reply to " << rep);
759 if (
abortOnBadEntry(
"store entry aborted while kick producer callback"))
786 if (spaceAvailable < contentSize ) {
794 if (!spaceAvailable) {
795 debugs(11, 5,
"NOT storing " << contentSize <<
" bytes of adapted " <<
800 if (spaceAvailable < contentSize ) {
801 debugs(11, 5,
"postponing storage of " <<
802 (contentSize - spaceAvailable) <<
" body bytes");
803 contentSize = spaceAvailable;
806 debugs(11,5,
"storing " << contentSize <<
" bytes of adapted " <<
821 if (
abortOnBadEntry(
"entry went bad while waiting for adapted body eof"))
841 debugs(11, 7,
"waiting for adapted body production ending");
859 if (
abortOnBadEntry(
"entry went bad while waiting for the now-aborted adapted body"))
866 debugs(11,5,
"waiting to consume the remainder of the aborted adapted body");
880 debugs(11,5,
"handleAdaptationCompleted");
888 debugs(11,3,
"closing origin conn due to ICAP completion");
899 debugs(11,5,
"handleAdaptationAborted; bypassable: " << bypassable <<
907 abortAll(
"adaptation failure with a filled entry");
916 debugs(11,8,
"adaptation failure with an empty entry: " << *
entry);
922 abortAll(
"adaptation failure with an empty entry");
940 debugs(11,5, blockedAnswer.lastCheckDescription());
954 debugs(11,7,
"creating adaptation block response");
974 if (
abortOnBadEntry(
"entry went bad while waiting for ICAP ACL check"))
986 debugs(11, 3,
"no adaptation needed");
1032 if (bodyBytesRead < 0)
1035 bodyBytesRead += delta;
1038 Must(bodyBytesRead >= 0);
1081 if (space < wantSpace) {
1083 space =
min(wantSpace, maxSpace);
1102 debugs(11,9,
"Client may read up to min(" <<
1103 adaptor_space <<
", " << space <<
") bytes");
1105 if (adaptor_space < space)
1106 space = adaptor_space;
#define Assure(condition)
RefCount< AsyncCallT< Dialer > > asyncCall(int aDebugSection, int aDebugLevel, const char *aName, const Dialer &aDialer)
#define JobCallback(dbgSection, dbgLevel, Dialer, job, method)
Convenience macro to create a Dialer-based job callback.
ErrorDetail::Pointer MakeNamedErrorDetail(const char *name)
bool urlIsRelative(const char *url)
err_type FindDenyInfoPage(const Acl::Answer &answer, const bool redirect_allowed)
#define SQUID_TCP_SO_RCVBUF
Acl::Answer const & fastCheck()
void updateAle(const AccessLogEntry::Pointer &)
void updateReply(const HttpReply::Pointer &)
static bool Start(Method method, VectPoint vp, HttpRequest *req, HttpReply *, const AccessLogEntryPointer &, Adaptation::Initiator *)
summarizes adaptation service answer for the noteAdaptationAnswer() API
Acl::Answer blockedToChecklistAnswer() const
creates an Acl::Answer from akBlock answer
Kind kind
the type of the answer
Http::MessagePointer message
HTTP request or response to forward.
bool final
whether the error, if any, cannot be bypassed
@ akForward
forward the supplied adapted HTTP message
@ akBlock
block or deny the master xaction; see authority
@ akError
no adapted message will come; see bypassable
CbcPointer< Initiate > initiateAdaptation(Initiate *x)
< starts freshly created initiate and returns a safe pointer to it
void clearAdaptation(CbcPointer< Initiate > &x)
clears the pointer (does not call announceInitiatorAbort)
void announceInitiatorAbort(CbcPointer< Initiate > &x)
inform the transaction about abnormal termination and clear the pointer
bool initiated(const CbcPointer< AsyncJob > &job) const
Must(initiated(initiate)) instead of Must(initiate.set()), for clarity.
iterates services in ServiceGroup, starting adaptation launchers
AnyP::UriScheme const & getScheme() const
void addRelativePath(const char *relUrl)
virtual bool doneAll() const
whether positive goal has been reached
void stopConsumingFrom(RefCount< BodyPipe > &)
void expectNoConsumption()
there will be no more setConsumer() calls
size_t putMoreData(const char *buf, size_t size)
size_t getMoreData(MemBuf &buf)
const MemBuf & buf() const
void setBodySize(uint64_t aSize)
uint64_t consumedSize() const
bool setConsumerIfNotLate(const Consumer::Pointer &aConsumer)
const char * status() const
void stopProducingFor(RefCount< BodyPipe > &, bool atEof)
void noteAdaptationAnswer(const Adaptation::Answer &answer) override
bool adaptationAccessCheckPending
void noteAdaptationAclCheckDone(Adaptation::ServiceGroupPointer group) override
void checkAdaptationWithBodyCompletion()
void adaptVirginReplyBody(const char *buf, ssize_t len)
void noteMoreBodySpaceAvailable(BodyPipe::Pointer) override
virtual void maybeReadVirginBody()=0
read response data from the network
void noteMoreBodyDataAvailable(BodyPipe::Pointer) override
void sendMoreRequestBody()
bool receivedWholeRequestBody
handleRequestBodyProductionEnded called
void handleAdaptationCompleted()
HttpReply * theFinalReply
void sendBodyIsTooLargeError()
BodyPipe::Pointer adaptedBodySource
BodyPipe::Pointer requestBodySource
AsyncCall::Pointer requestSender
void resumeBodyStorage()
called by StoreEntry when it has more buffer space available
virtual void completeForwarding()
virtual HttpRequestPointer originalRequest()
a hack to reach HttpStateData::orignal_request
virtual bool abortOnData(const char *reason)
void handleMoreAdaptedBodyAvailable()
const HttpReply * virginReply() const
bool handledEarlyAdaptationAbort()
virtual bool getMoreRequestBody(MemBuf &buf)
either fill buf with available [encoded] request body bytes or return false
bool doneAll() const override
whether positive goal has been reached
void startAdaptation(const Adaptation::ServiceGroupPointer &group, HttpRequest *cause)
Initiate an asynchronous adaptation transaction which will call us back.
virtual void abortAll(const char *reason)=0
abnormal transaction termination; reason is for debugging only
bool abortOnBadEntry(const char *abortReason)
Entry-dependent callbacks use this check to quit if the entry went bad.
void storeReplyBody(const char *buf, ssize_t len)
virtual void handleRequestBodyProducerAborted()=0
bool waitingForDelayAwareReadChance
whether we are waiting for MemObject::delayRead() to call us back
bool receivedWholeAdaptedReply
const char * markedParsedVirginReplyAsWhole
bool startRequestBodyFlow()
void handleAdaptedBodyProducerAborted()
void handleRequestBodyProductionEnded()
bool blockCaching()
whether to prevent caching of an otherwise cachable response
bool adaptedReplyAborted
handleAdaptedBodyProducerAborted() has been called
void handleAdaptedBodyProductionEnded()
HttpReply * setVirginReply(HttpReply *r)
void handleAdaptationBlocked(const Adaptation::Answer &answer)
BodyPipe::Pointer virginBodyDestination
void noteBodyProductionEnded(BodyPipe::Pointer) override
void adaptOrFinalizeReply()
size_t calcBufferSpaceToReserve(const size_t space, const size_t wantSpace) const
determine how much space the buffer needs to reserve
void addVirginReplyBody(const char *buf, ssize_t len)
void noteBodyProducerAborted(BodyPipe::Pointer) override
CbcPointer< Adaptation::Initiate > adaptedHeadSource
HttpRequestPointer request
void handleAdaptedHeader(Http::Message *msg)
virtual bool doneWithServer() const =0
void adjustBodyBytesRead(const int64_t delta)
initializes bodyBytesRead stats if needed and applies delta
void handleAdaptationAborted(bool bypassable=false)
void markParsedVirginReplyAsWhole(const char *reasonWeAreSure)
void noteBodyConsumerAborted(BodyPipe::Pointer) override
virtual void noteDelayAwareReadChance()=0
virtual bool mayReadVirginReplyBody() const =0
whether we may receive more virgin response body bytes
virtual void closeServer()=0
HttpReply * setFinalReply(HttpReply *r)
void handleMoreRequestBodyAvailable()
HttpReply * theVirginReply
virtual void processReplyBody()=0
MemBuf * responseBodyBuffer
virtual bool doneWithAdaptation() const
virtual void sentRequestBody(const CommIoCbParams &io)=0
virtual const Comm::ConnectionPointer & dataConnection() const =0
virtual void doneSendingRequestBody()=0
virtual void haveParsedReplyHeaders()
called when we have final (possibly adapted) reply headers; kids extend
int xerrno
The last errno to occur. non-zero if flag is Comm::COMM_ERROR.
int fd
FD which the call was about. Set by the async call creator.
Comm::Flag flag
comm layer result status.
void handleUnregisteredServerEnd()
void fail(ErrorState *err)
void markStoredReplyAsWhole(const char *whyWeAreSure)
AccessLogEntryPointer al
info for the future access.log entry
int64_t bodyBytesRead
number of body bytes received from the next hop or -1
static int64_t const UnknownPosition
const HttpHdrContRange * contentRange() const
bool expectingBody(const HttpRequestMethod &, int64_t &) const override
bool purgesOthers() const
Http::MethodType id() const
void detailError(const err_type c, const ErrorDetail::Pointer &d)
sets error detail if no earlier detail was available
AnyP::Uri url
the request URI
const SBuf & effectiveRequestUri() const
RFC 7230 section 5.5 - Effective Request URI.
common parts of HttpRequest and HttpReply
BodyPipe::Pointer body_pipe
optional pipeline to receive message body
Http::StatusCode status() const
retrieve the status code for this status line
void append(const char *c, int sz) override
void init(mb_size_t szInit, mb_size_t szMax)
char * content()
start of the added data
mb_size_t contentSize() const
available data size
mb_size_t potentialSpaceSize() const
void consume(mb_size_t sz)
removes sz bytes and "packs" by moving content left
const HttpReply & freshestReply() const
void delayRead(const AsyncCallPointer &)
static const size_type maxSize
Maximum size of a SBuf. By design it MUST be < MAX(size_type)/2. Currently 256Mb.
struct SquidConfig::@91 accessList
struct StatCounters::@105 server
struct StatCounters::@105::@115 all
size_t bytesWanted(Range< size_t > const aRange, bool ignoreDelayPool=false) const
int unlock(const char *context)
void release(const bool shareable=false)
void write(StoreIOBuffer)
void lock(const char *context)
void replaceHttpReply(const HttpReplyPointer &, const bool andStartWriting=true)
void deferProducer(const AsyncCall::Pointer &producer)
call back producer when more buffer space is available
void purgeEntriesByUrl(HttpRequest *req, const char *url)
static bool sameUrlHosts(const char *url1, const char *url2)
static void purgeEntriesByHeader(HttpRequest *req, const char *reqUrl, Http::Message *rep, Http::HdrType hdr)
void purgeEntriesByUrl(HttpRequest *req, const char *url)
A const & min(A const &lhs, A const &rhs)
#define debugs(SECTION, LEVEL, CONTENT)
#define EBIT_TEST(flag, bit)
@ RELEASE_REQUEST
prohibits making the key public
void fd_bytes(const int fd, const int len, const IoDirection direction)
void HTTPMSGUNLOCK(M *&a)
void HTTPMSGLOCK(Http::Message *a)
bool IsConnOpen(const Comm::ConnectionPointer &conn)
void Write(const Comm::ConnectionPointer &conn, const char *buf, int size, AsyncCall::Pointer &callback, FREE *free_func)
const char * xstrerr(int error)