From: wessels <> Date: Tue, 13 Sep 2005 23:45:05 +0000 (+0000) Subject: Forgot to add this yesterday for new HttpRequest/HttpReply dervied classes X-Git-Tag: SQUID_3_0_PRE4~630 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f19749117e322f4bd144ca0828dc5bfe6f09b80c;p=thirdparty%2Fsquid.git Forgot to add this yesterday for new HttpRequest/HttpReply dervied classes --- diff --git a/src/HttpMsg.h b/src/HttpMsg.h new file mode 100644 index 0000000000..4b122abb90 --- /dev/null +++ b/src/HttpMsg.h @@ -0,0 +1,85 @@ + +/* + * $Id: HttpMsg.h,v 1.1 2005/09/13 17:45:05 wessels Exp $ + * + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. + * + */ + +#ifndef SQUID_HTTPMSG_H +#define SQUID_HTTPMSG_H + +#include "typedefs.h" +#include "HttpHeader.h" +#include "HttpVersion.h" + +// common parts of HttpRequest and HttpReply + +class HttpMsg +{ + +public: + HttpMsg(http_hdr_owner_type owner); + virtual ~HttpMsg() {} + + virtual void reset() = 0; // will have body when http*Clean()s are gone + + // returns true and sets hdr_sz on success + // returns false and sets *error to zero when needs more data + // returns false and sets *error to a positive http_status code on error + virtual bool sanityCheckStartLine(MemBuf *buf, http_status *error) = 0; + + void packInto(Packer * p, bool full_uri) const; + +public: + HttpVersion http_ver; + HttpHeader header; + + HttpHdrCc *cache_control; + + /* Unsupported, writable, may disappear/change in the future + * For replies, sums _stored_ status-line, headers, and . + * Also used to report parsed header size if parse() is successful */ + int hdr_sz; + + int content_length; + protocol_t protocol; + + HttpMsgParseState pstate; /* the current parsing state */ + bool parse(MemBuf *buf, bool eol, http_status *error); + int httpMsgParseStep(const char *buf, int atEnd); + int httpMsgParseError(); + +protected: + virtual void packFirstLineInto(Packer * p, bool full_uri) const = 0; +}; + + +SQUIDCEXTERN int httpMsgIsolateHeaders(const char **parse_start, const char **blk_start, const char **blk_end); + +#endif /* SQUID_HTTPMSG_H */