spinframework / spinframework/spin

rust sdk: Inbound http inconsistency with `wasmtime serve`

Open
#2,032 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

sdk
Dominant language
Rust
Stars
6.5k
Forks
310
Avg merge
1d 20h
Merged PRs (30d)
24

Description

From https://github.com/fermyon/http-auth-middleware/pull/4#issue-1973344440

I believe this is due to the Rust SDK's conditional reconstruction of the full URI:

https://github.com/fermyon/spin/blob/1f7cc3f54a2c8d96a24767bfcaa93ebc3b8982f5/sdk/rust/src/http.rs#L450-L464

If scheme and/or authority is missing, this will return just the path.

While technically a URI must have a scheme and authority, it appears that http::Request::uri (amongst others) produces just a path for inbound requests on many servers.

For compatibility reasons I think we should align with that for inbound wasi-http, though it will be annoying to adjust the conversions.

Contributor guide

Open the contributing guide

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

Start with sdk/rust/src/http.rs at lines 450-464 and review the linked http-auth-middleware report. Trace the inbound wasi-http URI conversion and its related conversions to determine how requests lacking a scheme or authority are represented. Done means inbound behavior is compatible with the expected path-only form without breaking full URIs.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.