#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::ConnectionPointer
dataConnection () 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
 
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...
 
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)
 
bool peerSupportsConnectionPinning () const
 

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
 

Static Private Attributes

static cbdata_type CBDATA_HttpStateData = CBDATA_UNKNOWN
 

Detailed Description

Definition at line 21 of file http.h.

Member Typedef Documentation

Definition at line 25 of file BodyPipe.h.

Definition at line 34 of file AsyncJob.h.

Definition at line 45 of file BodyPipe.h.

Member Enumeration Documentation

Enumerator
INCOMPLETE_MSG 
COMPLETE_PERSISTENT_MSG 
COMPLETE_NONPERSISTENT_MSG 

Definition at line 87 of file http.h.

Constructor & Destructor Documentation

HttpStateData::~HttpStateData ( )

Definition at line 126 of file http.cc.

References _peer, cbdataReferenceDone, debugs, HERE(), httpChunkDecoder, and serverConnection.

Member Function Documentation

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

Implements Client.

Definition at line 2445 of file http.cc.

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

Referenced by abortTransaction().

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

abnormal data transfer termination

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

Reimplemented in Ftp::Relay.

Definition at line 288 of file Client.cc.

References Client::abortAll().

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

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

Definition at line 108 of file http.h.

References abortAll().

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

void Client::adaptVirginReplyBody ( const char *  buf,
ssize_t  len 
)
protectedinherited
void Client::addVirginReplyBody ( const char *  buf,
ssize_t  len 
)
protectedinherited
void Client::adjustBodyBytesRead ( const int64_t  delta)
protectedinherited
void Adaptation::Initiator::announceInitiatorAbort ( CbcPointer< Initiate > &  x)
protectedinherited

Definition at line 38 of file Initiator.cc.

References CallJobHere.

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

size_t Client::calcBufferSpaceToReserve ( const size_t  space,
const size_t  wantSpace 
) const
protectedinherited
void AsyncJob::callEnd ( )
virtualinherited
void AsyncJob::callStart ( AsyncCall call)
inherited
bool AsyncJob::canBeCalled ( AsyncCall call) const
inherited

Definition at line 101 of file AsyncJob.cc.

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

void HttpStateData::checkDateSkew ( HttpReply reply)
private

Definition at line 645 of file http.cc.

References _peer, HttpReply::date, debugs, URL::host(), Client::request, squid_curtime, and HttpRequest::url.

Referenced by processReplyHeader().

void Adaptation::Initiator::clearAdaptation ( CbcPointer< Initiate > &  x)
protectedinherited
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 1623 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(), handleMoreRequestBodyAvailable(), httpTimeout(), readReply(), and wroteLast().

void Client::completeForwarding ( )
protectedvirtualinherited
bool HttpStateData::continueAfterParsingHeader ( )
private
Return values
trueif we can continue with processing the body or doing ICAP.
Return values
falseIf we have not finished parsing the headers and may get more data. Schedules more reads to retrieve the missing data.

If we are done with parsing, check for errors

Definition at line 1250 of file http.cc.

References RequestFlags::accelerated, assert, closeServer(), DBG_IMPORTANT, debugs, Http::StateFlags::do_next_read, FwdState::dontRetry(), Client::entry, eof, ERR_INVALID_RESP, ERR_NONE, ERR_TOO_BIG, ERR_ZERO_SIZE_OBJECT, error(), FwdState::fail(), flags, HttpRequest::flags, Client::fwd, Http::StateFlags::handling1xx, Http::StateFlags::headers_parsed, HERE(), inBuf, SBuf::length(), maybeReadVirginBody(), Must, AsyncJob::mustStop(), Http::ProtocolVersion(), FwdState::request, Client::request, StoreEntry::reset(), Http::scBadGateway, Http::scHeaderTooLarge, Http::scInvalidHeader, HttpRequest::url, StoreEntry::url(), and Client::virginReply().

Referenced by processReply().

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

Implements Client.

Definition at line 141 of file http.cc.

References serverConnection.

bool HttpStateData::decideIfWeDoRanges ( HttpRequest orig_request)
staticprivate
void AsyncJob::deleteThis ( const char *  aReason)
protectedinherited
bool AsyncJob::done ( ) const
protectedinherited

Definition at line 90 of file AsyncJob.cc.

References AsyncJob::doneAll(), NULL, and AsyncJob::stopReason.

Referenced by AsyncJob::callEnd(), and Downloader::downloadFinished().

bool Client::doneAll ( ) const
virtualinherited

Reimplemented from AsyncJob.

Definition at line 194 of file Client.cc.

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

void HttpStateData::doneSendingRequestBody ( )
privatevirtual
bool Client::doneWithAdaptation ( ) const
protectedvirtualinherited
bool HttpStateData::doneWithServer ( ) const
privatevirtual

did we end communication?

Implements Client.

Definition at line 1636 of file http.cc.

References Comm::IsConnOpen(), and serverConnection.

Referenced by mayReadVirginReplyBody().

void Client::endAdaptedBodyConsumption ( )
protectedinherited
HttpReply * Client::finalReply ( )
protectedinherited

Definition at line 129 of file Client.cc.

References assert, and Client::theFinalReply.

Referenced by haveParsedReplyHeaders(), and reusableReply().

bool HttpStateData::finishingChunkedRequest ( )
private
void Client::handleAdaptationAborted ( bool  bypassable = false)
protectedinherited
void Client::handleAdaptedBodyProductionEnded ( )
protectedinherited
bool Client::handledEarlyAdaptationAbort ( )
protectedinherited
void Client::handleRequestBodyProductionEnded ( )
protectedinherited
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 1747 of file http.cc.

References SquidConfig::Accel, RequestFlags::accelerated, HttpHeader::addEntry(), HttpHeader::addVia(), assert, URL::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, HttpRequest::client_addr, Config, Http::CONNECTION, copyOneHeaderFromClientsideRequestToUpstreamRequest(), DBG_IMPORTANT, debugs, decideIfWeDoRanges(), EBIT_SET, HttpRequest::effectiveRequestUri(), HttpRequest::etag, HttpRequest::flags, Http::StateFlags::front_end_https, Http::FRONT_END_HTTPS, HttpHeader::getCc(), HttpHeader::getEntry(), HttpHeader::getList(), getMaxAge(), URL::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, RequestFlags::proxying, HttpHeader::putCc(), HttpHeader::putStr(), HttpHeader::putTime(), ROR_REQUEST, String::size(), strListAdd(), Http::SURROGATE_CAPABILITY, SquidConfig::surrogate_id, String::termedBuf(), Ip::Address::toStr(), Http::TRANSFER_ENCODING, HttpRequest::url, StoreEntry::url(), URL::userInfo(), and Http::X_FORWARDED_FOR.

Referenced by buildRequestPrefix(), htcpClear(), htcpQuery(), and tunnelRelayConnectRequest().

void HttpStateData::httpStateConnClosed ( const CommCloseCbParams params)
private
CbcPointer< Adaptation::Initiate > Adaptation::Initiator::initiateAdaptation ( Initiate x)
protectedinherited
bool Adaptation::Initiator::initiated ( const CbcPointer< AsyncJob > &  job) const
inlineprotectedinherited

Definition at line 52 of file Initiator.h.

References CbcPointer< Cbc >::set().

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

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 1530 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().

bool HttpStateData::mayReadVirginReplyBody ( ) const
privatevirtual

Implements Client.

Definition at line 1495 of file http.cc.

References doneWithServer().

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 906 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().

void Client::noteAdaptationAnswer ( const Adaptation::Answer answer)
virtualinherited
void Client::noteBodyConsumerAborted ( BodyPipe::Pointer  )
virtualinherited
void Client::noteBodyProducerAborted ( BodyPipe::Pointer  bp)
virtualinherited
void Client::noteBodyProductionEnded ( BodyPipe::Pointer  bp)
virtualinherited
void Client::noteMoreBodyDataAvailable ( BodyPipe::Pointer  bp)
virtualinherited
void Client::noteMoreBodySpaceAvailable ( BodyPipe::Pointer  )
virtualinherited
void HttpStateData::operator delete ( void *  address)
inline

Definition at line 23 of file http.h.

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

Definition at line 23 of file http.h.

bool HttpStateData::peerSupportsConnectionPinning ( ) const
private
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 persistant
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 1064 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().

void HttpStateData::proceedAfter1xx ( )
protected

Definition at line 830 of file http.cc.

References CallJobHere, debugs, flags, Http::StateFlags::handling1xx, Must, payloadSeen, and processReply().

Referenced by handle1xx().

void HttpStateData::processReply ( )
protected

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

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

size_t Client::replyBodySpace ( const MemBuf readBuf,
const size_t  minSpace 
) const
protectedinherited
void HttpStateData::requestBodyHandler ( MemBuf )
private
HttpStateData::ReuseDecision::Answers HttpStateData::reusableReply ( HttpStateData::ReuseDecision decision)

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

void HttpStateData::sendComplete ( )
private
void HttpStateData::sentRequestBody ( const CommIoCbParams io)
privatevirtual

Implements Client.

Definition at line 2436 of file http.cc.

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

Referenced by sendRequest().

HttpReply * Client::setVirginReply ( HttpReply r)
protectedinherited

Definition at line 118 of file Client.cc.

References assert, debugs, HERE(), HTTPMSGLOCK(), and Client::theVirginReply.

Referenced by processReplyHeader().

void HttpStateData::start ( )
privatevirtual
bool Client::startRequestBodyFlow ( )
protectedinherited
HttpStateData::ConnectionStatus HttpStateData::statusIfComplete ( ) const
private
If the reply wants to close the connection, it takes precedence
If we didn't send a keep-alive request header, then this can not 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 1019 of file http.cc.

References COMPLETE_NONPERSISTENT_MSG, COMPLETE_PERSISTENT_MSG, debugs, Client::entry, flags, 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().

void BodyProducer::stopProducingFor ( RefCount< BodyPipe > &  p,
bool  atEof 
)
protectedinherited
void Client::storeReplyBody ( const char *  buf,
ssize_t  len 
)
protectedinherited

Definition at line 994 of file Client.cc.

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

Referenced by Client::addVirginReplyBody().

void* HttpStateData::toCbdata ( )
inlinevirtualnoexcept

Implements CbdataParent.

Definition at line 23 of file http.h.

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 1317 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().

HttpReply * Client::virginReply ( )
protectedinherited

Definition at line 104 of file Client.cc.

References assert, and Client::theVirginReply.

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

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

Referenced by processReplyBody().

Member Data Documentation

bool Client::adaptationAccessCheckPending = false
protectedinherited
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_type HttpStateData::CBDATA_HttpStateData = CBDATA_UNKNOWN
staticprivate

Definition at line 23 of file http.h.

AsyncCall::Pointer HttpStateData::closeHandler
private

Definition at line 86 of file http.h.

Referenced by closeServer(), finishingBrokenPost(), HttpStateData(), processReplyBody(), and sendRequest().

int64_t Client::currentOffset = 0
protectedinherited
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(), and Client::swanSong().

Http1::ResponseParserPointer HttpStateData::hp
private

Definition at line 142 of file http.h.

Referenced by processReplyHeader().

Http1::TeChunkedParser* HttpStateData::httpChunkDecoder
private

Definition at line 143 of file http.h.

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

const InstanceId<AsyncJob> AsyncJob::id
protectedinherited

Definition at line 70 of file AsyncJob.h.

bool HttpStateData::ignoreCacheControl
AsyncCall::Pointer AsyncJob::inCall
protectedinherited
int HttpStateData::lastChunk

Definition at line 65 of file http.h.

Referenced by decodeAndWriteReplyBody(), and persistentConnStatus().

int64_t HttpStateData::payloadSeen
private
int64_t HttpStateData::payloadTruncated
private

Definition at line 148 of file http.h.

Referenced by persistentConnStatus(), and truncateVirginBody().

size_t HttpStateData::read_sz

Definition at line 67 of file http.h.

bool Client::receivedWholeRequestBody = false
protectedinherited
MemBuf* Client::responseBodyBuffer = nullptr
protectedinherited
bool HttpStateData::sawDateGoBack
private

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

Definition at line 152 of file http.h.

Referenced by haveParsedReplyHeaders(), and reusableReply().

bool Client::startedAdaptation = false
protectedinherited
const char* AsyncJob::stopReason
protectedinherited
bool HttpStateData::surrogateNoStore

Definition at line 70 of file http.h.

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


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors