Skip to content

Commit 01bf00c

Browse files
committed
Merge pull request cpp-netlib#409 from leecoder/0.11-devel
Fix to overwrite connection header
2 parents f0eaf48 + 552749b commit 01bf00c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

boost/network/protocol/http/algorithms/linearize.hpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -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;
104104
static char const* defaulted_headers[][2] = {
105105
{consts::accept(),
106106
consts::accept() + std::strlen(consts::accept())},
107107
{consts::accept_encoding(),
108108
consts::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

112114
typedef typename headers_range<Request>::type headers_range;
@@ -167,7 +169,8 @@ namespace boost { namespace network { namespace http {
167169
boost::copy(crlf, oi);
168170
}
169171

170-
if (!connection_keepalive<Tag>::value) {
172+
if (!connection_keepalive<Tag>::value &&
173+
!found_headers[CONNECTION]) {
171174
boost::copy(connection, oi);
172175
*oi = consts::colon_char();
173176
*oi = consts::space_char();

0 commit comments

Comments
 (0)