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 doGetMoreData();
39  void identifyStoreObject();
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, const HttpRequestMethod&, char const *, const ConnStateData *, HttpRequest *, const char *,
47 #if USE_AUTH
49 #else
50  void * unused);
51 #endif
57  void removeStoreReference(store_client ** scp, StoreEntry ** ep);
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  virtual LogTags *loggingTags() const;
70 
76  store_client *sc; /* The store_client we're using */
77  StoreIOBuffer tempBuffer; /* For use in validating requests via IMS */
78  int old_reqsize; /* ... again, for the buffer */
79  size_t reqsize;
80  size_t reqofs;
82 
83  struct Flags {
85 
86  unsigned storelogiccomplete:1;
87  unsigned complete:1;
89  } flags;
90  clientStreamNode *ourNode; /* This will go away if/when this file gets refactored some more */
91 
92 private:
93  /* StoreClient API */
94  virtual void fillChecklist(ACLFilledChecklist &) const;
95 
97  void makeThisHead();
98  bool errorInStream(StoreIOBuffer const &result, size_t const &sizeToProcess)const ;
99  void sendStreamError(StoreIOBuffer const &result);
100  void pushStreamData(StoreIOBuffer const &result, char *source);
101  clientStreamNode * next() const;
104  void processReplyAccess();
106  void processReplyAccessResult(const Acl::Answer &accessAllowed);
107  void cloneReply();
108  void buildReplyHeader ();
109  bool alwaysAllowResponse(Http::StatusCode sline) const;
110  int checkTransferDone();
112  bool processConditional(StoreIOBuffer &result);
113  void cacheHit(StoreIOBuffer result);
114  void handleIMSReply(StoreIOBuffer result);
115  void sendMoreData(StoreIOBuffer result);
117  void sendClientOldEntry();
118  void purgeAllCached();
121  bool purgeEntry(StoreEntry &, const Http::MethodType, const char *descriptionPrefix = "");
123  void purgeDoPurge();
124  void forgetHit();
125  bool blockedHit() const;
126  const char *storeLookupString(bool found) const { return found ? "match" : "mismatch"; }
127  void detailStoreLookup(const char *detail);
128 
129  void sendBodyTooLargeError();
131  void sendNotModified();
133 
137  const char *firstStoreLookup_ = nullptr;
138 
140  /* ... for entry to be validated */
142  time_t old_lastmod;
144 
145  bool deleting;
146 
147  typedef enum {
148  crNone = 0,
150  crSlave
152 
154 };
155 
156 #endif /* SQUID_CLIENTSIDEREPLY_H */
157 
Definition: parse.c:104
void removeClientStoreReference(store_client **scp, ClientHttpRequest *http)
StoreIOBuffer tempBuffer
ClientHttpRequest * http
void traceReply(clientStreamNode *node)
void purgeDoPurge()
releases both cached GET and HEAD entries
void sendNotModifiedOrPreconditionFailedError()
void createStoreEntry(const HttpRequestMethod &m, RequestFlags flags)
virtual void fillChecklist(ACLFilledChecklist &) const
configure the ACL checklist with the current transaction state
#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)
void setReplyToError(err_type, Http::StatusCode, const HttpRequestMethod &, char const *, const ConnStateData *, HttpRequest *, const char *, Auth::UserRequest::Pointer)
builds error using clientBuildError() and calls setReplyToError() below
StatusCode
Definition: StatusCode.h:20
err_type
Definition: forward.h:14
Http::StatusCode purgeStatus
StoreIOBuffer holdingBuffer
CollapsedRevalidation collapsedRevalidation
void sendPreconditionFailedError()
send 412 (Precondition Failed) to client
void identifyFoundObject(StoreEntry *entry, const char *detail)
void ACLCB(Acl::Answer, void *)
ACL checklist callback.
Definition: Checklist.h:19
a storeGetPublic*() caller
Definition: StoreClient.h:25
@ crSlave
we collapsed on the existing revalidation request
void startError(ErrorState *err)
bool errorInStream(StoreIOBuffer const &result, size_t const &sizeToProcess) const
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
void setReplyToStoreEntry(StoreEntry *e, const char *reason)
replaces current response store entry with the given one
void detailStoreLookup(const char *detail)
remembers the very first Store lookup classification, ignoring the rest
void handleIMSReply(StoreIOBuffer result)
clientStream_status_t replyStatus()
struct clientReplyContext::Flags flags
char const * termedBuf() const
Definition: SquidString.h:91
clientReplyContext(ClientHttpRequest *)
int storeOKTransferDone() const
@ crInitiator
we initiated collapsed revalidation request
clientStreamNode * getNextNode() const
enum Http::_method_t MethodType
bool blockedHit() const
whether squid.conf send_hit prevents us from serving this hit
const char * storeId() const
virtual LogTags * loggingTags() const
int storeNotOKTransferDone() const
bool processConditional(StoreIOBuffer &result)
process conditional request from client
size_type size() const
Definition: SquidString.h:72
@ crNone
collapsed revalidation is not allowed for this context
size_t HttpReply *STUB StoreEntry const KeyScope scope const HttpRequestMethod & method
Definition: stub_store.cc:105
clientStream_status_t
Definition: enums.h:125
bool alwaysAllowResponse(Http::StatusCode sline) const
const char * storeLookupString(bool found) const
bool purgeEntry(StoreEntry &, const Http::MethodType, const char *descriptionPrefix="")
const char * firstStoreLookup_
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
static STCB HandleIMSReply
void STCB(void *, StoreIOBuffer)
Definition: StoreClient.h:17

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors