Squid did not send Connection:close request header on a to-be-closed
HTTP/1.1 connection, violating RFC 7230 Section 6.6 "SHOULD send"
requirement.
delete cc;
}
- /* maybe append Connection: keep-alive */
- if (flags.keepalive) {
- hdr_out->putStr(Http::HdrType::CONNECTION, "keep-alive");
- }
+ // Always send Connection because HTTP/1.0 servers need explicit "keep-alive"
+ // while HTTP/1.1 servers need explicit "close", and we do not always know
+ // the server expectations.
+ hdr_out->putStr(Http::HdrType::CONNECTION, flags.keepalive ? "keep-alive" : "close");
/* append Front-End-Https */
if (flags.front_end_https) {
public:
unsigned int front_end_https = 0; ///< send "Front-End-Https: On" header (off/on/auto=2)
bool proxying = false;
- bool keepalive = false;
+ bool keepalive = false; ///< whether to keep the connection persistent
bool only_if_cached = false;
bool handling1xx = false; ///< we are ignoring or forwarding 1xx response
bool headers_parsed = false;