]> git.ipfire.org Git - thirdparty/squid.git/blob - src/client_side_reply.h
Bump-server-first fails with SQUID_X509_V_ERR_DOMAIN_MISMATCH error
[thirdparty/squid.git] / src / client_side_reply.h
1 /*
2 * SQUID Web Proxy Cache http://www.squid-cache.org/
3 * ----------------------------------------------------------
4 *
5 * Squid is the result of efforts by numerous individuals from
6 * the Internet community; see the CONTRIBUTORS file for full
7 * details. Many organizations have provided support for Squid's
8 * development; see the SPONSORS file for full details. Squid is
9 * Copyrighted (C) 2001 by the Regents of the University of
10 * California; see the COPYRIGHT file for full details. Squid
11 * incorporates software developed and/or copyrighted by other
12 * sources; see the CREDITS file for full details.
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
27 *
28 * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
29 */
30
31 #ifndef SQUID_CLIENTSIDEREPLY_H
32 #define SQUID_CLIENTSIDEREPLY_H
33
34 #include "RefCount.h"
35 #include "HttpHeader.h"
36 #include "clientStream.h"
37 #include "StoreClient.h"
38 #include "client_side_request.h"
39
40 class ErrorState;
41 #include "ip/forward.h"
42
43 /* XXX make static method */
44
45 class clientReplyContext : public RefCountable, public StoreClient
46 {
47
48 public:
49 void *operator new (size_t byteCount);
50 void operator delete (void *address);
51 static STCB CacheHit;
52 static STCB HandleIMSReply;
53 static STCB SendMoreData;
54
55 clientReplyContext(ClientHttpRequest *);
56 ~clientReplyContext();
57
58 void saveState();
59 void restoreState();
60 void purgeRequest ();
61 void purgeRequestFindObjectToPurge();
62 void purgeDoMissPurge();
63 void purgeFoundGet(StoreEntry *newEntry);
64 void purgeFoundHead(StoreEntry *newEntry);
65 void purgeFoundObject(StoreEntry *entry);
66 void sendClientUpstreamResponse();
67 void purgeDoPurgeGet(StoreEntry *entry);
68 void purgeDoPurgeHead(StoreEntry *entry);
69 void doGetMoreData();
70 void identifyStoreObject();
71 void identifyFoundObject(StoreEntry *entry);
72 int storeOKTransferDone() const;
73 int storeNotOKTransferDone() const;
74 /// Replaces the store entry with the given and awaiting the client side to read it
75 void setReplyToStoreEntry(StoreEntry *entry);
76 void setReplyToError(err_type, http_status, const HttpRequestMethod&, char const *, Ip::Address &, HttpRequest *, const char *,
77 #if USE_AUTH
78 AuthUserRequest::Pointer);
79 #else
80 void * unused);
81 #endif
82 void setReplyToError(const HttpRequestMethod& method, ErrorState *errstate);
83 void createStoreEntry(const HttpRequestMethod& m, request_flags flags);
84 void removeStoreReference(store_client ** scp, StoreEntry ** ep);
85 void removeClientStoreReference(store_client **scp, ClientHttpRequest *http);
86 void startError(ErrorState * err);
87 void processExpired();
88 clientStream_status_t replyStatus();
89 void processMiss();
90 void traceReply(clientStreamNode * node);
91
92 http_status purgeStatus;
93
94 /* state variable - replace with class to handle storeentries at some point */
95 int lookingforstore;
96 virtual void created (StoreEntry *newEntry);
97
98 ClientHttpRequest *http;
99 int headers_sz;
100 store_client *sc; /* The store_client we're using */
101 StoreIOBuffer tempBuffer; /* For use in validating requests via IMS */
102 int old_reqsize; /* ... again, for the buffer */
103 size_t reqsize;
104 size_t reqofs;
105 char tempbuf[HTTP_REQBUF_SZ]; /* a temporary buffer if we need working storage */
106 #if USE_CACHE_DIGESTS
107
108 const char *lookup_type; /* temporary hack: storeGet() result: HIT/MISS/NONE */
109 #endif
110
111 struct {
112
113 unsigned storelogiccomplete:1;
114
115 unsigned complete:1; /* we have read all we can from upstream */
116 bool headersSent;
117 } flags;
118 clientStreamNode *ourNode; /* This will go away if/when this file gets refactored some more */
119
120 private:
121 CBDATA_CLASS(clientReplyContext);
122 clientStreamNode *getNextNode() const;
123 void makeThisHead();
124 bool errorInStream(StoreIOBuffer const &result, size_t const &sizeToProcess)const ;
125 void sendStreamError(StoreIOBuffer const &result);
126 void pushStreamData(StoreIOBuffer const &result, char *source);
127 clientStreamNode * next() const;
128 StoreIOBuffer holdingBuffer;
129 HttpReply *reply;
130 void processReplyAccess();
131 static ACLCB ProcessReplyAccessResult;
132 void processReplyAccessResult(const allow_t &accessAllowed);
133 void cloneReply();
134 void buildReplyHeader ();
135 bool alwaysAllowResponse(http_status sline) const;
136 int checkTransferDone();
137 void processOnlyIfCachedMiss();
138 void processConditional(StoreIOBuffer &result);
139 void cacheHit(StoreIOBuffer result);
140 void handleIMSReply(StoreIOBuffer result);
141 void sendMoreData(StoreIOBuffer result);
142 void triggerInitialStoreRead();
143 void sendClientOldEntry();
144 void purgeAllCached();
145
146 void sendBodyTooLargeError();
147 void sendPreconditionFailedError();
148 void sendNotModified();
149 void sendNotModifiedOrPreconditionFailedError();
150
151 StoreEntry *old_entry;
152 store_client *old_sc; /* ... for entry to be validated */
153 bool deleting;
154 };
155
156 #endif /* SQUID_CLIENTSIDEREPLY_H */