-
Notifications
You must be signed in to change notification settings - Fork 546
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
feat: HTTP/2 #866
feat: HTTP/2 #866
Conversation
Good luck :) |
Codecov Report
@@ Coverage Diff @@
## main #866 +/- ##
===========================================
- Coverage 100.00% 99.95% -0.05%
===========================================
Files 26 26
Lines 2105 2108 +3
===========================================
+ Hits 2105 2107 +2
- Misses 0 1 +1
Continue to review full report at Codecov.
|
Might sound naive but does anybody know an easy way to test an upgrade from |
I don't have a clue... maybe @jasnell do. |
@metcoder95 What security layer are you talking about? |
@szmarczak I was referring that trying to visit an HTTP2 website forces you to go under TLS, but I'm trying to test the upgrade from HTTP/1.1 to HTTP/2 with |
If you're running h2c then you don't need TLS |
6679898
to
4b5ed0b
Compare
Yes sure. I'm aware of that, I was just asking if there's any open server or tool where I can do upgrades by |
How the |
Just out of curiosity, after the Sorry for taking some time, I've been having rush days, I'll try to start being more concurrent next week :) |
You should bypass all of that. llhttp does not support http2. |
Got it, just to understand once for all, reading at the issue from where this PR comes out, I do agree with all the points stated there (mostly how HTTP/2 is quite more like a transition), then my question is, what and how do we achieve HTTP/2 support? Besides Or maybe use The full topic is quite interesting but I do agree with the points explained in the issue 😄 |
You should use http2 from node internals. |
I don't think we need to write another parser. It's already provided by Node.js, which is a good start. The thing is that when using If I'm missing something, then it may be easier to write another parser. /cc @ronag HTTP/2 is way more complicated than HTTP/1 so it will take definitely more time than implementing HTTP/1. |
Actually, for those scenarios, I was asking for. This also includes, e.g. checks for prior requests if an HTTP 101 is response before the upgrade of protocols.
Hmm, correct me if I'm wrong please but I think an HTTP/1.1 101 will be the response and the next exchange of data should be in the HTTP/2 protocol. Then we can "pipeline" the connection to the native module, or I'm way far?
Agree |
Yeah but you need to accept the response in HTTP/2 somehow without the request in HTTP/2. But the actual request is via HTTP/1. So we need to create a stream that has been already sent and is awaiting response. |
I would recommend we focus on supporting http/2 -> http/2 before working on upgrade paths. @jasnell have you done any research on implementing the upgrade in nodejs? |
All information required to implement the upgrade has been summarized in the original PR, before I handed off the project.
Didn't we already discuss that being an idea that is somewhat antithetical to undici's purpose? |
It seems like this PR was opened solely to get around not having write permissions for the branch of the other PR. Instead of making a duplicate, if you'd like @metcoder95 I can add you to the branch? I'm noticing a lot of lost information and repeated discussion due to the conversations from the old PR being neglected, so that's my main concern here. |
I don't see anyone agreed to write a HTTP/2 parser from scratch.
I'd rather take that 20% |
That's what was started here. It's necessary to parse HTTP/2 transport frames in order to successfully carry out the upgrade, so we'd have to parse the frames for the upgrade anyway.
Once again, we have to do most of it anyway. It wouldn't be too much extra effort to complete it for the performance boost. After all, undici's goal is to provide a fast alternative to native. |
By using the Node.js internal module? Then a wrapper?
Thanks! Actually, from the original PR, I'm basing most of the assumptions I'm doing on how the API should look, but the issue comes the way how we need to parse the frames from HTTP/2, which is where the topic gets complicated.
Yeah, sure, no issue. Is better to merge all the conversations into a single place 👍 If I can add my two cents here with my limited knowledge, I think that we should re-defined a little bit the scope of what we want to achieve. It is just to add support for the upgrade with a wrapper around the Node |
I invited you to the repository, so you'll be able to make changes @metcoder95. |
5d7e3e4
to
d684ce0
Compare
Inherited from #720
This relates to...
HTTP/2-3 #399
Rationale
HTTP/2 support is one of the few things currently missing from Undici
that sets it behind native Node http.
Changes
This pull request is a work in progress. There are no changes just
yet. The plan, however, as discussed in the original issue, is to
implement HTTP/2 support around a Dispatcher instance for Pool,
Client and Agent.
Implementation can work in one of the following ways (see RFC7540 and
RFC8740):
Prior knowledge
Under RFC7540 Section 3.5, the HTTP/2 connection preface must be sent
All future frames may immediately use the HTTP/2
HTTP/1.1 Initialization (servers where HTTP/2 support status is unknown)
Without prior knowledge, the client should start an HTTP/1.1 connection
using the Upgrade header (h2c for http URI schema, h2 for TLS) and
HTTP2-Settings header
will be accompanied by a response to prior requests and the connection can
upgrade to HTTP/2. If the response is normal, exempli gratia, a HTTP 200 OK,
the client must not switch to HTTP/2.
As for HTTPS, TLS negotiation must occur prior to any upgrade to HTTP/2.
Features
HTTP/2 variants of Pool, Client and Agent. Alternatively, an option in the
aforementioned classes that causes them to attempt a HTTP/2 upgrade.
Bug Fixes
N/A.
Breaking Changes and Deprecations
N/A.
##Status
KEY: S = Skipped, x = complete