]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Made HttpMsg::parseFirstLine() a virtual method for parsing the
authorwessels <>
Fri, 16 Sep 2005 02:19:41 +0000 (02:19 +0000)
committerwessels <>
Fri, 16 Sep 2005 02:19:41 +0000 (02:19 +0000)
status and request lines of HTTP requests and responses.
Still need to write HttpRequest::parseFirstLine().

src/HttpMsg.cc
src/HttpMsg.h
src/HttpReply.cc
src/HttpReply.h
src/HttpRequest.cc
src/HttpRequest.h

index 722ebd0cc23c056c62a9e7e13e00483454632d17..691e901883e976e2e5d7d8bc625f78f5df9024aa 100644 (file)
@@ -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<HttpReply*>(this);
-    HttpRequest *req = dynamic_cast<HttpRequest*>(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;
 
index 5f302a596175ee915360719905e2a4097db8b0f4..4fbcc5ddf6778de6b439373f8c4a3d404ed8840c 100644 (file)
@@ -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();
 };
 
index 9b9844571be184f832350bfd232f4c41f2eabfec..2d969106147cfc344573a2bce1c0af5985074ddb 100644 (file)
@@ -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);
+}
index ba23bb5a60a9b878ea2d91b0a67b6d6c7d57658e..8ecea4ce5e27229c740d871b0808b6291ca34468 100644 (file)
@@ -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();
 };
 
index 0ee3dfe7d9093bf47e3e1707aa9fc870082e40ac..e88d8927c86813653e31f8dd09a1a25f1cac2086 100644 (file)
@@ -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;
 }
 
index 9b9a7c313ad09711b262a4a803df3f6fc260b4f9..bf91269ce141cb17d5c4abbd83f532a1c8f7a613 100644 (file)
@@ -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: