From 9b403bdba89dfc3d3c0606f1a68912b4d02b5e49 Mon Sep 17 00:00:00 2001
From: Fabian Keil <fk@fabiankeil.de>
Date: Tue, 30 Jun 2009 18:32:04 +0000
Subject: [PATCH] If the status code isn't 200, don't assume a missing
 Connection header for a HTTP/1.1 response implies keep-alive.

Seems to work around problems with some servers.
---
 parsers.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/parsers.c b/parsers.c
index a8d36838..021b63f5 100644
--- a/parsers.c
+++ b/parsers.c
@@ -1,4 +1,4 @@
-const char parsers_rcs[] = "$Id: parsers.c,v 1.185 2009/06/27 11:25:33 fabiankeil Exp $";
+const char parsers_rcs[] = "$Id: parsers.c,v 1.186 2009/06/28 14:31:43 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/parsers.c,v $
@@ -3411,8 +3411,17 @@ static jb_err server_connection_adder(struct client_state *csp)
 #ifdef FEATURE_CONNECTION_KEEP_ALIVE
     && !(csp->flags & CSP_FLAG_SERVER_SOCKET_TAINTED)
 #endif
+    && (csp->http->status == 200)
        )
    {
+      /*
+       * XXX: not doing this for status codes other than 200 works
+       * around problems with broken servers that will keep the
+       * connection open, but terminate the connection when the
+       * next request arrives. Once we are able to figure out which
+       * requests are safe to send again, this will probably no
+       * longer be necessary.
+       */
       log_error(LOG_LEVEL_HEADER, "A HTTP/1.1 response "
          "without Connection header implies keep-alive.");
       csp->flags |= CSP_FLAG_SERVER_CONNECTION_KEEP_ALIVE;
-- 
2.49.0