-
Notifications
You must be signed in to change notification settings - Fork 177
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(http_server): in http2 host is not passed in headers #866
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, we haven't really tested and targeted HTTP2
yet.
However, I'm not sure if hyper rejects HTTP requests without the host header
for HTTP1.1 so
I would prefer to check that request.version() == Version::HTTP_2
and then disable the host filtering.
/cc @lexnv another reason to get rid of the access control stuff in favor of tower http
:P
Wouldn't that be a security flaw? http server supports both protocols over the same port, so skipping the check would create a way to get around access control restrictions. |
I didn't mean to disable host filtering just use the host from the URI as you did before (I see my explanation was bad): let host = match http_helpers::read_header_value(request.headers(), "host") {
Some(host) => host,
None if request.version() == Version::HTTP_2 => request.uri().host(),
None => return response::malformed(),
}; so I think it was possible to circumvent the access control in your code if hyper doesn't reject a |
fa3b653
to
d71193d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for contributing!
dumb question: I can't find anything regarding that I tried a simple request with cURL and it indeed works: http2 request
server
To conclude we need some tests for http2 as well which can be done in another PR. |
Not a http2 request. In your own output it shows version HTTP/1.1. To make a http2 request with curl you have to add |
In http2 host is not passed in headers which leads to this function always returning None and all http2 requests erroring with
Parse error
.