]>
Commit | Line | Data |
---|---|---|
528b2c61 | 1 | |
2 | /* | |
5f8252d2 | 3 | * $Id: HttpRequest.h,v 1.25 2007/04/06 04:50:04 rousskov Exp $ |
528b2c61 | 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_HTTPREQUEST_H | |
35 | #define SQUID_HTTPREQUEST_H | |
36 | ||
8596962e | 37 | #include "HttpMsg.h" |
a2ac85d9 | 38 | #include "client_side.h" |
b24880fe | 39 | #include "HierarchyLogEntry.h" |
985c86bc | 40 | #include "HttpRequestMethod.h" |
a2ac85d9 | 41 | |
924f73bc | 42 | /* Http Request */ |
924f73bc | 43 | extern int httpRequestHdrAllowed(const HttpHeaderEntry * e, String * strConnection); |
44 | extern int httpRequestHdrAllowedByName(http_hdr_type id); | |
5cafad19 | 45 | extern void httpRequestPack(void *obj, Packer *p); |
46 | ||
924f73bc | 47 | |
48 | class HttpHdrRange; | |
49 | ||
8596962e | 50 | class HttpRequest: public HttpMsg |
a2ac85d9 | 51 | { |
52 | ||
53 | public: | |
b001e822 | 54 | MEMPROXY_CLASS(HttpRequest); |
75faaa7a | 55 | HttpRequest(); |
5cafad19 | 56 | HttpRequest(method_t aMethod, protocol_t aProtocol, const char *aUrlpath); |
57 | ~HttpRequest(); | |
8596962e | 58 | virtual void reset(); |
4a56ee8d | 59 | |
6dd9f4bd | 60 | // use HTTPMSGLOCK() instead of calling this directly |
61 | virtual HttpRequest *_lock() | |
4a56ee8d | 62 | { |
6dd9f4bd | 63 | return static_cast<HttpRequest*>(HttpMsg::_lock()); |
4a56ee8d | 64 | }; |
65 | ||
0e8aad88 | 66 | void initHTTP(method_t aMethod, protocol_t aProtocol, const char *aUrlpath); |
75faaa7a | 67 | |
610ee341 | 68 | /* are responses to this request potentially cachable */ |
69 | bool cacheable() const; | |
70 | ||
5cafad19 | 71 | protected: |
5cafad19 | 72 | void clean(); |
5cafad19 | 73 | |
4a56ee8d | 74 | void init(); |
a2ac85d9 | 75 | |
5cafad19 | 76 | public: |
a2ac85d9 | 77 | method_t method; |
4a56ee8d | 78 | |
a2ac85d9 | 79 | char login[MAX_LOGIN_SZ]; |
4a56ee8d | 80 | |
a2ac85d9 | 81 | char host[SQUIDHOSTNAMELEN + 1]; |
4a56ee8d | 82 | |
a2ac85d9 | 83 | auth_user_request_t *auth_user_request; |
4a56ee8d | 84 | |
a2ac85d9 | 85 | u_short port; |
4a56ee8d | 86 | |
a2ac85d9 | 87 | String urlpath; |
4a56ee8d | 88 | |
a2ac85d9 | 89 | char *canonical; |
4a56ee8d | 90 | |
a2ac85d9 | 91 | request_flags flags; |
4a56ee8d | 92 | |
a2ac85d9 | 93 | HttpHdrRange *range; |
4a56ee8d | 94 | |
a2ac85d9 | 95 | time_t ims; |
4a56ee8d | 96 | |
a2ac85d9 | 97 | int imslen; |
4a56ee8d | 98 | |
a2ac85d9 | 99 | int max_forwards; |
4a56ee8d | 100 | |
a2ac85d9 | 101 | /* these in_addr's could probably be sockaddr_in's */ |
102 | ||
ddfcbc22 | 103 | struct IN_ADDR client_addr; |
a2ac85d9 | 104 | |
ddfcbc22 | 105 | struct IN_ADDR my_addr; |
4a56ee8d | 106 | |
a2ac85d9 | 107 | unsigned short my_port; |
4a56ee8d | 108 | |
a2ac85d9 | 109 | unsigned short client_port; |
4a56ee8d | 110 | |
a2ac85d9 | 111 | HierarchyLogEntry hier; |
4a56ee8d | 112 | |
a2ac85d9 | 113 | err_type errType; |
4a56ee8d | 114 | |
a2ac85d9 | 115 | char *peer_login; /* Configured peer login:password */ |
4a56ee8d | 116 | |
a2ac85d9 | 117 | time_t lastmod; /* Used on refreshes */ |
4a56ee8d | 118 | |
a2ac85d9 | 119 | const char *vary_headers; /* Used when varying entities are detected. Changes how the store key is calculated */ |
4a56ee8d | 120 | |
a2ac85d9 | 121 | char *peer_domain; /* Configured peer forceddomain */ |
4a56ee8d | 122 | |
a2ac85d9 | 123 | String tag; /* Internal tag for this request */ |
4a56ee8d | 124 | |
a2ac85d9 | 125 | String extacl_user; /* User name returned by extacl lookup */ |
4a56ee8d | 126 | |
a2ac85d9 | 127 | String extacl_passwd; /* Password returned by extacl lookup */ |
4a56ee8d | 128 | |
a2ac85d9 | 129 | String extacl_log; /* String to be used for access.log purposes */ |
8596962e | 130 | |
131 | public: | |
5cafad19 | 132 | bool multipartRangeRequest() const; |
4a56ee8d | 133 | |
429f7150 | 134 | bool parseFirstLine(const char *start, const char *end); |
4a56ee8d | 135 | |
666f514b | 136 | int parseHeader(const char *parse_start, int len); |
4a56ee8d | 137 | |
8ddea643 | 138 | virtual bool expectingBody(method_t unused, ssize_t&) const; |
4a56ee8d | 139 | |
5cafad19 | 140 | int prefixLen(); |
4a56ee8d | 141 | |
5cafad19 | 142 | void swapOut(StoreEntry * e); |
4a56ee8d | 143 | |
5cafad19 | 144 | void pack(Packer * p); |
4a56ee8d | 145 | |
5cafad19 | 146 | static void httpRequestPack(void *obj, Packer *p); |
8596962e | 147 | |
c21ad0f5 | 148 | static HttpRequest * CreateFromUrlAndMethod(char * url, method_t method); |
149 | ||
150 | static HttpRequest * CreateFromUrl(char * url); | |
151 | ||
8596962e | 152 | private: |
153 | const char *packableURI(bool full_uri) const; | |
154 | ||
155 | protected: | |
156 | virtual void packFirstLineInto(Packer * p, bool full_uri) const; | |
4a56ee8d | 157 | |
8596962e | 158 | virtual bool sanityCheckStartLine(MemBuf *buf, http_status *error); |
4a56ee8d | 159 | |
07947ad8 | 160 | virtual void hdrCacheInit(); |
8596962e | 161 | |
a2ac85d9 | 162 | }; |
528b2c61 | 163 | |
b001e822 | 164 | MEMPROXY_CLASS_INLINE(HttpRequest) |
165 | ||
528b2c61 | 166 | #endif /* SQUID_HTTPREQUEST_H */ |