http-rs / http-rs/http-types

Non ASCII header values causes panic

Open
#519 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
209
Forks
91
PR merge metrics
No merged PRs in 30d

Description

I came here via an unexpected panic in my [tide webserver](https://github.com/http-rs/tide/), but I think the problem belongs here.
When I'm using a cookie that might be a bit "odd" like `password=Â` , the calling library (async-h1 or tide) is calling `append_header` from request.rs, then `append` and `insert` within the headers/headers.rs file to set that header. On line 54 it says:
`let values: HeaderValues = values.to_header_values().unwrap().collect();`
which fails and panics with a `Result::unwrap() on an Err value: String slice should be valid ASCII`.
I think those functions should have a result of type `Result` if these functions can fail in such circumstances.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.