]>
Commit | Line | Data |
---|---|---|
450e0c10 | 1 | /* |
262a0e14 | 2 | * $Id$ |
450e0c10 | 3 | * |
4 | * | |
5 | * SQUID Web Proxy Cache http://www.squid-cache.org/ | |
6 | * ---------------------------------------------------------- | |
7 | * | |
8 | * Squid is the result of efforts by numerous individuals from | |
9 | * the Internet community; see the CONTRIBUTORS file for full | |
10 | * details. Many organizations have provided support for Squid's | |
11 | * development; see the SPONSORS file for full details. Squid is | |
12 | * Copyrighted (C) 2001 by the Regents of the University of | |
13 | * California; see the COPYRIGHT file for full details. Squid | |
14 | * incorporates software developed and/or copyrighted by other | |
15 | * sources; see the CREDITS file for full details. | |
16 | * | |
17 | * This program is free software; you can redistribute it and/or modify | |
18 | * it under the terms of the GNU General Public License as published by | |
19 | * the Free Software Foundation; either version 2 of the License, or | |
20 | * (at your option) any later version. | |
26ac0430 | 21 | * |
450e0c10 | 22 | * This program is distributed in the hope that it will be useful, |
23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
25 | * GNU General Public License for more details. | |
26ac0430 | 26 | * |
450e0c10 | 27 | * You should have received a copy of the GNU General Public License |
28 | * along with this program; if not, write to the Free Software | |
29 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. | |
30 | * | |
31 | * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org> | |
32 | */ | |
450e0c10 | 33 | #ifndef SQUID_HTTPSTATUSLINE_H |
34 | #define SQUID_HTTPSTATUSLINE_H | |
35 | ||
e1f7507e AJ |
36 | class Packer; |
37 | class String; | |
38 | ||
0c3d3f65 | 39 | #include "HttpStatusCode.h" |
450e0c10 | 40 | #include "HttpVersion.h" |
0c3d3f65 | 41 | #include "anyp/ProtocolType.h" |
e77d7ef0 | 42 | #include "SquidString.h" |
450e0c10 | 43 | |
e77d7ef0 AJ |
44 | /** |
45 | * Holds the values parsed from an HTTP reply status line. | |
46 | * | |
47 | * For example: HTTP/1.1 200 Okay | |
48 | */ | |
450e0c10 | 49 | class HttpStatusLine |
50 | { | |
450e0c10 | 51 | public: |
52 | /* public, read only */ | |
e77d7ef0 AJ |
53 | |
54 | /** | |
55 | * By rights protocol name should be a constant "HTTP", with no need for this field to exist. | |
0c3d3f65 AJ |
56 | * However there are protocols which violate HTTP by sending their own custom formats |
57 | * back with other protocol names (ICY streaming format being the current major problem). | |
e77d7ef0 | 58 | */ |
0c3d3f65 | 59 | AnyP::ProtocolType protocol; |
e77d7ef0 AJ |
60 | |
61 | HttpVersion version; ///< breakdown of protocol version labels: 0.9 1.0 1.1 | |
62 | http_status status; ///< status code. ie 200 404 | |
63 | const char *reason; ///< points to a _constant_ string (default or supplied), never free()d */ | |
450e0c10 | 64 | }; |
65 | ||
66 | /* init/clean */ | |
67 | SQUIDCEXTERN void httpStatusLineInit(HttpStatusLine * sline); | |
68 | SQUIDCEXTERN void httpStatusLineClean(HttpStatusLine * sline); | |
69 | /* set/get values */ | |
70 | SQUIDCEXTERN void httpStatusLineSet(HttpStatusLine * sline, HttpVersion version, | |
71 | http_status status, const char *reason); | |
72 | SQUIDCEXTERN const char *httpStatusLineReason(const HttpStatusLine * sline); | |
73 | /* parse/pack */ | |
74 | /* parse a 0-terminating buffer and fill internal structires; returns true on success */ | |
30abd221 | 75 | SQUIDCEXTERN int httpStatusLineParse(HttpStatusLine * sline, const String &protoPrefix, |
8596962e | 76 | const char *start, const char *end); |
450e0c10 | 77 | /* pack fields using Packer */ |
78 | SQUIDCEXTERN void httpStatusLinePackInto(const HttpStatusLine * sline, Packer * p); | |
79 | ||
582c2af2 FC |
80 | SQUIDCEXTERN const char *httpStatusString(http_status status); |
81 | ||
450e0c10 | 82 | #endif /* SQUID_HTTPSTATUSLINE_H */ |