]> git.ipfire.org Git - thirdparty/squid.git/blob - src/client_side_request.h
Summary: Class cleanup - resulting from addressing a latent segfault.
[thirdparty/squid.git] / src / client_side_request.h
1
2 /*
3 * $Id: client_side_request.h,v 1.19 2003/09/01 03:49:38 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 #ifndef SQUID_CLIENTSIDEREQUEST_H
35 #define SQUID_CLIENTSIDEREQUEST_H
36
37 #include "HttpHeader.h"
38 #include "clientStream.h"
39 #include "client_side.h"
40 #include "AccessLogEntry.h"
41
42 /* client_side_request.c - client side request related routines (pure logic) */
43 extern int clientBeginRequest(method_t, char const *, CSCB *, CSD *, ClientStreamData, HttpHeader const *, char *, size_t);
44
45 class MemObject;
46
47 typedef class ClientHttpRequest clientHttpRequest;
48
49 class ConnStateData;
50
51 class ClientHttpRequest
52 {
53
54 public:
55 void *operator new (size_t);
56 void operator delete (void *);
57
58 ClientHttpRequest();
59 ~ClientHttpRequest();
60 /* Not implemented - present to prevent synthetic operations */
61 ClientHttpRequest(ClientHttpRequest const &);
62 ClientHttpRequest& operator=(ClientHttpRequest const &);
63
64 String rangeBoundaryStr() const;
65 void freeResources();
66 void updateCounters();
67 void logRequest();
68 _SQUID_INLINE_ MemObject * memObject() const;
69 bool multipartRangeRequest() const;
70 void processRequest();
71 void httpStart();
72 bool onlyIfCached()const;
73 bool gotEnough() const;
74 _SQUID_INLINE_ StoreEntry *storeEntry() const;
75 void storeEntry(StoreEntry *);
76 _SQUID_INLINE_ StoreEntry *loggingEntry() const;
77 void loggingEntry(StoreEntry *);
78
79 _SQUID_INLINE_ ConnStateData::Pointer getConn();
80 _SQUID_INLINE_ ConnStateData::Pointer const getConn() const;
81 _SQUID_INLINE_ void setConn(ConnStateData::Pointer);
82 HttpRequest *request; /* Parsed URL ... */
83 char *uri;
84 char *log_uri;
85
86 struct
87 {
88 off_t offset;
89 size_t size;
90 size_t headers_sz;
91 }
92
93 out;
94 HttpHdrRangeIter range_iter; /* data for iterating thru range specs */
95 size_t req_sz; /* raw request size on input, not current request size */
96 log_type logType;
97
98 struct timeval start;
99 HttpVersion http_ver;
100 AccessLogEntry al;
101
102 struct
103 {
104
105 unsigned int accel:
106 1;
107
108 unsigned int transparent:
109 1;
110
111 unsigned int internal:
112 1;
113
114 unsigned int done_copying:
115 1;
116
117 unsigned int purging:
118 1;
119 }
120
121 flags;
122
123 struct
124 {
125 http_status status;
126 char *location;
127 }
128
129 redirect;
130 dlink_node active;
131 dlink_list client_stream;
132 int mRangeCLen();
133
134 ssize_t maxReplyBodySize() const;
135 void maxReplyBodySize(ssize_t size);
136 bool isReplyBodyTooLarge(ssize_t len) const;
137
138 private:
139 CBDATA_CLASS(ClientHttpRequest);
140 ssize_t maxReplyBodySize_;
141 StoreEntry *entry_;
142 StoreEntry *loggingEntry_;
143 ConnStateData::Pointer conn_;
144 };
145
146 /* client http based routines */
147 SQUIDCEXTERN char *clientConstructTraceEcho(clientHttpRequest *);
148 SQUIDCEXTERN ACLChecklist *clientAclChecklistCreate(const acl_access * acl,ClientHttpRequest * http);
149 SQUIDCEXTERN int clientHttpRequestStatus(int fd, clientHttpRequest const *http);
150 SQUIDCEXTERN void clientAccessCheck(ClientHttpRequest *);
151
152 /* ones that should be elsewhere */
153 SQUIDCEXTERN void redirectStart(clientHttpRequest *, RH *, void *);
154
155 SQUIDCEXTERN void sslStart(clientHttpRequest *, size_t *, int *);
156
157 #ifdef _USE_INLINE_
158 #include "Store.h"
159 #include "client_side_request.cci"
160 #endif
161
162 #endif /* SQUID_CLIENTSIDEREQUEST_H */