From: wessels <> Date: Fri, 16 Sep 2005 02:19:41 +0000 (+0000) Subject: Made HttpMsg::parseFirstLine() a virtual method for parsing the X-Git-Tag: SQUID_3_0_PRE4~613 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=429f7150b1079df416b2718f80c75c833b432987;p=thirdparty%2Fsquid.git Made HttpMsg::parseFirstLine() a virtual method for parsing the status and request lines of HTTP requests and responses. Still need to write HttpRequest::parseFirstLine(). --- diff --git a/src/HttpMsg.cc b/src/HttpMsg.cc index 722ebd0cc2..691e901883 100644 --- a/src/HttpMsg.cc +++ b/src/HttpMsg.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpMsg.cc,v 1.16 2005/09/15 19:22:30 wessels Exp $ + * $Id: HttpMsg.cc,v 1.17 2005/09/15 20:19:41 wessels Exp $ * * DEBUG: section 74 HTTP Message * AUTHOR: Alex Rousskov @@ -217,8 +217,6 @@ HttpMsg::httpMsgParseStep(const char *buf, int atEnd) const char **parse_end_ptr = &blk_end; assert(parse_start); assert(pstate < psParsed); - HttpReply *rep = dynamic_cast(this); - HttpRequest *req = dynamic_cast(this); *parse_end_ptr = parse_start; @@ -226,13 +224,8 @@ HttpMsg::httpMsgParseStep(const char *buf, int atEnd) if (!httpMsgIsolateStart(&parse_start, &blk_start, &blk_end)) return 0; - if (rep) { - if (!httpStatusLineParse(&rep->sline, rep->protoPrefix, blk_start, blk_end)) - return httpMsgParseError(); - } else if (req) { - if (!req->parseRequestLine(blk_start, blk_end)) - return httpMsgParseError(); - } + if (!parseFirstLine(blk_start, blk_end)) + return httpMsgParseError(); *parse_end_ptr = parse_start; diff --git a/src/HttpMsg.h b/src/HttpMsg.h index 5f302a5961..4fbcc5ddf6 100644 --- a/src/HttpMsg.h +++ b/src/HttpMsg.h @@ -1,6 +1,6 @@ /* - * $Id: HttpMsg.h,v 1.2 2005/09/15 19:22:30 wessels Exp $ + * $Id: HttpMsg.h,v 1.3 2005/09/15 20:19:41 wessels Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -77,6 +77,7 @@ public: protected: virtual void packFirstLineInto(Packer * p, bool full_uri) const = 0; + virtual bool parseFirstLine(const char *blk_start, const char *blk_end) = 0; virtual void hdrCacheInit(); }; diff --git a/src/HttpReply.cc b/src/HttpReply.cc index 9b9844571b..2d96910614 100644 --- a/src/HttpReply.cc +++ b/src/HttpReply.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpReply.cc,v 1.74 2005/09/15 19:22:30 wessels Exp $ + * $Id: HttpReply.cc,v 1.75 2005/09/15 20:19:41 wessels Exp $ * * DEBUG: section 58 HTTP Reply (Response) * AUTHOR: Alex Rousskov @@ -516,3 +516,8 @@ void HttpReply::packFirstLineInto(Packer *p, bool unused) const { httpStatusLinePackInto(&sline, p); } + +bool HttpReply::parseFirstLine(const char *blk_start, const char *blk_end) +{ + return httpStatusLineParse(&sline, protoPrefix, blk_start, blk_end); +} diff --git a/src/HttpReply.h b/src/HttpReply.h index ba23bb5a60..8ecea4ce5e 100644 --- a/src/HttpReply.h +++ b/src/HttpReply.h @@ -1,6 +1,6 @@ /* - * $Id: HttpReply.h,v 1.10 2005/09/15 19:22:30 wessels Exp $ + * $Id: HttpReply.h,v 1.11 2005/09/15 20:19:41 wessels Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -113,6 +113,7 @@ public: protected: virtual void packFirstLineInto(Packer * p, bool) const; + virtual bool parseFirstLine(const char *start, const char *end); virtual void hdrCacheInit(); }; diff --git a/src/HttpRequest.cc b/src/HttpRequest.cc index 0ee3dfe7d9..e88d8927c8 100644 --- a/src/HttpRequest.cc +++ b/src/HttpRequest.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpRequest.cc,v 1.50 2005/09/15 19:22:30 wessels Exp $ + * $Id: HttpRequest.cc,v 1.51 2005/09/15 20:19:41 wessels Exp $ * * DEBUG: section 73 HTTP Request * AUTHOR: Duane Wessels @@ -159,9 +159,9 @@ bool HttpRequest::sanityCheckStartLine(MemBuf *buf, http_status *error) return true; } -bool HttpRequest::parseRequestLine(const char *start, const char *end) +bool HttpRequest::parseFirstLine(const char *start, const char *end) { - fatal("HttpRequest::parseRequestLine not implemented yet"); + fatal("HttpRequest::parseFirstLine not implemented yet"); return false; } diff --git a/src/HttpRequest.h b/src/HttpRequest.h index 9b9a7c313a..bf91269ce1 100644 --- a/src/HttpRequest.h +++ b/src/HttpRequest.h @@ -1,6 +1,6 @@ /* - * $Id: HttpRequest.h,v 1.13 2005/09/15 19:22:30 wessels Exp $ + * $Id: HttpRequest.h,v 1.14 2005/09/15 20:19:41 wessels Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -95,7 +95,7 @@ public: String extacl_log; /* String to be used for access.log purposes */ public: - bool parseRequestLine(const char *start, const char *end); + bool parseFirstLine(const char *start, const char *end); int parseHeader(const char *parse_start); private: