]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Do not reuse persistent connections for PUTs to avoid ERR_ZERO_SIZE_OBJECT.
authorAlex Rousskov <rousskov@measurement-factory.com>
Sat, 22 Sep 2012 03:12:33 +0000 (21:12 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 22 Sep 2012 03:12:33 +0000 (21:12 -0600)
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.

src/forward.cc

index 66675927931209498023682a9558211b5f41fa8c..118e00ec4197c8e2259bb8f7a85383a9ef61e980 100644 (file)
@@ -547,6 +547,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 */