client_side_reply.cc
Go to the documentation of this file.
56ErrorState *clientBuildError(err_type, Http::StatusCode, char const *, const ConnStateData *, HttpRequest *, const AccessLogEntry::Pointer &);
113 setReplyToError(failedrequest ? failedrequest->method : HttpRequestMethod(Http::METHOD_NONE), errstate);
155 entry->lock("clientReplyContext::setReplyToStoreEntry"); // removeClientStoreReference() unlocks
182clientReplyContext::removeClientStoreReference(store_client **scp, ClientHttpRequest *aHttpRequest)
350 Comm::ConnectionPointer conn = http->getConn() != nullptr ? http->getConn()->clientConnection : nullptr;
428 debugs(88, 3, "request to origin aborted '" << http->storeEntry()->url() << "', sending old entry to client");
457 if (http->request->flags.ims && !old_entry->modifiedSince(http->request->ims, http->request->imslen)) {
465 debugs(88, 3, "origin replied 304, revalidated existing entry and sending " << oldStatus << " to client");
478 debugs(88, 3, "origin replied " << status << " but with an older date header, sending old entry (" << oldStatus << ") to client");
492 debugs(88, 3, "origin replied with error " << status << ", forwarding to client due to fail_on_validation_err");
499 debugs(88, 3, "origin replied with error " << status << ", sending old entry (" << oldStatus << ") to client");
562 debugs(33, DBG_IMPORTANT, "clientProcessHit: URL mismatch, '" << e->mem_obj->storeId() << "' != '" << http->request->storeId() << "'");
737 err = clientBuildError(ERR_ACCESS_DENIED, Http::scForbidden, nullptr, http->getConn(), http->request, http->al);
759 Comm::ConnectionPointer conn = http->getConn() != nullptr ? http->getConn()->clientConnection : nullptr;
848 std::unique_ptr<ACLFilledChecklist> chl(clientAclChecklistCreate(Config.accessList.sendHit, http));
980clientReplyContext::purgeEntry(StoreEntry &entry, const Http::MethodType methodType, const char *descriptionPrefix)
999 rep->setHeaders(Http::scOkay, nullptr, "text/plain", http->request->prefixLen(), 0, squid_curtime);
1223 if ( !request->peer_login || (strcmp(request->peer_login,"PASS") != 0 && strcmp(request->peer_login,"PASSTHRU") != 0)) {
1268 hdr->putTime(Http::HdrType::EXPIRES, squid_curtime + http->storeEntry()->expires - http->storeEntry()->timestamp);
1273 snprintf(age, sizeof(age), "%" PRId64, static_cast<int64_t>(squid_curtime - http->storeEntry()->timestamp));
1358 Auth::UserRequest::AddReplyAuthHeader(reply, request->auth_user_request, request, http->flags.accel, 0);
1376 if (!Config.onoff.error_pconns && reply->sline.status() >= 400 && !request->flags.mustKeepalive) {
1380 debugs(33, 2, "clientBuildReplyHeader: Connection Keep-Alive not requested by admin or client");
1386 debugs(33, 2, "clientBuildReplyHeader: Connection oriented auth but server side non-persistent");
1421 hdr->putStr(Http::HdrType::CONNECTION, request->flags.proxyKeepalive ? "keep-alive" : "close");
1741 debugs(88, 5, "clientReplyContext::pushStreamData: marking request as complete due to 0 length store result");
2095 const_cast<HttpRequest *&>(http->request) = new HttpRequest(m, AnyP::PROTO_NONE, "http", null_string, mx);
2138 err->src_addr = conn && conn->clientConnection ? conn->clientConnection->remote : Ip::Address::NoAddr();
CSCB esiProcessStream
CSR esiStreamRead
CSD esiStreamDetach
CSS esiStreamStatus
void httpHeaderPutStrf(HttpHeader *hdr, Http::HdrType id, const char *fmt,...)
Definition: HttpHeaderTools.cc:54
void httpHdrMangleList(HttpHeader *l, HttpRequest *request, const AccessLogEntryPointer &al, req_or_rep_t req_or_rep)
Definition: HttpHeaderTools.cc:336
constexpr bool Less(const A a, const B b)
whether integer a is less than integer b, with correct overflow handling
Definition: SquidMath.h:48
int storeClientIsThisAClient(store_client *sc, void *someClient)
void nonBlockingCheck(ACLCB *callback, void *callback_data)
Definition: Checklist.cc:237
Definition: FilledChecklist.h:32
class AccessLogEntry::CacheDetails cache
class AccessLogEntry::HttpDetails http
Definition: Acl.h:128
static void AddReplyAuthHeader(HttpReply *rep, UserRequest::Pointer auth_user_request, HttpRequest *request, int accelerated, int internal)
Add the appropriate [Proxy-]Authenticate header to the given reply.
Definition: UserRequest.cc:479
Definition: client_side_request.h:38
struct ClientHttpRequest::Out out
void updateLoggingTags(const LogTags_ot code)
update the code in the transaction processing tags
Definition: client_side_request.h:94
struct ClientHttpRequest::Flags flags
bool requestSatisfactionMode() const
Definition: client_side_request.h:214
const LogTags & loggingTags() const
the processing tags associated with this request transaction.
Definition: client_side_request.h:97
StoreEntry * loggingEntry() const
Definition: client_side_request.h:68
struct ClientHttpRequest::Redirect redirect
Definition: client_side.h:84
AnyP::Port port
destination port of the request that caused serverConnection
Definition: client_side.h:145
static DelayId DelayClient(ClientHttpRequest *, HttpReply *reply=nullptr)
Definition: DelayId.cc:68
Definition: errorpage.h:89
static void Start(const Comm::ConnectionPointer &client, StoreEntry *, HttpRequest *, const AccessLogEntryPointer &alp)
Initiates request forwarding to a peer or origin server.
Definition: FwdState.cc:341
Definition: HttpHeader.h:51
Definition: HttpHeader.h:75
HttpHeaderEntry * getEntry(HttpHeaderPos *pos) const
Definition: HttpHeader.cc:584
void addVia(const AnyP::ProtocolVersion &ver, const HttpHeader *from=nullptr)
Definition: HttpHeader.cc:946
HttpHeaderEntry * findEntry(Http::HdrType id) const
Definition: HttpHeader.cc:603
Definition: HttpReply.h:25
void setHeaders(Http::StatusCode status, const char *reason, const char *ctype, int64_t clen, time_t lmt, time_t expires)
Definition: HttpReply.cc:170
void removeIrrelevantContentLength()
Some response status codes prohibit sending Content-Length (RFC 7230 section 3.3.2).
Definition: HttpReply.cc:648
bool receivedBodyTooLarge(HttpRequest &, int64_t receivedBodySize)
Definition: HttpReply.cc:557
bool expectedBodyTooLarge(HttpRequest &request)
Definition: HttpReply.cc:565
Definition: RequestMethod.h:27
Definition: HttpRequest.h:49
CbcPointer< ConnStateData > clientConnectionManager
Definition: HttpRequest.h:232
SBuf vary_headers
The variant second-stage cache key. Generated from Vary header pattern for this request.
Definition: HttpRequest.h:170
String etag
A strong etag of the cached entry. Used for refreshing that entry.
Definition: HttpRequest.h:191
void ignoreRange(const char *reason)
forgets about the cached Range header (for a reason)
Definition: HttpRequest.cc:621
Auth::UserRequest::Pointer auth_user_request
Definition: HttpRequest.h:127
const SBuf & effectiveRequestUri() const
RFC 7230 section 5.5 - Effective Request URI.
Definition: HttpRequest.cc:744
AnyP::ProtocolVersion version
breakdown of protocol version label: (HTTP/ICY) and (0.9/1.0/1.1)
Definition: StatusLine.h:65
Http::StatusCode status() const
retrieve the status code for this status line
Definition: StatusLine.h:45
Definition: LogTags.h:67
LogTags_ot oldType
a set of client protocol, cache use, and other transaction outcome tags
Definition: LogTags.h:93
static Pointer MakePortful(const AnyP::PortCfgPointer &aPort)
Definition: MasterXaction.h:54
Definition: MemObject.h:34
Definition: RequestFlags.h:23
int cmp(const SBuf &S, const size_type n) const
shorthand version for compare()
Definition: SBuf.h:275
struct SquidConfig2::@120 onoff
struct SquidConfig::@107 accessList
struct SquidConfig::@106 onoff
bool mayInitiateCollapsing() const
whether Squid configuration allows us to become a CF initiator
Definition: StoreClient.h:58
bool startCollapsingOn(const StoreEntry &, const bool doingRevalidation) const
Definition: store_client.cc:66
Definition: Store.h:42
bool hasIfMatchEtag(const HttpRequest &request) const
has ETag matching at least one of the If-Match etags
Definition: store.cc:1859
void ensureMemObject(const char *storeId, const char *logUri, const HttpRequestMethod &aMethod)
initialize mem_obj (if needed) and set URIs/method (if missing)
Definition: store.cc:1575
bool hasIfNoneMatchEtag(const HttpRequest &request) const
has ETag matching at least one of the If-None-Match etags
Definition: store.cc:1866
bool hasEtag(ETag &etag) const
whether this entry has an ETag; if yes, puts ETag value into parameter
Definition: store.cc:1848
void storeErrorResponse(HttpReply *reply)
Store a prepared error response. MemObject locks the reply object.
Definition: store.cc:1674
void replaceHttpReply(const HttpReplyPointer &, const bool andStartWriting=true)
Definition: store.cc:1691
bool modifiedSince(const time_t ims, const int imslen=-1) const
Definition: store.cc:1822
Definition: StoreIOBuffer.h:16
struct StoreIOBuffer::@141 flags
bool allowCollapsing(StoreEntry *, const RequestFlags &, const HttpRequestMethod &)
tries to make the entry available for collapsing future requests
Definition: Controller.cc:735
void evictIfFound(const cache_key *) override
Definition: Controller.cc:501
Definition: client_side_reply.h:23
void handleIMSReply(StoreIOBuffer result)
Definition: client_side_reply.cc:404
void sendNotModifiedOrPreconditionFailedError()
Definition: client_side_reply.cc:1815
void setReplyToReply(HttpReply *reply)
creates a store entry for the reply and appends error reply to it
Definition: client_side_reply.cc:134
static ACLCB ProcessReplyAccessResult
Definition: client_side_reply.h:101
bool alwaysAllowResponse(Http::StatusCode sline) const
Definition: client_side_reply.cc:1178
void sendPreconditionFailedError()
send 412 (Precondition Failed) to client
Definition: client_side_reply.cc:1771
void triggerInitialStoreRead(STCB=SendMoreData)
Definition: client_side_reply.cc:238
bool matchesStreamBodyBuffer(const StoreIOBuffer &) const
Definition: client_side_reply.cc:2049
void sendStreamError(StoreIOBuffer const &result)
Definition: client_side_reply.cc:1721
void pushStreamData(const StoreIOBuffer &)
Definition: client_side_reply.cc:1738
void sendClientUpstreamResponse(const StoreIOBuffer &upstreamResponse)
Definition: client_side_reply.cc:367
void identifyFoundObject(StoreEntry *entry, const char *detail)
Definition: client_side_reply.cc:1506
void createStoreEntry(const HttpRequestMethod &m, RequestFlags flags)
Definition: client_side_reply.cc:2081
void setReplyToStoreEntry(StoreEntry *e, const char *reason)
replaces current response store entry with the given one
Definition: client_side_reply.cc:153
bool errorInStream(const StoreIOBuffer &result) const
Definition: client_side_reply.cc:1713
void processOnlyIfCachedMiss()
Definition: client_side_reply.cc:772
bool blockedHit() const
whether squid.conf send_hit prevents us from serving this hit
Definition: client_side_reply.cc:838
static decltype(::storeClientCopy) storeClientCopy
Definition: client_side_reply.h:137
int storeNotOKTransferDone() const
Definition: client_side_reply.cc:1056
void removeClientStoreReference(store_client **scp, ClientHttpRequest *http)
Definition: client_side_reply.cc:182
friend CSR clientGetMoreData
Definition: client_side_reply.h:164
~clientReplyContext() override
Definition: client_side_reply.cc:60
struct clientReplyContext::Flags flags
void processReplyAccessResult(const Acl::Answer &accessAllowed)
Definition: client_side_reply.cc:1866
const char * firstStoreLookup_
Definition: client_side_reply.h:142
void sendBodyTooLargeError()
Definition: client_side_reply.cc:1758
CollapsedRevalidation collapsedRevalidation
Definition: client_side_reply.h:158
const char * storeLookupString(bool found) const
Definition: client_side_reply.h:124
bool purgeEntry(StoreEntry &, const Http::MethodType, const char *descriptionPrefix="")
Definition: client_side_reply.cc:980
void requestMoreBodyFromStore()
Definition: client_side_reply.cc:251
void noteStreamBufferredBytes(const StoreIOBuffer &)
Definition: client_side_reply.cc:2066
void sendMoreData(StoreIOBuffer result)
Definition: client_side_reply.cc:1967
StoreIOBuffer lastStreamBufferedBytes
HTTP response body bytes stored in our Client Stream buffer (if any)
Definition: client_side_reply.h:161
clientStream_status_t replyStatus()
Definition: client_side_reply.cc:1113
void removeStoreReference(store_client **scp, StoreEntry **ep)
Definition: client_side_reply.cc:167
LogTags * loggingTags() const override
Definition: client_side_reply.cc:887
bool processConditional()
process conditional request from client
Definition: client_side_reply.cc:784
int storeOKTransferDone() const
Definition: client_side_reply.cc:1041
void processReplyAccess()
Definition: client_side_reply.cc:1825
clientStreamNode * getNextNode() const
Definition: client_side_reply.cc:229
void fillChecklist(ACLFilledChecklist &) const override
configure the given checklist (to reflect the current transaction state)
Definition: client_side_reply.cc:2073
void identifyStoreObject()
Definition: client_side_reply.cc:1483
void setReplyToError(err_type, Http::StatusCode, char const *, const ConnStateData *, HttpRequest *, const char *, Auth::UserRequest::Pointer)
builds error using clientBuildError() and calls setReplyToError() below
Definition: client_side_reply.cc:95
clientReplyContext(ClientHttpRequest *)
Definition: client_side_reply.cc:74
void detailStoreLookup(const char *detail)
remembers the very first Store lookup classification, ignoring the rest
Definition: client_side_reply.cc:1585
Definition: clientStream.h:76
Definition: StoreClient.h:70
void CSD(clientStreamNode *, ClientHttpRequest *)
client stream detach
Definition: clientStreamForward.h:33
void CSR(clientStreamNode *, ClientHttpRequest *)
client stream read
Definition: clientStreamForward.h:30
clientStream_status_t CSS(clientStreamNode *, ClientHttpRequest *)
Definition: clientStreamForward.h:35
int varyEvaluateMatch(StoreEntry *entry, HttpRequest *request)
Definition: client_side.cc:3422
void clientAclChecklistFill(ACLFilledChecklist &checklist, ClientHttpRequest *http)
Definition: client_side.cc:3494
ACLFilledChecklist * clientAclChecklistCreate(const acl_access *acl, ClientHttpRequest *http)
Definition: client_side.cc:3486
ErrorState * clientBuildError(err_type, Http::StatusCode, char const *, const ConnStateData *, HttpRequest *, const AccessLogEntry::Pointer &)
Definition: client_side_reply.cc:2134
void purgeEntriesByUrl(HttpRequest *req, const char *url)
Definition: client_side_reply.cc:862
const char * null_string
err_type aclGetDenyInfoPage(AclDenyInfoList **head, const char *name, int redirect_allowed)
Definition: Gadgets.cc:39
void clientStreamCallback(clientStreamNode *thisObject, ClientHttpRequest *http, HttpReply *rep, StoreIOBuffer replyBuffer)
Definition: clientStream.cc:150
void clientStreamInsertHead(dlink_list *list, CSR *func, CSCB *callback, CSD *detach, CSS *status, ClientStreamData data)
Definition: clientStream.cc:131
void clientStreamDetach(clientStreamNode *thisObject, ClientHttpRequest *http)
Definition: clientStream.cc:192
void errorAppendEntry(StoreEntry *entry, ErrorState *err)
Definition: errorpage.cc:717
Definition: forward.h:18
enum Http::_method_t MethodType
AnyP::ProtocolVersion ProtocolVersion(unsigned int aMajor, unsigned int aMinor)
HTTP version label information.
Definition: ProtocolVersion.h:19
int doNfmarkLocalHit(const Comm::ConnectionPointer &conn)
Definition: QosConfig.cc:275
int doTosLocalMiss(const Comm::ConnectionPointer &conn, const hier_code hierCode)
Definition: QosConfig.cc:226
int doNfmarkLocalMiss(const Comm::ConnectionPointer &conn, const hier_code hierCode)
Definition: QosConfig.cc:247
int doTosLocalHit(const Comm::ConnectionPointer &conn)
Definition: QosConfig.cc:268
void neighborsHtcpClear(StoreEntry *e, HttpRequest *req, const HttpRequestMethod &method, htcp_clr_reason reason)
Definition: neighbors.cc:1673
int refreshCheckHTTP(const StoreEntry *entry, HttpRequest *request)
Definition: refresh.cc:575
StoreEntry * storeGetPublicByRequestMethod(HttpRequest *req, const HttpRequestMethod &method, const KeyScope keyScope)
Definition: store.cc:496
StoreEntry * storeGetPublicByRequest(HttpRequest *req, const KeyScope keyScope)
Definition: store.cc:502
StoreEntry * storeCreateEntry(const char *url, const char *logUrl, const RequestFlags &flags, const HttpRequestMethod &method)
Definition: store.cc:745
StoreEntry * storeGetPublic(const char *uri, const HttpRequestMethod &method)
Definition: store.cc:490
int storeUnregister(store_client *sc, StoreEntry *e, void *data)
Definition: store_client.cc:749
store_client * storeClientListAdd(StoreEntry *e, void *data)
Definition: store_client.cc:123
const cache_key * storeKeyPublic(const char *url, const HttpRequestMethod &method, const KeyScope keyScope)
Definition: store_key_md5.cc:95
uint64_t size
Response header and body bytes written to the client connection.
Definition: client_side_request.h:156
unsigned storelogiccomplete
Definition: client_side_reply.h:82
Definition: parse.c:104