client_side_reply.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9#ifndef SQUID_CLIENTSIDEREPLY_H
10#define SQUID_CLIENTSIDEREPLY_H
11
12#include "acl/forward.h"
13#include "client_side_request.h"
14#include "ip/forward.h"
15#include "RequestFlags.h"
16#include "StoreClient.h"
17
18class ErrorState;
19
20/* XXX make static method */
21
23{
25
26public:
27 static STCB CacheHit;
30
32 ~clientReplyContext() override;
33
34 void saveState();
35 void restoreState();
36 void purgeRequest ();
38 void doGetMoreData();
40 void identifyFoundObject(StoreEntry *entry, const char *detail);
41 int storeOKTransferDone() const;
42 int storeNotOKTransferDone() const;
44 void setReplyToStoreEntry(StoreEntry *e, const char *reason);
46 void setReplyToError(err_type, Http::StatusCode, char const *, const ConnStateData *, HttpRequest *, const char *,
47#if USE_AUTH
49#else
50 void * unused);
51#endif
53 void setReplyToError(const HttpRequestMethod& method, ErrorState *err);
59 void startError(ErrorState * err);
60 void processExpired();
62 void processMiss();
64 const char *storeId() const { return (http->store_id.size() > 0 ? http->store_id.termedBuf() : http->uri); }
65
67
68 /* StoreClient API */
69 LogTags *loggingTags() const override;
70
76 store_client *sc; /* The store_client we're using */
77 size_t reqsize;
78 size_t reqofs;
80
81 struct Flags {
83
85 unsigned complete:1;
88 clientStreamNode *ourNode; /* This will go away if/when this file gets refactored some more */
89
90private:
91 /* StoreClient API */
92 void fillChecklist(ACLFilledChecklist &) const override;
93
95 void makeThisHead();
96 bool errorInStream(StoreIOBuffer const &result, size_t const &sizeToProcess)const ;
97 void sendStreamError(StoreIOBuffer const &result);
98 void pushStreamData(StoreIOBuffer const &result, char *source);
99 clientStreamNode * next() const;
101 void processReplyAccess();
103 void processReplyAccessResult(const Acl::Answer &accessAllowed);
104 void cloneReply();
105 void buildReplyHeader ();
106 bool alwaysAllowResponse(Http::StatusCode sline) const;
107 int checkTransferDone();
109 bool processConditional();
110 void cacheHit(StoreIOBuffer result);
111 void handleIMSReply(StoreIOBuffer result);
112 void sendMoreData(StoreIOBuffer result);
114 void sendClientOldEntry();
115 void purgeAllCached();
118 bool purgeEntry(StoreEntry &, const Http::MethodType, const char *descriptionPrefix = "");
120 void purgeDoPurge();
121 void forgetHit();
122 bool blockedHit() const;
123 const char *storeLookupString(bool found) const { return found ? "match" : "mismatch"; }
124 void detailStoreLookup(const char *detail);
125
128 void sendNotModified();
130
134 const char *firstStoreLookup_ = nullptr;
135
136 /* (stale) cache hit information preserved during IMS revalidation */
143
145
146 typedef enum {
147 crNone = 0,
149 crSlave
151
153};
154
155// TODO: move to SideAgent parent, when we have one
156void purgeEntriesByUrl(HttpRequest *, const char *);
157
158#endif /* SQUID_CLIENTSIDEREPLY_H */
159
void ACLCB(Acl::Answer, void *)
ACL checklist callback.
Definition: Checklist.h:19
#define RefCountable
The locking interface for use on Reference-Counted classes.
Definition: Lock.h:66
void STCB(void *, StoreIOBuffer)
Definition: StoreClient.h:19
#define CBDATA_CLASS(type)
Definition: cbdata.h:289
a storeGetPublic*() caller
Definition: StoreClient.h:27
char const * termedBuf() const
Definition: SquidString.h:92
size_type size() const
Definition: SquidString.h:73
void handleIMSReply(StoreIOBuffer result)
clientStreamNode * ourNode
void sendNotModifiedOrPreconditionFailedError()
void setReplyToReply(HttpReply *reply)
creates a store entry for the reply and appends error reply to it
void traceReply(clientStreamNode *node)
static ACLCB ProcessReplyAccessResult
bool alwaysAllowResponse(Http::StatusCode sline) const
static STCB HandleIMSReply
void sendPreconditionFailedError()
send 412 (Precondition Failed) to client
store_client * old_sc
void cacheHit(StoreIOBuffer result)
void sendStreamError(StoreIOBuffer const &result)
@ crInitiator
we initiated collapsed revalidation request
@ crNone
collapsed revalidation is not allowed for this context
@ crSlave
we collapsed on the existing revalidation request
Http::StatusCode purgeStatus
void startError(ErrorState *err)
void identifyFoundObject(StoreEntry *entry, const char *detail)
void sendNotModified()
send 304 (Not Modified) to client
void createStoreEntry(const HttpRequestMethod &m, RequestFlags flags)
void setReplyToStoreEntry(StoreEntry *e, const char *reason)
replaces current response store entry with the given one
bool blockedHit() const
whether squid.conf send_hit prevents us from serving this hit
bool errorInStream(StoreIOBuffer const &result, size_t const &sizeToProcess) const
int storeNotOKTransferDone() const
void removeClientStoreReference(store_client **scp, ClientHttpRequest *http)
void pushStreamData(StoreIOBuffer const &result, char *source)
~clientReplyContext() override
struct clientReplyContext::Flags flags
void processReplyAccessResult(const Acl::Answer &accessAllowed)
const char * firstStoreLookup_
CollapsedRevalidation collapsedRevalidation
char tempbuf[HTTP_REQBUF_SZ]
a temporary buffer if we need working storage
const char * storeLookupString(bool found) const
bool purgeEntry(StoreEntry &, const Http::MethodType, const char *descriptionPrefix="")
clientStreamNode * next() const
void sendMoreData(StoreIOBuffer result)
ClientHttpRequest * http
clientStream_status_t replyStatus()
void removeStoreReference(store_client **scp, StoreEntry **ep)
LogTags * loggingTags() const override
const char * storeId() const
bool processConditional()
process conditional request from client
int storeOKTransferDone() const
clientStreamNode * getNextNode() const
void fillChecklist(ACLFilledChecklist &) const override
configure the given checklist (to reflect the current transaction state)
void setReplyToError(err_type, Http::StatusCode, char const *, const ConnStateData *, HttpRequest *, const char *, Auth::UserRequest::Pointer)
builds error using clientBuildError() and calls setReplyToError() below
void purgeDoPurge()
releases both cached GET and HEAD entries
static STCB SendMoreData
clientReplyContext(ClientHttpRequest *)
void detailStoreLookup(const char *detail)
remembers the very first Store lookup classification, ignoring the rest
void purgeEntriesByUrl(HttpRequest *, const char *)
clientStream_status_t
Definition: enums.h:125
err_type
Definition: forward.h:14
#define HTTP_REQBUF_SZ
Definition: forward.h:14
enum Http::_method_t MethodType
StatusCode
Definition: StatusCode.h:20
unsigned complete
we have read all we can from upstream
Definition: parse.c:104

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors