]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Optimization: Reuse CharacterSets when parsing HTTP responses (#231)
authorEduard Bagdasaryan <eduard.bagdasaryan@measurement-factory.com>
Mon, 2 Jul 2018 03:14:14 +0000 (03:14 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Mon, 2 Jul 2018 04:14:17 +0000 (04:14 +0000)
Expensive CharacterSet objects creation and manipulation was happening
for virtually every HTTP miss since 6fe0370.

Also removed code duplication.

src/http/one/ResponseParser.cc

index e22bedfe677d8f3624eb29268e9826ba397aafc0..98ac559094b20f17c15bd48c03f4d9a8a8af35f2 100644 (file)
@@ -121,16 +121,7 @@ Http::One::ResponseParser::parseResponseFirstLine()
 {
     Http1::Tokenizer tok(buf_);
 
-    CharacterSet WspDelim = CharacterSet::SP; // strict parse only accepts SP
-
-    if (Config.onoff.relaxed_header_parser) {
-        // RFC 7230 section 3.5
-        // tolerant parser MAY accept any of SP, HTAB, VT (%x0B), FF (%x0C), or bare CR
-        // as whitespace between status-line fields
-        WspDelim += CharacterSet::HTAB
-                    + CharacterSet("VT,FF","\x0B\x0C")
-                    + CharacterSet::CR;
-    }
+    const CharacterSet &WspDelim = DelimiterCharacters();
 
     if (msgProtocol_.protocol != AnyP::PROTO_NONE) {
         debugs(74, 6, "continue incremental parse for " << msgProtocol_);