http-rs / http-rs/async-h1

gracefully fail HTTP/1.0 connections

Open
#152 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
166
Forks
49
PR merge metrics
No merged PRs in 30d

Description

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](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/426) 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
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.

```

Contributor guide

Open the contributing guide

Research direction

Start by locating where HTTP/1.0 connections are detected and where the current error is logged before the connection exits. Update that path to return the documented 426 response with the Upgrade, Connection, Content-Length, and Content-Type headers, then verify the response matches the issue payload.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.