]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3007 (extra): Set 500 status on peer proxy connection failure
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 1 Apr 2011 02:04:29 +0000 (15:04 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 1 Apr 2011 02:04:29 +0000 (15:04 +1300)
rev11299 avoided 000 status, but ignores the error cases and always sends
200 success.

TODO:
Proper handling of the error cases to allow peer failovers is now possible
but not included in the scope of this patch.

src/tunnel.cc

index 8d409913a756020154683cd24e035c0a40407958..0ae00b6d1e116b2f4d86d5563158c2805bcdeb18 100644 (file)
@@ -524,7 +524,10 @@ tunnelProxyConnectedWriteDone(int fd, char *buf, size_t size, comm_err_t flag, i
 {
     TunnelStateData *tunnelState = static_cast<TunnelStateData *>(data);
     debugs(26, 3, HERE << "FD " << fd << " tunnelState=" << tunnelState);
-    *tunnelState->status_ptr = HTTP_OK;
+    if (flag == COMM_OK)
+        *tunnelState->status_ptr = HTTP_OK;
+    else
+        *tunnelState->status_ptr = HTTP_INTERNAL_SERVER_ERROR;
     tunnelConnectedWriteDone(fd, buf, size, flag, xerrno, data);
 }