fix(phoenix-channel): replace all non-ASCII chars in user agent (#9725)

HTTP headers only reliably support ASCII characters. We include
information like the user's kernel build name in there and therefore
need to strip non-ASCII characters from that to avoid encoding errors.

Fixes: #9706
This commit is contained in:
Thomas Eizinger
2025-06-30 17:20:55 +02:00
committed by GitHub
parent 178a9da24d
commit b01984addb

View File

@@ -825,6 +825,8 @@ fn make_request(url: Url, host: String, user_agent: String) -> Request {
OsRng.fill_bytes(&mut r);
let key = base64::engine::general_purpose::STANDARD.encode(r);
let user_agent = user_agent.replace(|c: char| !c.is_ascii(), "");
Request::builder()
.method("GET")
.header("Host", host)