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

fix(server): host filter via URI read authority #1178

Merged
merged 1 commit into from
Aug 10, 2023

Conversation

niklasad1
Copy link
Member

It is possible that the HOST is sent via the URI and when that is the case the server should read the Authority (host:port) not only the host

It is possible that the HOST is sent via the URI and when that is the case
the server should read the `Authority (host:port)` not only the host
@niklasad1 niklasad1 requested a review from a team as a code owner August 10, 2023 08:28
/// such that we must check both.
pub(crate) fn fetch_authority(request: &hyper::Request<hyper::Body>) -> Option<&str> {
let host_header = http_helpers::read_header_value(request.headers(), hyper::header::HOST);
let uri = request.uri().authority();
Copy link
Member Author

@niklasad1 niklasad1 Aug 10, 2023

Choose a reason for hiding this comment

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

This is fix and mainly regards HTTP2 but could be some other edge-case as well.

Thus, if one would enable a filter for port X and the request is targets port X but it's not read and would regarded as the default port if just the host is read i.e, not the port

@niklasad1 niklasad1 merged commit 55010af into master Aug 10, 2023
@niklasad1 niklasad1 deleted the na-server-fix-read-authority branch August 10, 2023 12:37
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.

3 participants