]> git.ipfire.org Git - thirdparty/squid.git/blame - src/HttpMsg.h
Forgot to add this yesterday for new HttpRequest/HttpReply dervied classes
[thirdparty/squid.git] / src / HttpMsg.h
CommitLineData
f1974911 1
2/*
3 * $Id: HttpMsg.h,v 1.1 2005/09/13 17:45:05 wessels 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_HTTPMSG_H
35#define SQUID_HTTPMSG_H
36
37#include "typedefs.h"
38#include "HttpHeader.h"
39#include "HttpVersion.h"
40
41// common parts of HttpRequest and HttpReply
42
43class HttpMsg
44{
45
46public:
47 HttpMsg(http_hdr_owner_type owner);
48 virtual ~HttpMsg() {}
49
50 virtual void reset() = 0; // will have body when http*Clean()s are gone
51
52 // returns true and sets hdr_sz on success
53 // returns false and sets *error to zero when needs more data
54 // returns false and sets *error to a positive http_status code on error
55 virtual bool sanityCheckStartLine(MemBuf *buf, http_status *error) = 0;
56
57 void packInto(Packer * p, bool full_uri) const;
58
59public:
60 HttpVersion http_ver;
61 HttpHeader header;
62
63 HttpHdrCc *cache_control;
64
65 /* Unsupported, writable, may disappear/change in the future
66 * For replies, sums _stored_ status-line, headers, and <CRLF>.
67 * Also used to report parsed header size if parse() is successful */
68 int hdr_sz;
69
70 int content_length;
71 protocol_t protocol;
72
73 HttpMsgParseState pstate; /* the current parsing state */
74 bool parse(MemBuf *buf, bool eol, http_status *error);
75 int httpMsgParseStep(const char *buf, int atEnd);
76 int httpMsgParseError();
77
78protected:
79 virtual void packFirstLineInto(Packer * p, bool full_uri) const = 0;
80};
81
82
83SQUIDCEXTERN int httpMsgIsolateHeaders(const char **parse_start, const char **blk_start, const char **blk_end);
84
85#endif /* SQUID_HTTPMSG_H */