Closed anandsuresh closed 7 years ago
When there are no NPN
and no ALPN
- fallback should be used. That's why we have fallback! 😉
@indutny Have sent you an email with more details. Perhaps I'm not understanding the use-case correctly or have done a bad job at explaining the issue? ;)
@indutny This patch is to address the case where a client with NPN extensions attempts to connect to a server with ALPN extensions. Since there is no way the client and server can successfully negotiate a protocol, this patch allows the developer to specify one. In the event, one isn't provided by the developer, then the Agent activates fallback. Does that make sense?
@indutny Just confirmed the case described above with node v6.7.0. node-spdy selects the h2
protocol correctly, now that its running on a version of node that supports ALPN. But on node v4, it activates fallback because the client and server don't have a common extension to allow the selection of the application-level protocol.
I'm convinced now, sorry for not understanding it at first.
Just a few changes before this will be ready to land.
Fixed as requested!
Landed in 74d8268, thank you! Would you care to open an issue for writing a test for this?
On older versions of node with no ALPN support,
socket.npnProtocol
is returned asundefined
, resulting in the activation of fallback mode. This commit allows for falling back to a user-defined protocol in case NPN/ALPN extensions aren't available.