-
Notifications
You must be signed in to change notification settings - Fork 18
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
Don't use H2 detection preflights & caching in Node versions where it's not required #49
Comments
If you mean Lines 63 to 64 in 10ee5ff
then yes.
If you know that the server supports HTTP/2 then there's no point in using
That's not possible. Agent creates a new session on every option change: Lines 12 to 45 in 10ee5ff
|
I don't know in advance if the server supports HTTP/2, and I do need In the case where you use With this bug fixed, that's not strictly necessary. We could do a single TLS handshake, and then decide whether to do HTTP/1 or HTTP/2 afterwards, without creating a new socket, similar to what the HTTP/1 HTTPS connections already do with This isn't a big problem, but it does seem a bit wasteful to make the connection twice if we don't need to.
In my case the options aren't changed. I make exactly the same request, and in some tests it goes to an H1-only server, and in some tests it goes to an H2-only server. With http2-wrapper that second request fails. This is because I have different tests that use many different mock servers, but which often share the exact same URL (because they're test servers, and they just use the first localhost port that's free). |
http2wrapper.auto.protocolCache.clear();
Yes, this will be fixed in an upcoming release. |
Neat, that's definitely helpful, thanks 👍.
Ok, amazing! That's what I'm proposing really, great to hear that that's planned. Are there details anywhere on how that'll work? Will it work for Node < 14.3 too? |
I haven't looked deeper into this. |
Fair enough. Let me know if there's anything I can do to help. |
Done 27d437a although there are still some things to address:
|
If I have the time then I'll do another beta release (so many of them already! :P) this weekend. |
Amazing, thanks! Definitely looking forward to the next release, great work 👍 |
Actually I'm not sure if it's be possible to reuse TLS sockets for HTTP/2. See nodejs/node#35475 |
nodejs/node@75202d9 we just need to wait for an actual release |
Node.js v15.1.0 just got released, it should be possible to fix this issue now. |
Meh, nodejs/node#35981 |
Node.js v15.3.0 was released yesterday, I'll try to fix this ASAP. |
Fixed on master. Node.js v15.3.0 is required for HTTP/2 socket reuse. I'll try to make a release this weekend. |
I still keep finding new Node.js bugs hehe :P nodejs/node#34854 |
As far as I can tell, the TLS preflight requests and detected protocol caching in https://github.com/szmarczak/http2-wrapper/blob/master/source/auto.js exists purely because of nodejs/node#33343. Is that right?
This bug doesn't exist in many of the recent Node versions (e.g. in my case I'm using Node 14.6). It would be nice to skip all that logic in those cases. That has two main benefits:
I've added some notes on the node issue about the fix. I think this is unnecessary from Node 14.3+, and I'm hopeful we can get it sorted in an v12 release sometime soon too. What do you think?
The text was updated successfully, but these errors were encountered: