hyperium / hyperium/http

Should http::Request have a canonical form?

Open
#393 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.4k
Forks
378
Avg merge
1d 21h
Merged PRs (30d)
5

Description

Currently, libraries that use http::Request have 2 different ways to represent a request, dependent on the expected usage (client or server). This seems confusing, and I'd like to discuss if this is something that needs to be changed.

Most notably: It seems that absolute URIs are used in client contexts. But it server contexts, relative URIs with Host header are used. I propose that instead, the type should have a canonical representation that is valid in any context.

(Ideally, the canonical representation should be the only representation that is buildable, but this is a separate discussion.)

Practically, I think that using relative URIs is best, because it allows HTTP/1.0 requests where the Host header was not required. However, this requires the addition of a "scheme" field because this is currently stored in the uri field in client contexts.

What are the thoughts about this and the potential changes that it would require?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

This is an unresolved design discussion about making http::Request canonical across client and server contexts. Start by reviewing the current request representation, especially absolute versus relative URIs, the Host header, and where the scheme is stored. There are no files or tests named; done would require an agreed design and corresponding changes to the type and its callers.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design, networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.