From: Amos Jeffries Date: Sun, 21 Mar 2010 14:54:03 +0000 (+1300) Subject: Author: Unknown X-Git-Tag: SQUID_3_2_0_1~344 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=da6c841;p=thirdparty%2Fsquid.git Author: Unknown Bug 2879: 3.0 regression in headers end finding Ported from Squid-2. --- diff --git a/src/http.cc b/src/http.cc index e00332cb5a..d093aee47e 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1122,6 +1122,23 @@ HttpStateData::readReply(const CommIoCbParams &io) if (len == 0) { // reached EOF? eof = 1; flags.do_next_read = 0; + + /* Bug 2789: Replies may terminate with \r\n then EOF instead of \r\n\r\n + * Ensure here that we have at minimum two \r\n when EOF is seen. + * TODO: When headersEnd() is cleaned up to only be called once we can merge + * this as a special case there where it belongs. + */ + if (!flags.headers_parsed) { + /* + * Yes Henrik, there is a point to doing this. When we + * called httpProcessReplyHeader() before, we didn't find + * the end of headers, but now we are definately at EOF, so + * we want to process the reply headers. + */ + /* Fake an "end-of-headers" to work around such broken servers */ + readBuf->append("\r\n", 2); + len = 2; + } } if (!flags.headers_parsed) { // have not parsed headers yet?