谢谢霍布斯,
我接受了您的建议并创建了一个补丁文件。这对我有用。我知道这是一个老问题,但它帮助了我,希望这对其他人有帮助。
--- mod_fastcgi-SNAP-0910052141/mod_fastcgi.c 2008-11-09 07:31:03.000000000 -0700
+++ mod_fastcgi-SNAP-BadGateway/mod_fastcgi.c 2012-06-01 10:42:48.497212761 -0600
@@ -1670,7 +1670,7 @@
if (open_connection_to_fs(fr) != FCGI_OK)
{
ap_kill_timeout(r);
- return HTTP_INTERNAL_SERVER_ERROR;
+ return HTTP_BAD_GATEWAY;
}
is_connected = 1;
@@ -2079,7 +2079,7 @@
if (open_connection_to_fs(fr) != FCGI_OK)
{
ap_kill_timeout(r);
- return HTTP_INTERNAL_SERVER_ERROR;
+ return HTTP_BAD_GATEWAY;
}
set_nonblocking(fr, TRUE);
@@ -2387,6 +2387,11 @@
{
sink_client_data(fr);
}
+
+ //if we failed to connect to FastCGI Server, return error now. Do not try to parse headers
+ if (rv == HTTP_BAD_GATEWAY) {
+ return rv;
+ }
while (rv == 0 && (BufferLength(fr->serverInputBuffer) || BufferLength(fr->clientOutputBuffer)))
{