3 * $Id: client_side_request.h,v 1.32 2007/08/13 17:20:51 hno Exp $
6 * SQUID Web Proxy Cache http://www.squid-cache.org/
7 * ----------------------------------------------------------
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.
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.
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.
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.
35 #ifndef SQUID_CLIENTSIDEREQUEST_H
36 #define SQUID_CLIENTSIDEREQUEST_H
39 #include "HttpHeader.h"
40 #include "clientStream.h"
41 #include "client_side.h"
42 #include "AccessLogEntry.h"
46 #include "ICAP/ICAPServiceRep.h"
47 #include "ICAP/ICAPInitiator.h"
52 /* client_side_request.c - client side request related routines (pure logic) */
53 extern int clientBeginRequest(method_t
, char const *, CSCB
*, CSD
*, ClientStreamData
, HttpHeader
const *, char *, size_t);
59 class ClientRequestContext
;
61 class ClientHttpRequest
63 : public ICAPInitiator
, // to start ICAP transactions
64 public BodyConsumer
// to receive reply bodies in request satisf. mode
69 void *operator new (size_t);
70 void operator delete (void *);
72 ClientHttpRequest(ConnStateData::Pointer
);
74 /* Not implemented - present to prevent synthetic operations */
75 ClientHttpRequest(ClientHttpRequest
const &);
76 ClientHttpRequest
& operator=(ClientHttpRequest
const &);
78 String
rangeBoundaryStr() const;
80 void updateCounters();
82 _SQUID_INLINE_ MemObject
* memObject() const;
83 bool multipartRangeRequest() const;
84 void processRequest();
86 bool onlyIfCached()const;
87 bool gotEnough() const;
88 _SQUID_INLINE_ StoreEntry
*storeEntry() const;
89 void storeEntry(StoreEntry
*);
90 _SQUID_INLINE_ StoreEntry
*loggingEntry() const;
91 void loggingEntry(StoreEntry
*);
93 _SQUID_INLINE_
ConnStateData::Pointer
getConn();
94 _SQUID_INLINE_
ConnStateData::Pointer
const getConn() const;
95 _SQUID_INLINE_
void setConn(ConnStateData::Pointer
);
96 HttpRequest
*request
; /* Parsed URL ... */
108 HttpHdrRangeIter range_iter
; /* data for iterating thru range specs */
109 size_t req_sz
; /* raw request size on input, not current request size */
112 struct timeval start
;
121 unsigned int transparent
:
124 unsigned int internal
:
127 unsigned int done_copying
:
130 unsigned int purging
:
144 dlink_list client_stream
;
147 int64_t maxReplyBodySize() const;
148 void maxReplyBodySize(int64_t size
);
149 bool isReplyBodyTooLarge(int64_t len
) const;
151 ClientRequestContext
*calloutContext
;
155 CBDATA_CLASS(ClientHttpRequest
);
156 int64_t maxReplyBodySize_
;
158 StoreEntry
*loggingEntry_
;
159 ConnStateData::Pointer conn_
;
164 bool startIcap(ICAPServiceRep::Pointer
);
166 // private but exposed for ClientRequestContext
167 void handleIcapFailure(bool bypassable
= false);
170 // ICAPInitiator API, called by ICAPXaction
171 virtual void noteIcapAnswer(HttpMsg
*message
);
172 virtual void noteIcapQueryAbort(bool final
);
174 // BodyConsumer API, called by BodyPipe
175 virtual void noteMoreBodyDataAvailable(BodyPipe
&);
176 virtual void noteBodyProductionEnded(BodyPipe
&);
177 virtual void noteBodyProducerAborted(BodyPipe
&);
179 void endRequestSatisfaction();
182 ICAPInitiate
*icapHeadSource
;
183 BodyPipe::Pointer icapBodySource
;
185 bool request_satisfaction_mode
;
186 off_t request_satisfaction_offset
;
190 /* client http based routines */
191 SQUIDCEXTERN
char *clientConstructTraceEcho(ClientHttpRequest
*);
192 SQUIDCEXTERN ACLChecklist
*clientAclChecklistCreate(const acl_access
* acl
,ClientHttpRequest
* http
);
193 SQUIDCEXTERN
int clientHttpRequestStatus(int fd
, ClientHttpRequest
const *http
);
194 SQUIDCEXTERN
void clientAccessCheck(ClientHttpRequest
*);
196 /* ones that should be elsewhere */
197 SQUIDCEXTERN
void redirectStart(ClientHttpRequest
*, RH
*, void *);
199 SQUIDCEXTERN
void tunnelStart(ClientHttpRequest
*, int64_t *, int *);
203 #include "client_side_request.cci"
206 #endif /* SQUID_CLIENTSIDEREQUEST_H */