Skip to content

Hyper server violates HTTP/1.0 compatibility (keep-alive, transfer-encoding) #1304

@maghoff

Description

@maghoff

Hyper will answer an HTTP/1.0 request as if it were an HTTP/1.1 request. This includes the following violations:

  • Hyper server sets the response version to HTTP/1.1 even for HTTP/1.0 requests
  • Hyper server will enter into keep-alive mode without sending Connection: keep-alive to the client
  • Hyper server will use Transfer-Encoding: chunked regardless of client version

All of these items violate backwards compatilbility. An HTTP/1.1 server should be backwards compatible. Failing that I suggest that Hyper instead drops the connection, but I hope backwards compatibility could be achieved without too much trouble.

For keep-alive: HTTP/1.0 has support for parts of the keep-alive functionality, but for backwards compatibility it is sufficient to completely disable it when the request is of version 1.0.

For chunked transfer encoding: This is fundamentally not available in HTTP/1.0. However, streaming responses are possible by sending the body directly and terminating the TCP connection when completed. (This is a hopeless design, which is how we came to HTTP/1.1 in the first place)


Do we still need HTTP/1.0 compatibility? I stumbled onto this problem when benchmarking my server with apachebench, which only supports HTTP/1.0. Nginx also surprisingly defaults to using version 1.0 when talking to backend servers as a reverse proxy, though it can be configured to use HTTP/1.1 (and maybe even 2 these days?)


Are there workarounds? It is possible to run the server behind a reverse proxy that is correctly backwards compatible with clients, but still uses HTTP/1.1 to communicate with the backends. Nginx is an example of this. (If you configure it correctly)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-serverArea: server.C-bugCategory: bug. Something is wrong. This is bad!E-mediumEffort: medium. Some knowledge of how hyper internal works would be useful.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions