http-rs / http-rs/surf

Panic on some websites with async-h1 backend: "String slice should be valid ASCII"

Open
#284 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.5k
Forks
128
PR merge metrics
No merged PRs in 30d

Description

On some websites, e.g. http://futureuae.com, surf panics fails with the following error:

> thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: String slice should be valid ASCII

Firefox and curl work fine.

463 websites out of the top million from [Feb 3 Tranco list](https://tranco-list.eu/list/3G6L) are affected.

Tested using [this code](https://github.com/Shnatsel/rust-http-clients-smoke-test/blob/f206362f2e81521bbefb84007cdd25242f6db590/surf-smoke-test/src/main.rs). Test tool output from all affected websites: [surf-should-be-valid-ascii.tar.gz](https://github.com/http-rs/surf/files/6054734/surf-should-be-valid-ascii.tar.gz)

The root cause might be in some dependency and not in surf itself. But the backtrace is useless due to async, and the error message doesn't even point to the line where the panic happens, so I'm reporting it here.

I've only tested the async-h1 backend; I don't know if the other bakends are affected.

Contributor guide

Open the contributing guide

Research direction

Start with the linked surf-smoke-test/src/main.rs and reproduce the panic against futureuae.com using the async-h1 backend. Inspect the reported String slice should be valid ASCII failure and the supplied affected-sites archive; done means affected sites no longer panic, with coverage for the failure case.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.