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

Add an http1_only configuration for the server #1512

Closed
seanmonstar opened this issue May 10, 2018 · 3 comments
Closed

Add an http1_only configuration for the server #1512

seanmonstar opened this issue May 10, 2018 · 3 comments
Labels
A-server Area: server. C-feature Category: feature. This is adding a new feature. E-easy Effort: easy. A task that would be a great starting point for a new contributor.

Comments

@seanmonstar
Copy link
Member

The default server now supports both HTTP/1 and 2 automatically. Just like there is an option to set http2_only, there should probably also be an http1_only option, if for some reason someone didn't want to allow HTTP2 support.

@seanmonstar seanmonstar added A-server Area: server. E-easy Effort: easy. A task that would be a great starting point for a new contributor. C-feature Category: feature. This is adding a new feature. labels May 10, 2018
@ubnt-intrepid
Copy link
Contributor

ubnt-intrepid commented Jun 3, 2018

When the http1_only mode is added, the behavior when the argument of http2_only(enabled) is false becomes undefined (there are two possible modes whether the fallback is required or not).

It seems to be better to separate the configuration for the protocol (using HTTP/1 or HTTP/2) and upgrading (to enable/disable the fallback to h2 when using h1).

@seanmonstar
Copy link
Member Author

I actually think all cases make sense, even though they may conflict with each other. Trying to set http1_only(true) and http2_only(true) would of course be invalid. It could be asserted, or it could simply take the latter call.

Though, separating them could also work.

@ubnt-intrepid
Copy link
Contributor

I've just created an PR for resolving this issue, just adding http1_only to Connection and Builder.

The flag field http2 in the struct Http has replaced with an enum which has three modes (http1_only, http2_only and fallback).
When http2_only(false) or http1_only(false) are called, the inner mode is set to "fallback".

seanmonstar pushed a commit that referenced this issue Jun 4, 2018
A new configuration http1_only to Builder and Connection are added, which indicates that the upgrading to h2 does not perform when a parsing error occurs.

Fixes #1512.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-server Area: server. C-feature Category: feature. This is adding a new feature. E-easy Effort: easy. A task that would be a great starting point for a new contributor.
Projects
None yet
Development

No branches or pull requests

2 participants