From: robertc <> Date: Tue, 18 Apr 2006 18:25:50 +0000 (+0000) Subject: Change HttpMsg::httpMsgParseError into a virtual function, and then overload that... X-Git-Tag: SQUID_3_0_PRE4~263 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fb5256831b164003631a5ed97a2f070073189072;p=thirdparty%2Fsquid.git Change HttpMsg::httpMsgParseError into a virtual function, and then overload that in HttpReply rather than HttpMsg knowing about HttpReply. --- diff --git a/src/HttpMsg.cc b/src/HttpMsg.cc index a547c7869f..8b7fac545a 100644 --- a/src/HttpMsg.cc +++ b/src/HttpMsg.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpMsg.cc,v 1.25 2006/02/17 18:10:59 wessels Exp $ + * $Id: HttpMsg.cc,v 1.26 2006/04/18 12:25:50 robertc Exp $ * * DEBUG: section 74 HTTP Message * AUTHOR: Alex Rousskov @@ -36,7 +36,6 @@ #include "squid.h" #include "HttpMsg.h" #include "HttpRequest.h" -#include "HttpReply.h" #include "MemBuf.h" HttpMsg::HttpMsg(http_hdr_owner_type owner): header(owner), @@ -290,11 +289,6 @@ int HttpMsg::httpMsgParseError() { reset(); - /* indicate an error */ - - if (HttpReply *rep = dynamic_cast(this)) - rep->sline.status = HTTP_INVALID_HEADER; - return -1; } diff --git a/src/HttpMsg.h b/src/HttpMsg.h index d098743d20..44d7af5fc1 100644 --- a/src/HttpMsg.h +++ b/src/HttpMsg.h @@ -1,6 +1,6 @@ /* - * $Id: HttpMsg.h,v 1.8 2006/02/17 18:10:59 wessels Exp $ + * $Id: HttpMsg.h,v 1.9 2006/04/18 12:25:50 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -81,7 +81,7 @@ public: int httpMsgParseStep(const char *buf, int atEnd); - int httpMsgParseError(); + virtual int httpMsgParseError(); virtual bool expectingBody(method_t, ssize_t&) const = 0; diff --git a/src/HttpReply.cc b/src/HttpReply.cc index e7e66127c6..f09d8fa4ae 100644 --- a/src/HttpReply.cc +++ b/src/HttpReply.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpReply.cc,v 1.82 2006/01/23 20:04:24 wessels Exp $ + * $Id: HttpReply.cc,v 1.83 2006/04/18 12:25:50 robertc Exp $ * * DEBUG: section 58 HTTP Reply (Response) * AUTHOR: Alex Rousskov @@ -449,6 +449,16 @@ bool HttpReply::parseFirstLine(const char *blk_start, const char *blk_end) return httpStatusLineParse(&sline, protoPrefix, blk_start, blk_end); } +/* handy: resets and returns -1 */ +int +HttpReply::httpMsgParseError() +{ + int result(HttpMsg::httpMsgParseError()); + /* indicate an error in the status line */ + sline.status = HTTP_INVALID_HEADER; + return result; +} + /* * Indicate whether or not we would usually expect an entity-body * along with this response diff --git a/src/HttpReply.h b/src/HttpReply.h index 790df613cf..0b4d0ff46c 100644 --- a/src/HttpReply.h +++ b/src/HttpReply.h @@ -1,6 +1,6 @@ /* - * $Id: HttpReply.h,v 1.16 2006/02/17 18:10:59 wessels Exp $ + * $Id: HttpReply.h,v 1.17 2006/04/18 12:25:50 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -93,6 +93,8 @@ public: bool do_clean; public: + virtual int httpMsgParseError(); + virtual bool expectingBody(method_t, ssize_t&) const; void updateOnNotModified(HttpReply const *other);