]> 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>
Mon, 10 Sep 2012 23:07:01 +0000 (17:07 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Mon, 10 Sep 2012 23:07:01 +0000 (17:07 -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 0162b2d64b5cc5ce1b91f584b3772f7750ff2fbd..768065c546ba974283934817229fe1e96bc4d7fa 100644 (file)
@@ -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 */