From: Alex Rousskov Date: Mon, 10 Sep 2012 23:07:01 +0000 (-0600) Subject: Do not reuse persistent connections for PUTs to avoid ERR_ZERO_SIZE_OBJECT. X-Git-Tag: sourceformat-review-1~8^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ccbcff0e420da717376dbf285af482a2b55c231c;p=thirdparty%2Fsquid.git Do not reuse persistent connections for PUTs to avoid ERR_ZERO_SIZE_OBJECT. A compliant proxy may retry PUTs, but Squid lacks the [rather complicated] code required to protect the PUT request body from being nibbled during the first try or [also tricky] code to send 100-continue expectation requiredto delay body sending. Thus, Squid cannot safely retry some PUTs today, and FwdState::checkRetriable() must return false for all PUTs, to avoid bogus ERR_ZERO_SIZE_OBJECT errors (especially for clients that did not reuse a pconn and, hence, may not be ready to handle/retry an error response). In theory, requests with safe or idempotent methods other than PUT might have bodies so we apply the same logic to them as well. This reopens Squid bug #3398, undoing trunk r11859 commit which attempted to close that bug. --- diff --git a/src/forward.cc b/src/forward.cc index 0162b2d64b..768065c546 100644 --- a/src/forward.cc +++ b/src/forward.cc @@ -561,6 +561,12 @@ FwdState::checkRetry() bool FwdState::checkRetriable() { + // Optimize: A compliant proxy may retry PUTs, but Squid lacks the [rather + // complicated] code required to protect the PUT request body from being + // nibbled during the first try. Thus, Squid cannot retry some PUTs today. + if (request->body_pipe != NULL) + return false; + /* RFC2616 9.1 Safe and Idempotent Methods */ switch (request->method.id()) { /* 9.1.1 Safe Methods */