hyperium / http

Rust HTTP types
Apache License 2.0
1.12k stars 283 forks source link

Request headers containing Russian (and possibly other non-English) characters fail with `UTF-8 encoding error` #706

Closed jamilbk closed 1 week ago

jamilbk commented 1 week ago

Having an issue where we send a user-agent header that includes the device OS, and http fails the request with UTF-8 encoding error.

An example offending user-agent header is:

Mac OS/Версия (arm64;23.5.0;) connlib/1.1.1

Using English works fine. As far as I can find, Russian and any other written language only use valid UTF-8 characters.

This is preventing some of our customers on non-English localized macOS systems from connecting.

Happy to spend some time to attempt a fix here, could you point us in the right direction?

Much appreciated!

jamilbk commented 1 week ago

Nevermind. I think the error message here should be US-ASCII encoding error as it seems that the HTTP/1.1 RFC calls for only US-ASCII characters in HTTP headers.