Skip to content

Improve statschannel HTTP Connection: header logic

Tony Finch requested to merge 4126-statschannel-connection-close-keepalive into main

In HTTP/1.0 and HTTP/1.1, RFC 9112 section 9.6 says the last response in a connection should include a Connection: close header, but the statschannel server omitted it.

In an HTTP/1.0 response, the statschannel server can sometimes send a Connection: keep-alive header when it is about to close the connection. There are two ways:

If the first request on a connection is keep-alive and the second request is not, then both responses have Connection: keep-alive but the connection is (correctly) closed after the second response.

If a single request contains

Connection: close
Connection: keep-alive

then RFC 9112 section 9.3 says the keep-alive header is ignored, but the statschannel sends a spurious keep-alive in its response, though it correctly closes the connection.

To fix these bugs, make it more clear that the httpd->flags are part of the per-request-response state. The Connection: flags are now described in terms of the effect they have instead of what causes them to be set.

Closes #4126 (closed)

Edited by Michał Kępień

Merge request reports