From: Alex Rousskov Date: Wed, 30 Sep 2015 03:24:39 +0000 (-0700) Subject: do not bypass hdrCacheInit() when there are no mime headers X-Git-Tag: SQUID_4_0_1~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=563afef67c001fc58f5d0438b0a0cc062088e493;p=thirdparty%2Fsquid.git do not bypass hdrCacheInit() when there are no mime headers --- diff --git a/src/HttpMsg.cc b/src/HttpMsg.cc index b386244f28..d2aa351e21 100644 --- a/src/HttpMsg.cc +++ b/src/HttpMsg.cc @@ -287,20 +287,15 @@ HttpMsg::parseHeader(Http1::Parser &hp) { // HTTP/1 message contains "zero or more header fields" // zero does not need parsing - if (!hp.headerBlockSize()) { - pstate = psParsed; - return true; - } - // XXX: c_str() reallocates. performance regression. - if (header.parse(hp.mimeHeader().c_str(), hp.headerBlockSize())) { - pstate = psParsed; - hdrCacheInit(); - return true; + if (hp.headerBlockSize() && !header.parse(hp.mimeHeader().c_str(), hp.headerBlockSize())) { + pstate = psError; + return false; } - pstate = psError; - return false; + pstate = psParsed; + hdrCacheInit(); + return true; } /* handy: resets and returns -1 */