@@ -99,14 +99,16 @@ namespace boost { namespace network { namespace http {
9999// We need to determine whether we've seen any of the following headers
100100// before setting the defaults. We use a bitset to keep track of the
101101// defaulted headers.
102- enum { ACCEPT, ACCEPT_ENCODING, HOST, MAX };
102+ enum { ACCEPT, ACCEPT_ENCODING, HOST,CONNECTION, MAX };
103103 std::bitset<MAX> found_headers;
104104static char const * defaulted_headers[][2 ] = {
105105 {consts::accept (),
106106consts::accept () +std::strlen (consts::accept ())},
107107 {consts::accept_encoding (),
108108consts::accept_encoding () +std::strlen (consts::accept_encoding ())},
109- {consts::host (),consts::host () +std::strlen (consts::host ())}
109+ {consts::host (),consts::host () +std::strlen (consts::host ())},
110+ {consts::connection (),
111+ consts::connection () +std::strlen (consts::connection ())}
110112 };
111113
112114typedef typename headers_range<Request>::type headers_range;
@@ -167,7 +169,8 @@ namespace boost { namespace network { namespace http {
167169boost::copy (crlf, oi);
168170 }
169171
170- if (!connection_keepalive<Tag>::value) {
172+ if (!connection_keepalive<Tag>::value &&
173+ !found_headers[CONNECTION]) {
171174boost::copy (connection, oi);
172175 *oi =consts::colon_char ();
173176 *oi =consts::space_char ();