clientStreamRead(getTail(), http, readBuffer);
}
+/** Adapt stream status to account for Range cases
+ *
+ */
clientStream_status_t
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 */
// 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;
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: