Skip to content

Fix to overwrite connection header #409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix to overwrite connection header
  • Loading branch information
leecoder committed Jul 1, 2014
commit 552749b2a2a807781bdf69fe7a1b3cd2ca308242
9 changes: 6 additions & 3 deletions boost/network/protocol/http/algorithms/linearize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,16 @@ namespace boost { namespace network { namespace http {
// We need to determine whether we've seen any of the following headers
// before setting the defaults. We use a bitset to keep track of the
// defaulted headers.
enum { ACCEPT, ACCEPT_ENCODING, HOST, MAX };
enum { ACCEPT, ACCEPT_ENCODING, HOST, CONNECTION, MAX };
std::bitset<MAX> found_headers;
static char const* defaulted_headers[][2] = {
{consts::accept(),
consts::accept() + std::strlen(consts::accept())},
{consts::accept_encoding(),
consts::accept_encoding() + std::strlen(consts::accept_encoding())},
{consts::host(), consts::host() + std::strlen(consts::host())}
{consts::host(), consts::host() + std::strlen(consts::host())},
{consts::connection(),
consts::connection() + std::strlen(consts::connection())}
};

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

if (!connection_keepalive<Tag>::value) {
if (!connection_keepalive<Tag>::value &&
!found_headers[CONNECTION]) {
boost::copy(connection, oi);
*oi = consts::colon_char();
*oi = consts::space_char();
Expand Down