async-h1 icon indicating copy to clipboard operation
async-h1 copied to clipboard

gracefully fail HTTP/1.0 connections

Open yoshuawuyts opened this issue 4 years ago • 2 comments

Currently our handling of HTTP/1.0 connections is rather blunt: we log an error and exit. We could do better by sending back a 426: Upgrade Required header with an Upgrade: HTTP/1.1 field. A client that sends an HTTP/1.0 request will receive a more informative response that's not "TCP connection aborted", and if it's sufficiently advanced it may even know to upgrade to HTTP/1.1 and try again.

We may choose to add support for HTTP/1.0 proper in the future. But that requires a significant amount of design work and research, and until then we can at least ensure we fail more gracefully when detecting HTTP/1.0 connections.

response payload

HTTP/1.0 426 Upgrade Required 
Upgrade: HTTP/1.1
Connection: Upgrade 
Content-Length: 53
Content-Type: text/plain 

This service requires use of the HTTP/1.1 protocol.

yoshuawuyts avatar Nov 05 '20 11:11 yoshuawuyts

chose to implement this with 505 http version not supported, since it's not properly an upgrade, in the sense of http upgrades

jbr avatar Dec 19 '20 03:12 jbr

@jbr oh yeah, that's entirely reasonable -- and with HTTP/1.0 support enabled by setting the host, there's definitely a clear path to "upgrading". Albeit through a somewhat more manual approach.

yoshuawuyts avatar Dec 24 '20 14:12 yoshuawuyts