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

Separate HTTP 1 and HTTP 2 into separate dispatchers #2814

Closed
ronag opened this issue Feb 22, 2024 · 3 comments
Closed

Separate HTTP 1 and HTTP 2 into separate dispatchers #2814

ronag opened this issue Feb 22, 2024 · 3 comments
Labels
enhancement New feature or request H2 Pull requests or issues related to HTTP/2

Comments

@ronag
Copy link
Member

ronag commented Feb 22, 2024

It seems to me a bit forced to try to have http2 logic inside the http 1.1 client. I think it might make sense to move shared stuff up one level and separate these into a HTTP1Client and HTTP2Client.

@ronag ronag added the enhancement New feature or request label Feb 22, 2024
@ronag ronag changed the title Separate HTTP 1.1 and HTTP 2 into separate dispatchers Separate HTTP 1 and HTTP 2 into separate dispatchers Feb 22, 2024
@metcoder95
Copy link
Member

Hmm, it sounds doable; but how do we handle the fact that we start the negotiation in the same way, it might seem counterintuitive to have to decide whether to use one or the other depending on the ALPN step.

A couple of things can bring some light on this, e.g., if not using TLS we cannot even try an H2 request, or if the flag is disabled, we do not do that.

One thing that can work is to remove the writeH2 and scope it to a mid-term dispatcher; that, if ALPN states to use H2 we simply use it instead, and pass the socket (pretty much as you opened PR, but the control is passed to that dispatcher, and the main dispatcher just passes the handler)

@mcollina
Copy link
Member

+1 to the idea

@ronag
Copy link
Member Author

ronag commented Feb 23, 2024

I tried an alternative approach to more clearly separate the logic #2816

@metcoder95 metcoder95 added the H2 Pull requests or issues related to HTTP/2 label Mar 8, 2024
@ronag ronag closed this as completed Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request H2 Pull requests or issues related to HTTP/2
Projects
None yet
Development

No branches or pull requests

3 participants