client_side_reply.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2019 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 
84  store_client *sc; /* The store_client we're using */
85  StoreIOBuffer tempBuffer; /* For use in validating requests via IMS */
86  int old_reqsize; /* ... again, for the buffer */
87  size_t reqsize;
88  size_t reqofs;
90 #if USE_CACHE_DIGESTS
91 
92  const char *lookup_type; /* temporary hack: storeGet() result: HIT/MISS/NONE */
93 #endif
94 
95  struct Flags {
97 
98  unsigned storelogiccomplete:1;
99  unsigned complete:1;
101  } flags;
102  clientStreamNode *ourNode; /* This will go away if/when this file gets refactored some more */
103 
104 private:
105  /* StoreClient API */
106  virtual void fillChecklist(ACLFilledChecklist &) const;
107 
108  clientStreamNode *getNextNode() const;
109  void makeThisHead();
110  bool errorInStream(StoreIOBuffer const &result, size_t const &sizeToProcess)const ;
111  void sendStreamError(StoreIOBuffer const &result);
112  void pushStreamData(StoreIOBuffer const &result, char *source);
113  clientStreamNode * next() const;
116  void processReplyAccess();
118  void processReplyAccessResult(const Acl::Answer &accessAllowed);
119  void cloneReply();
120  void buildReplyHeader ();
121  bool alwaysAllowResponse(Http::StatusCode sline) const;
122  int checkTransferDone();
124  bool processConditional(StoreIOBuffer &result);
125  void cacheHit(StoreIOBuffer result);
126  void handleIMSReply(StoreIOBuffer result);
127  void sendMoreData(StoreIOBuffer result);
129  void sendClientOldEntry();
130  void purgeAllCached();
131  void forgetHit();
132  bool blockedHit() const;
133 
134  void sendBodyTooLargeError();
136  void sendNotModified();
138 
140  /* ... for entry to be validated */
142  time_t old_lastmod;
144 
145  bool deleting;
146 
147  typedef enum {
148  crNone = 0,
152 
153  CollapsedRevalidation collapsedRevalidation;
154 };
155 
156 #endif /* SQUID_CLIENTSIDEREPLY_H */
157 
#define HTTP_REQBUF_SZ
Definition: defines.h:216
store_client * old_sc
static ACLCB ProcessReplyAccessResult
void sendMoreData(StoreIOBuffer result)
void cacheHit(StoreIOBuffer result)
void processReplyAccessResult(const Acl::Answer &accessAllowed)
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
bool processConditional(StoreIOBuffer &result)
process conditional request from client
static STCB SendMoreData
void pushStreamData(StoreIOBuffer const &result, char *source)
void ACLCB(Acl::Answer, void *)
ACL checklist callback.
Definition: Checklist.h:19
int storeNotOKTransferDone() const
bool errorInStream(StoreIOBuffer const &result, size_t const &sizeToProcess) const
void purgeFoundHead(StoreEntry *newEntry)
virtual void created(StoreEntry *newEntry)
virtual LogTags * loggingTags()
we initiated collapsed revalidation request
void purgeDoPurgeHead(StoreEntry *entry)
struct clientReplyContext::Flags flags
clientStreamNode * getNextNode() const
clientStreamNode * next() const
void setReplyToReply(HttpReply *reply)
creates a store entry for the reply and appends error reply to it
void sendNotModified()
send 304 (Not Modified) to client
void setReplyToStoreEntry(StoreEntry *e, const char *reason)
replaces current response store entry with the given one
clientStream_status_t replyStatus()
we collapsed on the existing revalidation request
void purgeFoundObject(StoreEntry *entry)
clientReplyContext(ClientHttpRequest *)
char tempbuf[HTTP_REQBUF_SZ]
a temporary buffer if we need working storage
void purgeFoundGet(StoreEntry *newEntry)
Definition: parse.c:104
StatusCode
Definition: StatusCode.h:20
void sendStreamError(StoreIOBuffer const &result)
#define CBDATA_CLASS(type)
Definition: cbdata.h:302
virtual void fillChecklist(ACLFilledChecklist &) const
configure the ACL checklist with the current transaction state
Http::StatusCode purgeStatus
const char * lookup_type
bool blockedHit() const
whether squid.conf send_hit prevents us from serving this hit
void sendNotModifiedOrPreconditionFailedError()
StoreIOBuffer holdingBuffer
bool alwaysAllowResponse(Http::StatusCode sline) const
void identifyFoundObject(StoreEntry *entry)
clientStream_status_t
Definition: enums.h:121
char const * termedBuf() const
Definition: SquidString.h:91
void startError(ErrorState *err)
unsigned complete
we have read all we can from upstream
void removeStoreReference(store_client **scp, StoreEntry **ep)
StoreIOBuffer tempBuffer
void handleIMSReply(StoreIOBuffer result)
clientStreamNode * ourNode
static STCB HandleIMSReply
CollapsedRevalidation collapsedRevalidation
void traceReply(clientStreamNode *node)
int storeOKTransferDone() const
void createStoreEntry(const HttpRequestMethod &m, RequestFlags flags)
void STCB(void *, StoreIOBuffer)
Definition: StoreClient.h:16
size_t HttpReply *STUB StoreEntry const KeyScope scope const HttpRequestMethod & method
Definition: stub_store.cc:112
void removeClientStoreReference(store_client **scp, ClientHttpRequest *http)
ClientHttpRequest * http
void purgeDoPurgeGet(StoreEntry *entry)
size_type size() const
Definition: SquidString.h:72
void sendPreconditionFailedError()
send 412 (Precondition Failed) to client
A StoreEntry::getPublic*() caller.
Definition: StoreClient.h:23
#define false
Definition: GnuRegex.c:233
const char * storeId() const
err_type
Definition: err_type.h:12
collapsed revalidation is not allowed for this context

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors