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

expose all HTTP headers #60

Closed
wants to merge 2 commits into from
Closed

expose all HTTP headers #60

wants to merge 2 commits into from

Conversation

niklasad1
Copy link
Member

@niklasad1 niklasad1 commented Jun 21, 2022

I'm not sure about how much overhead the allocations in HeaderMap will cause.

@@ -177,7 +168,7 @@ impl<'a, T: AsyncRead + AsyncWrite + Unpin> Server<'a, T> {

let path = request.path.unwrap_or("/");

Ok(ClientRequest { ws_key, protocols, path, headers })
Ok(ClientRequest { ws_key, protocols, path, headers: request.headers.to_vec() })
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, the headers is parsed from an array which is mutally borrowed so I had to clone it the headers unfortunately.

@niklasad1 niklasad1 changed the title expose all connection headers expose all HTTP headers Aug 9, 2022
@niklasad1 niklasad1 marked this pull request as ready for review August 9, 2022 14:38
resource: &'a str,
/// The HTTP headers.
headers: &'a [Header<'a>],
headers: Option<&'a HeaderMap>,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesn't makes sense to use httparse::Header to construct new headers, the type is used for parsed headers and doesn't check whether the header is valid or not.

however, it still possible to enter some conflicting headers such as host, websocket upgrade and similar as these are configured separately.

@niklasad1
Copy link
Member Author

We don't need this anymore as we are using the http/hyper layer which already is exposing the headers.

@niklasad1 niklasad1 closed this Oct 20, 2022
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

Successfully merging this pull request may close these issues.

1 participant