]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix inverted LF detection in Parser::getHeaderField()
authorAmos Jeffries <squid3@treenet.co.nz>
Wed, 4 Jun 2014 16:36:16 +0000 (09:36 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 4 Jun 2014 16:36:16 +0000 (09:36 -0700)
src/http/one/Parser.cc

index 079a3d1fc4fd589d86381e27abd437eab08646af..4dcb99019d959912d4670728855612e82a3b38ed 100644 (file)
@@ -29,14 +29,15 @@ Http::One::Parser::getHeaderField(const char *name)
     LOCAL_ARRAY(char, header, GET_HDR_SZ);
     const int namelen = name ? strlen(name) : 0;
 
-    debugs(25, 5, "looking for '" << name << "'");
+    debugs(25, 5, "looking for " << name);
 
+    // while we can find more LF in the SBuf
+    static CharacterSet iso8859Line = CharacterSet("non-LF",'\0','\n'-1) + CharacterSet(NULL, '\n'+1, (unsigned char)0xFF);
     ::Parser::Tokenizer tok(mimeHeaderBlock_);
     SBuf p;
-    const SBuf crlf("\r\n");
+    static const SBuf crlf("\r\n");
 
-    // while we can find more LF in the SBuf
-    while (tok.prefix(p, CharacterSet::LF)) {
+    while (tok.prefix(p, iso8859Line)) {
         tok.skip(CharacterSet::LF); // move tokenizer past the LF
 
         // header lines must start with the name (case insensitive)
@@ -63,7 +64,7 @@ Http::One::Parser::getHeaderField(const char *name)
 
         // return the header field-value
         xstrncpy(header, p.rawContent(), p.length());
-        debugs(25, 5, "returning: " << header);
+        debugs(25, 5, "returning " << header);
         return header;
     }