]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Shuffle skipLineTerminator() to Http1::Parser
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 24 Jan 2015 12:28:38 +0000 (04:28 -0800)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 24 Jan 2015 12:28:38 +0000 (04:28 -0800)
Bring inline with location from the ResponseParser branch to reduce
future merge conflicts.

src/http/one/Parser.cc
src/http/one/Parser.h
src/http/one/RequestParser.cc
src/http/one/RequestParser.h

index 1bf408b023476c3c3a1f30407c560c7e68bfbc62..b9bfa173a3e10d7440ace7ebb2a8f076bc838303 100644 (file)
@@ -10,6 +10,7 @@
 #include "Debug.h"
 #include "http/one/Parser.h"
 #include "parser/Tokenizer.h"
+#include "SquidConfig.h"
 
 /// RFC 7230 section 2.6 - 7 magic octets
 const SBuf Http::One::Parser::Http1magic("HTTP/1.");
@@ -23,6 +24,19 @@ Http::One::Parser::clear()
     mimeHeaderBlock_.clear();
 }
 
+bool
+Http::One::Parser::skipLineTerminator(::Parser::Tokenizer &tok) const
+{
+    static const SBuf crlf("\r\n");
+    if (tok.skip(crlf))
+        return true;
+
+    if (Config.onoff.relaxed_header_parser && tok.skipOne(CharacterSet::LF))
+        return true;
+
+    return false;
+}
+
 // arbitrary maximum-length for headers which can be found by Http1Parser::getHeaderField()
 #define GET_HDR_SZ  1024
 
index 8f0083ff8ca91c1b8d6fc350973cf96db2383f46..ff1c8d290969c96ab5b6c5f6277dd9b62267085d 100644 (file)
 #include "http/one/forward.h"
 #include "SBuf.h"
 
+namespace Parser {
+class Tokenizer;
+}
+
 namespace Http {
 namespace One {
 
@@ -88,6 +92,10 @@ public:
     const SBuf &remaining() const {return buf_;}
 
 protected:
+    /// detect and skip the CRLF or (if tolerant) LF line terminator
+    /// consume from the tokenizer and return true only if found
+    bool skipLineTerminator(::Parser::Tokenizer &tok) const;
+
     /// RFC 7230 section 2.6 - 7 magic octets
     static const SBuf Http1magic;
 
index 375859ab6b61dc4535799614d5e54811d9b6df1b..c60ef61d5e86239fff41b66d4d35584d5879483a 100644 (file)
@@ -58,21 +58,6 @@ Http::One::RequestParser::skipGarbageLines()
     }
 }
 
-/// detect and skip the CRLF or LF line terminator
-/// consume from the tokenizer and return true only if found
-bool
-Http::One::RequestParser::skipLineTerminator(::Parser::Tokenizer &tok) const
-{
-    static const SBuf crlf("\r\n");
-    if (tok.skip(crlf))
-        return true;
-
-    if (Config.onoff.relaxed_header_parser && tok.skipOne(CharacterSet::LF))
-        return true;
-
-    return false;
-}
-
 /**
  * Attempt to parse the method field out of an HTTP message request-line.
  *
index 236cd1c51c1e0cf2391b41eb3f01f2566cd2e6d7..06ec25b76cac8cb70a9c960b524211544f735933 100644 (file)
@@ -57,7 +57,6 @@ private:
     int parseMethodField(::Parser::Tokenizer &, const CharacterSet &);
     int parseUriField(::Parser::Tokenizer &, const CharacterSet &);
     int parseHttpVersionField(::Parser::Tokenizer &);
-    bool skipLineTerminator(::Parser::Tokenizer &) const;
 
     /// what request method has been found on the first line
     HttpRequestMethod method_;