client_side_reply.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2020 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 
18 class ErrorState;
19 
20 /* XXX make static method */
21 
23 {
25 
26 public:
27  static STCB CacheHit;
30 
33 
34  void saveState();
35  void restoreState();
36  void purgeRequest ();
38  void purgeDoMissPurge();
39  void purgeFoundGet(StoreEntry *newEntry);
40  void purgeFoundHead(StoreEntry *newEntry);
41  void purgeFoundObject(StoreEntry *entry);
43  void purgeDoPurgeGet(StoreEntry *entry);
44  void purgeDoPurgeHead(StoreEntry *entry);
45  void doGetMoreData();
46  void identifyStoreObject();
47  void identifyFoundObject(StoreEntry *entry);
48  int storeOKTransferDone() const;
49  int storeNotOKTransferDone() const;
51  void setReplyToStoreEntry(StoreEntry *e, const char *reason);
53  void setReplyToError(err_type, Http::StatusCode, const HttpRequestMethod&, char const *, Ip::Address &, HttpRequest *, const char *,
54 #if USE_AUTH
56 #else
57  void * unused);
58 #endif
64  void removeStoreReference(store_client ** scp, StoreEntry ** ep);
66  void startError(ErrorState * err);
67  void processExpired();
69  void processMiss();
71  const char *storeId() const { return (http->store_id.size() > 0 ? http->store_id.termedBuf() : http->uri); }
72 
74 
75  /* state variable - replace with class to handle storeentries at some point */
77 
78  /* StoreClient API */
79  virtual void created (StoreEntry *newEntry);
80  virtual LogTags *loggingTags();
81 
87  store_client *sc; /* The store_client we're using */
88  StoreIOBuffer tempBuffer; /* For use in validating requests via IMS */
89  int old_reqsize; /* ... again, for the buffer */
90  size_t reqsize;
91  size_t reqofs;
93 #if USE_CACHE_DIGESTS
94 
95  const char *lookup_type; /* temporary hack: storeGet() result: HIT/MISS/NONE */
96 #endif
97 
98  struct Flags {
100 
101  unsigned storelogiccomplete:1;
102  unsigned complete:1;
104  } flags;
105  clientStreamNode *ourNode; /* This will go away if/when this file gets refactored some more */
106 
107 private:
108  /* StoreClient API */
109  virtual void fillChecklist(ACLFilledChecklist &) const;
110 
111  clientStreamNode *getNextNode() const;
112  void makeThisHead();
113  bool errorInStream(StoreIOBuffer const &result, size_t const &sizeToProcess)const ;
114  void sendStreamError(StoreIOBuffer const &result);
115  void pushStreamData(StoreIOBuffer const &result, char *source);
116  clientStreamNode * next() const;
119  void processReplyAccess();
121  void processReplyAccessResult(const Acl::Answer &accessAllowed);
122  void cloneReply();
123  void buildReplyHeader ();
124  bool alwaysAllowResponse(Http::StatusCode sline) const;
125  int checkTransferDone();
127  bool processConditional(StoreIOBuffer &result);
128  void cacheHit(StoreIOBuffer result);
129  void handleIMSReply(StoreIOBuffer result);
130  void sendMoreData(StoreIOBuffer result);
132  void sendClientOldEntry();
133  void purgeAllCached();
134  void forgetHit();
135  bool blockedHit() const;
136 
137  void sendBodyTooLargeError();
139  void sendNotModified();
141 
143  /* ... for entry to be validated */
145  time_t old_lastmod;
147 
148  bool deleting;
149 
150  typedef enum {
151  crNone = 0,
155 
157 };
158 
159 #endif /* SQUID_CLIENTSIDEREPLY_H */
160 
Definition: parse.c:103
void removeClientStoreReference(store_client **scp, ClientHttpRequest *http)
StoreIOBuffer tempBuffer
ClientHttpRequest * http
struct clientReplyContext::Flags flags
void purgeFoundObject(StoreEntry *entry)
void traceReply(clientStreamNode *node)
void sendNotModifiedOrPreconditionFailedError()
void createStoreEntry(const HttpRequestMethod &m, RequestFlags flags)
virtual void fillChecklist(ACLFilledChecklist &) const
configure the ACL checklist with the current transaction state
void purgeFoundGet(StoreEntry *newEntry)
#define CBDATA_CLASS(type)
Definition: cbdata.h:302
char tempbuf[HTTP_REQBUF_SZ]
a temporary buffer if we need working storage
void sendStreamError(StoreIOBuffer const &result)
void removeStoreReference(store_client **scp, StoreEntry **ep)
StatusCode
Definition: StatusCode.h:20
void purgeDoPurgeGet(StoreEntry *entry)
Http::StatusCode purgeStatus
StoreIOBuffer holdingBuffer
CollapsedRevalidation collapsedRevalidation
void sendPreconditionFailedError()
send 412 (Precondition Failed) to client
void ACLCB(Acl::Answer, void *)
ACL checklist callback.
Definition: Checklist.h:19
A StoreEntry::getPublic*() caller.
Definition: StoreClient.h:24
we collapsed on the existing revalidation request
void startError(ErrorState *err)
bool errorInStream(StoreIOBuffer const &result, size_t const &sizeToProcess) const
void purgeDoPurgeHead(StoreEntry *entry)
void cacheHit(StoreIOBuffer result)
void sendMoreData(StoreIOBuffer result)
void pushStreamData(StoreIOBuffer const &result, char *source)
#define HTTP_REQBUF_SZ
Definition: defines.h:216
void setReplyToReply(HttpReply *reply)
creates a store entry for the reply and appends error reply to it
virtual LogTags * loggingTags()
void setReplyToStoreEntry(StoreEntry *e, const char *reason)
replaces current response store entry with the given one
void setReplyToError(err_type, Http::StatusCode, const HttpRequestMethod &, char const *, Ip::Address &, HttpRequest *, const char *, Auth::UserRequest::Pointer)
builds error using clientBuildError() and calls setReplyToError() below
void handleIMSReply(StoreIOBuffer result)
clientStream_status_t replyStatus()
err_type
Definition: err_type.h:12
clientReplyContext(ClientHttpRequest *)
int storeOKTransferDone() const
we initiated collapsed revalidation request
clientStreamNode * getNextNode() const
bool blockedHit() const
whether squid.conf send_hit prevents us from serving this hit
const char * termedBuf() const
Definition: SquidString.h:91
const char * storeId() const
int storeNotOKTransferDone() const
bool processConditional(StoreIOBuffer &result)
process conditional request from client
size_type size() const
Definition: SquidString.h:72
collapsed revalidation is not allowed for this context
size_t HttpReply *STUB StoreEntry const KeyScope scope const HttpRequestMethod & method
Definition: stub_store.cc:108
clientStream_status_t
Definition: enums.h:121
bool alwaysAllowResponse(Http::StatusCode sline) const
void purgeFoundHead(StoreEntry *newEntry)
store_client * old_sc
clientStreamNode * next() const
static ACLCB ProcessReplyAccessResult
void sendNotModified()
send 304 (Not Modified) to client
void processReplyAccessResult(const Acl::Answer &accessAllowed)
clientStreamNode * ourNode
static STCB SendMoreData
#define false
Definition: GnuRegex.c:233
unsigned complete
we have read all we can from upstream
const char * lookup_type
static STCB HandleIMSReply
virtual void created(StoreEntry *newEntry)
void identifyFoundObject(StoreEntry *entry)
void STCB(void *, StoreIOBuffer)
Definition: StoreClient.h:17

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors