]> git.ipfire.org Git - thirdparty/squid.git/blob - src/client_side_request.h
Fix make check with --disable-inline.
[thirdparty/squid.git] / src / client_side_request.h
1
2 /*
3 * $Id: client_side_request.h,v 1.25 2006/04/25 07:13:33 robertc Exp $
4 *
5 *
6 * SQUID Web Proxy Cache http://www.squid-cache.org/
7 * ----------------------------------------------------------
8 *
9 * Squid is the result of efforts by numerous individuals from
10 * the Internet community; see the CONTRIBUTORS file for full
11 * details. Many organizations have provided support for Squid's
12 * development; see the SPONSORS file for full details. Squid is
13 * Copyrighted (C) 2001 by the Regents of the University of
14 * California; see the COPYRIGHT file for full details. Squid
15 * incorporates software developed and/or copyrighted by other
16 * sources; see the CREDITS file for full details.
17 *
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
31 *
32 */
33
34
35 #ifndef SQUID_CLIENTSIDEREQUEST_H
36 #define SQUID_CLIENTSIDEREQUEST_H
37
38 #include "squid.h"
39 #include "HttpHeader.h"
40 #include "clientStream.h"
41 #include "client_side.h"
42 #include "AccessLogEntry.h"
43 #include "dlink.h"
44
45 #if ICAP_CLIENT
46 #include "ICAP/ICAPServiceRep.h"
47
48 class ICAPClientReqmodPrecache;
49
50 class HttpMsg;
51 #endif
52
53 /* client_side_request.c - client side request related routines (pure logic) */
54 extern int clientBeginRequest(method_t, char const *, CSCB *, CSD *, ClientStreamData, HttpHeader const *, char *, size_t);
55
56 class MemObject;
57
58 class ConnStateData;
59
60 class ClientRequestContext;
61
62 class ClientHttpRequest
63 {
64
65 public:
66 void *operator new (size_t);
67 void operator delete (void *);
68
69 ClientHttpRequest(ConnStateData::Pointer);
70 ~ClientHttpRequest();
71 /* Not implemented - present to prevent synthetic operations */
72 ClientHttpRequest(ClientHttpRequest const &);
73 ClientHttpRequest& operator=(ClientHttpRequest const &);
74
75 String rangeBoundaryStr() const;
76 void freeResources();
77 void updateCounters();
78 void logRequest();
79 _SQUID_INLINE_ MemObject * memObject() const;
80 bool multipartRangeRequest() const;
81 void processRequest();
82 void httpStart();
83 bool onlyIfCached()const;
84 bool gotEnough() const;
85 _SQUID_INLINE_ StoreEntry *storeEntry() const;
86 void storeEntry(StoreEntry *);
87 _SQUID_INLINE_ StoreEntry *loggingEntry() const;
88 void loggingEntry(StoreEntry *);
89
90 _SQUID_INLINE_ ConnStateData::Pointer getConn();
91 _SQUID_INLINE_ ConnStateData::Pointer const getConn() const;
92 _SQUID_INLINE_ void setConn(ConnStateData::Pointer);
93 HttpRequest *request; /* Parsed URL ... */
94 char *uri;
95 char *log_uri;
96
97 struct
98 {
99 off_t offset;
100 size_t size;
101 size_t headers_sz;
102 }
103
104 out;
105 HttpHdrRangeIter range_iter; /* data for iterating thru range specs */
106 size_t req_sz; /* raw request size on input, not current request size */
107 log_type logType;
108
109 struct timeval start;
110 AccessLogEntry al;
111
112 struct
113 {
114
115 unsigned int accel:
116 1;
117
118 unsigned int transparent:
119 1;
120
121 unsigned int internal:
122 1;
123
124 unsigned int done_copying:
125 1;
126
127 unsigned int purging:
128 1;
129 }
130
131 flags;
132
133 struct
134 {
135 http_status status;
136 char *location;
137 }
138
139 redirect;
140 dlink_node active;
141 dlink_list client_stream;
142 int mRangeCLen();
143
144 ssize_t maxReplyBodySize() const;
145 void maxReplyBodySize(ssize_t size);
146 bool isReplyBodyTooLarge(ssize_t len) const;
147
148 ClientRequestContext *calloutContext;
149 void doCallouts();
150
151 private:
152 CBDATA_CLASS(ClientHttpRequest);
153 ssize_t maxReplyBodySize_;
154 StoreEntry *entry_;
155 StoreEntry *loggingEntry_;
156 ConnStateData::Pointer conn_;
157
158 #if ICAP_CLIENT
159
160 public:
161 ICAPClientReqmodPrecache *icap;
162 int doIcap(ICAPServiceRep::Pointer);
163 void icapSpaceAvailable();
164 void takeAdaptedHeaders(HttpMsg *);
165 void takeAdaptedBody(MemBuf *);
166 void doneAdapting();
167 void abortAdapting();
168 bool request_satisfaction_mode;
169 off_t request_satisfaction_offset;
170 #endif
171 };
172
173 /* client http based routines */
174 SQUIDCEXTERN char *clientConstructTraceEcho(ClientHttpRequest *);
175 SQUIDCEXTERN ACLChecklist *clientAclChecklistCreate(const acl_access * acl,ClientHttpRequest * http);
176 SQUIDCEXTERN int clientHttpRequestStatus(int fd, ClientHttpRequest const *http);
177 SQUIDCEXTERN void clientAccessCheck(ClientHttpRequest *);
178
179 /* ones that should be elsewhere */
180 SQUIDCEXTERN void redirectStart(ClientHttpRequest *, RH *, void *);
181
182 SQUIDCEXTERN void sslStart(ClientHttpRequest *, size_t *, int *);
183
184 #ifdef _USE_INLINE_
185 #include "Store.h"
186 #include "client_side_request.cci"
187 #endif
188
189 #endif /* SQUID_CLIENTSIDEREQUEST_H */