-
Notifications
You must be signed in to change notification settings - Fork 30k
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
tls: Add support for ALPN fallback when no ALPN protocol matches #45075
Conversation
Review requested:
|
c906151
to
de6f3d5
Compare
de6f3d5
to
eccdfd0
Compare
This PR conflicts with #44875 (sorry, I thought it'd been merged) and since that PR optimizes the common case and this PR adds an uncommon case, I'm going to have to ask you to rebase on top of that. I would have asked you to take another approach anyway because |
@@ -2042,6 +2045,11 @@ changes: | |||
e.g. `0x05hello0x05world`, where the first byte is the length of the next | |||
protocol name. Passing an array is usually much simpler, e.g. | |||
`['hello', 'world']`. (Protocols should be ordered by their priority.) | |||
* `allowALPNFallback`: {boolean} If `true`, if the `ALPNProtocols` option was | |||
set and the client uses ALPN, but requests only protocols that are not do |
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.
Awkwardly structured sentence / grammar here.
->Get(env->context(), env->allow_alpn_fallback_string()) | ||
.ToLocalChecked() | ||
.As<Boolean>() | ||
->Value(); |
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.
As @bnoordhuis mentions, this is going to be slow. Definitely should avoid uses of ->Get(...)
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.
I'm not very familiar with the JS/C++ interface. What's the preferred way to set a value from the JS TLS wrap such that it's directly accessible here?
If I create a new private field & setter on the C++ wrap, call that from JS in setup, and then read w->allow_alpn_fallback
here instead of these calls, is that a) idiomatic and b) sufficiently performant?
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.
Yes and yes. :-)
Happy to do the final rebase & changes here, but I'm going to wait for a conclusion on the the callback question in #45056 (comment) first, since that would invalidate this. |
Fixes #45056.