------------------------------------------------------------ revno: 13258 revision-id: kinkie@squid-cache.org-20140206093048-0fs63shbqlnsyv7u parent: kinkie@squid-cache.org-20140205180447-vl47wj5x036dzibk committer: Francesco Chemolli branch nick: trunk timestamp: Thu 2014-02-06 10:30:48 +0100 message: Fix r13257 commit ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: kinkie@squid-cache.org-20140206093048-0fs63shbqlnsyv7u # target_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # testament_sha1: d68d3db7005411a46ee7a1202ef7ac815033b006 # timestamp: 2014-02-06 09:53:46 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # base_revision_id: kinkie@squid-cache.org-20140205180447-\ # vl47wj5x036dzibk # # Begin patch === modified file 'src/client_side.cc' --- src/client_side.cc 2014-01-05 19:49:23 +0000 +++ src/client_side.cc 2014-02-06 09:30:48 +0000 @@ -1782,6 +1782,9 @@ clientStreamRead(getTail(), http, readBuffer); } +/** Adapt stream status to account for Range cases + * + */ clientStream_status_t ClientSocketContext::socketState() { @@ -1798,11 +1801,8 @@ 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 @@ // 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 @@ 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: