From: Francesco Chemolli Date: Thu, 6 Feb 2014 09:30:48 +0000 (+0100) Subject: Fix r13257 commit X-Git-Tag: SQUID_3_5_0_1~387 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=a77f476578dd97df51953ab1825e834b831b193a;p=thirdparty%2Fsquid.git Fix r13257 commit --- diff --git a/src/client_side.cc b/src/client_side.cc index b5a00a3527..0781d7d890 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1782,6 +1782,9 @@ ClientSocketContext::pullData() clientStreamRead(getTail(), http, readBuffer); } +/** Adapt stream status to account for Range cases + * + */ clientStream_status_t ClientSocketContext::socketState() { @@ -1798,11 +1801,8 @@ ClientSocketContext::socketState() if (!canPackMoreRanges()) { debugs(33, 5, HERE << "Range request at end of returnable " << "range sequence on " << clientConnection); - - if (http->request->flags.proxyKeepalive) - return STREAM_COMPLETE; - else - return STREAM_UNPLANNED_COMPLETE; + // we got everything we wanted from the store + return STREAM_COMPLETE; } } else if (reply && reply->content_range) { /* reply has content-range, but Squid is not managing ranges */ @@ -1815,24 +1815,11 @@ ClientSocketContext::socketState() // did we get at least what we expected, based on range specs? - if (bytesSent == bytesExpected) { // got everything - if (http->request->flags.proxyKeepalive) - return STREAM_COMPLETE; - else - return STREAM_UNPLANNED_COMPLETE; - } - - // The logic below is not clear: If we got more than we - // expected why would persistency matter? Should not this - // always be an error? - if (bytesSent > bytesExpected) { // got extra - if (http->request->flags.proxyKeepalive) - return STREAM_COMPLETE; - else - return STREAM_UNPLANNED_COMPLETE; - } - - // did not get enough yet, expecting more + if (bytesSent == bytesExpected) // got everything + return STREAM_COMPLETE; + + if (bytesSent > bytesExpected) // Error: Sent more than expected + return STREAM_UNPLANNED_COMPLETE; } return STREAM_NONE; @@ -1939,8 +1926,11 @@ ClientSocketContext::writeComplete(const Comm::ConnectionPointer &conn, char *bu break; case STREAM_COMPLETE: - debugs(33, 5, HERE << conn << " Keeping Alive"); - keepaliveNextRequest(); + debugs(33, 5, conn << "Stream complete, keepalive is " << http->request->flags.proxyKeepalive); + if (http->request->flags.proxyKeepalive) + keepaliveNextRequest(); + else + initiateClose("STREAM_COMPLETE NOKEEPALIVE"); return; case STREAM_UNPLANNED_COMPLETE: