From: Amos Jeffries Date: Tue, 31 Mar 2015 13:58:50 +0000 (-0700) Subject: Abort parse cleanly if there is nothing to do X-Git-Tag: merge-candidate-3-v1~86^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=74faa994ecde112af97f1e54ae98e23d71a468e1;p=thirdparty%2Fsquid.git Abort parse cleanly if there is nothing to do ICAP behaviour on noteMoreBodySpaceAvailable() can result in a parse being attempted even if the read I/O buffer has not yet received any new content to fill the available space. Handle this cleanly instead of throwing parse errors and causing ICAP service disconnect. --- diff --git a/src/http/one/ChunkedCodingParser.cc b/src/http/one/ChunkedCodingParser.cc index adcd376fa3..41d50ff10f 100644 --- a/src/http/one/ChunkedCodingParser.cc +++ b/src/http/one/ChunkedCodingParser.cc @@ -36,8 +36,13 @@ Http::One::ChunkedCodingParser::clear() bool Http::One::ChunkedCodingParser::parse(const SBuf &aBuf) { - buf_ = aBuf; + buf_ = aBuf; // sync buffers first so calls to remaining() work properly if nothing done. + + if (buf_.isEmpty()) // nothing to do (yet) + return false; + debugs(74, DBG_DATA, "Parse buf={length=" << aBuf.length() << ", data='" << aBuf << "'}"); + Must(!buf_.isEmpty() && theOut); if (parsingStage_ == Http1::HTTP_PARSE_NONE)