]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3111: Mid-term fix for the forward.cc "err" assertion.
authorAlex Rousskov <rousskov@measurement-factory.com>
Fri, 1 Feb 2013 04:56:07 +0000 (21:56 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 1 Feb 2013 04:56:07 +0000 (21:56 -0700)
The assert is triggered when a close handler for the server connection
destroys FwdState before we have received anything from the origin
server.
Instead of asserting, we now respond with a 502 (Bad Gateway)
ERR_READ_ERROR.

That error seems the most appropriate single choice among available
ones, but
it may be misleading (in access.log) when the close handler was called
due to
client problems. Hopefully, another error will be logged in most of
those
cases.

src/forward.cc

index 8f15fd335a032058baef93e4bccfe814fcd4acbe..39936310eaed14b8ae7dbbdefd40751668361b0f 100644 (file)
@@ -196,6 +196,8 @@ FwdState::completed()
 
     if (entry->store_status == STORE_PENDING) {
         if (entry->isEmpty()) {
+            if (!err) // we quit (e.g., fd closed) before an error or content
+                fail(new ErrorState(ERR_READ_ERROR, HTTP_BAD_GATEWAY, request));
             assert(err);
             errorAppendEntry(entry, err);
             err = NULL;