From: Amos Jeffries Date: Wed, 4 Jun 2014 16:36:16 +0000 (-0700) Subject: Fix inverted LF detection in Parser::getHeaderField() X-Git-Tag: merge-candidate-3-v1~506^2~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f6c7fa03a0cbe4cf6090469e88e8d58c95353630;p=thirdparty%2Fsquid.git Fix inverted LF detection in Parser::getHeaderField() --- diff --git a/src/http/one/Parser.cc b/src/http/one/Parser.cc index 079a3d1fc4..4dcb99019d 100644 --- a/src/http/one/Parser.cc +++ b/src/http/one/Parser.cc @@ -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; }