]>
Commit | Line | Data |
---|---|---|
c8be6d7b | 1 | |
2 | /* | |
a0355e95 | 3 | * $Id: client_side_request.h,v 1.23 2006/02/17 20:59:31 wessels Exp $ |
c8be6d7b | 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 | #ifndef SQUID_CLIENTSIDEREQUEST_H | |
35 | #define SQUID_CLIENTSIDEREQUEST_H | |
36 | ||
528b2c61 | 37 | #include "HttpHeader.h" |
38 | #include "clientStream.h" | |
a2ac85d9 | 39 | #include "client_side.h" |
450e0c10 | 40 | #include "AccessLogEntry.h" |
528b2c61 | 41 | |
de31d06f | 42 | #if ICAP_CLIENT |
43 | #include "ICAP/ICAPServiceRep.h" | |
44 | ||
45 | class ICAPClientReqmodPrecache; | |
46 | ||
47 | class HttpMsg; | |
48 | #endif | |
49 | ||
c8be6d7b | 50 | /* client_side_request.c - client side request related routines (pure logic) */ |
0655fa4d | 51 | extern int clientBeginRequest(method_t, char const *, CSCB *, CSD *, ClientStreamData, HttpHeader const *, char *, size_t); |
c8be6d7b | 52 | |
90f396d5 | 53 | class MemObject; |
62e76326 | 54 | |
924f73bc | 55 | class ConnStateData; |
56 | ||
de31d06f | 57 | class ClientRequestContext; |
58 | ||
62e76326 | 59 | class ClientHttpRequest |
60 | { | |
61 | ||
528b2c61 | 62 | public: |
63 | void *operator new (size_t); | |
64 | void operator delete (void *); | |
528b2c61 | 65 | |
a0355e95 | 66 | ClientHttpRequest(ConnStateData::Pointer); |
528b2c61 | 67 | ~ClientHttpRequest(); |
68 | /* Not implemented - present to prevent synthetic operations */ | |
69 | ClientHttpRequest(ClientHttpRequest const &); | |
70 | ClientHttpRequest& operator=(ClientHttpRequest const &); | |
62e76326 | 71 | |
528b2c61 | 72 | String rangeBoundaryStr() const; |
73 | void freeResources(); | |
74 | void updateCounters(); | |
75 | void logRequest(); | |
86a2f789 | 76 | _SQUID_INLINE_ MemObject * memObject() const; |
528b2c61 | 77 | bool multipartRangeRequest() const; |
8e2745f4 | 78 | void processRequest(); |
79 | void httpStart(); | |
0655fa4d | 80 | bool onlyIfCached()const; |
81 | bool gotEnough() const; | |
86a2f789 | 82 | _SQUID_INLINE_ StoreEntry *storeEntry() const; |
83 | void storeEntry(StoreEntry *); | |
0976f8db | 84 | _SQUID_INLINE_ StoreEntry *loggingEntry() const; |
85 | void loggingEntry(StoreEntry *); | |
0655fa4d | 86 | |
a2ac85d9 | 87 | _SQUID_INLINE_ ConnStateData::Pointer getConn(); |
88 | _SQUID_INLINE_ ConnStateData::Pointer const getConn() const; | |
89 | _SQUID_INLINE_ void setConn(ConnStateData::Pointer); | |
190154cf | 90 | HttpRequest *request; /* Parsed URL ... */ |
528b2c61 | 91 | char *uri; |
92 | char *log_uri; | |
62e76326 | 93 | |
94 | struct | |
95 | { | |
96 | off_t offset; | |
97 | size_t size; | |
98 | size_t headers_sz; | |
99 | } | |
100 | ||
101 | out; | |
528b2c61 | 102 | HttpHdrRangeIter range_iter; /* data for iterating thru range specs */ |
103 | size_t req_sz; /* raw request size on input, not current request size */ | |
528b2c61 | 104 | log_type logType; |
62e76326 | 105 | |
528b2c61 | 106 | struct timeval start; |
528b2c61 | 107 | AccessLogEntry al; |
62e76326 | 108 | |
109 | struct | |
110 | { | |
111 | ||
112 | unsigned int accel: | |
113 | 1; | |
114 | ||
d048c262 | 115 | unsigned int transparent: |
116 | 1; | |
117 | ||
62e76326 | 118 | unsigned int internal: |
119 | 1; | |
120 | ||
121 | unsigned int done_copying: | |
122 | 1; | |
123 | ||
124 | unsigned int purging: | |
125 | 1; | |
126 | } | |
127 | ||
128 | flags; | |
129 | ||
130 | struct | |
131 | { | |
132 | http_status status; | |
133 | char *location; | |
134 | } | |
135 | ||
136 | redirect; | |
528b2c61 | 137 | dlink_node active; |
138 | dlink_list client_stream; | |
139 | int mRangeCLen(); | |
62e76326 | 140 | |
b51aec66 | 141 | ssize_t maxReplyBodySize() const; |
142 | void maxReplyBodySize(ssize_t size); | |
143 | bool isReplyBodyTooLarge(ssize_t len) const; | |
144 | ||
de31d06f | 145 | ClientRequestContext *calloutContext; |
146 | void doCallouts(); | |
147 | ||
528b2c61 | 148 | private: |
149 | CBDATA_CLASS(ClientHttpRequest); | |
86a2f789 | 150 | ssize_t maxReplyBodySize_; |
151 | StoreEntry *entry_; | |
0976f8db | 152 | StoreEntry *loggingEntry_; |
a2ac85d9 | 153 | ConnStateData::Pointer conn_; |
de31d06f | 154 | |
155 | #if ICAP_CLIENT | |
156 | ||
157 | public: | |
158 | ICAPClientReqmodPrecache *icap; | |
159 | int doIcap(ICAPServiceRep::Pointer); | |
160 | void icapSpaceAvailable(); | |
161 | void takeAdaptedHeaders(HttpMsg *); | |
162 | void takeAdaptedBody(MemBuf *); | |
163 | void doneAdapting(); | |
164 | void abortAdapting(); | |
165 | #endif | |
528b2c61 | 166 | }; |
167 | ||
168 | /* client http based routines */ | |
59a1efb2 | 169 | SQUIDCEXTERN char *clientConstructTraceEcho(ClientHttpRequest *); |
98242069 | 170 | SQUIDCEXTERN ACLChecklist *clientAclChecklistCreate(const acl_access * acl,ClientHttpRequest * http); |
59a1efb2 | 171 | SQUIDCEXTERN int clientHttpRequestStatus(int fd, ClientHttpRequest const *http); |
8e2745f4 | 172 | SQUIDCEXTERN void clientAccessCheck(ClientHttpRequest *); |
528b2c61 | 173 | |
174 | /* ones that should be elsewhere */ | |
59a1efb2 | 175 | SQUIDCEXTERN void redirectStart(ClientHttpRequest *, RH *, void *); |
528b2c61 | 176 | |
59a1efb2 | 177 | SQUIDCEXTERN void sslStart(ClientHttpRequest *, size_t *, int *); |
528b2c61 | 178 | |
86a2f789 | 179 | #ifdef _USE_INLINE_ |
4b9bb50a | 180 | #include "Store.h" |
86a2f789 | 181 | #include "client_side_request.cci" |
182 | #endif | |
183 | ||
c8be6d7b | 184 | #endif /* SQUID_CLIENTSIDEREQUEST_H */ |