Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we provided a way to keep the original header name case. #317

Open
IWANABETHATGUY opened this issue Jan 5, 2024 · 1 comment
Open

Comments

@IWANABETHATGUY
Copy link

IWANABETHATGUY commented Jan 5, 2024

  let mut headers = request.headers_mut();

  headers. append(
      "Host",
      HeaderValue::from_static("report-worker-2.noscription.org"),
  );

  headers.insert("User-Agent", HeaderValue::from_str("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36").unwrap());

dbg!(&header);

this code print:

[src/main.rs:41] &request.headers() = {
 
    "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
}

Some servers require the header name is case-sensitive, which may cause some server internal errors.

@IWANABETHATGUY IWANABETHATGUY changed the title Provide a way to keep the original header case. Can we provided a way to keep the original header case. Jan 5, 2024
@IWANABETHATGUY IWANABETHATGUY changed the title Can we provided a way to keep the original header case. Can we provided a way to keep the original header name case. Jan 6, 2024
@daniel-abramov
Copy link
Member

This sounds like an issue that is very similar (if not same) to snapview/tungstenite-rs#287

It's a bit complicated since that's how the underlying headers library behaved as far as I can recall. We'd need to find a workaround (essentially a kludge) if we want to make it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants