-
Notifications
You must be signed in to change notification settings - Fork 541
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 support #1014
feat: HTTP/2 support #1014
Conversation
} | ||
|
||
try { | ||
request.onConnect((err) => { |
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.
Should we call onConnect
immediately or on stream ready
event? https://nodejs.org/api/http2.html#http2_event_ready
session.ref() | ||
const stream = session.request(headers) | ||
stream.on('response', headers => { | ||
if (request.onHeaders(Number(headers[':status']), headers, stream.resume.bind(stream), '') === false) { |
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.
The handler expects an array but the native http2
module provides us with an object. What should we 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.
Convert to array
@@ -226,7 +226,7 @@ function processHeader (request, key, val) { | |||
) { | |||
throw new NotSupportedError('expect header not supported') | |||
} else { | |||
request.headers += `${key}: ${val}\r\n` | |||
request.headers[key] = val |
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.
This will make http1 slower... :/
@@ -29,6 +29,8 @@ function buildConnector ({ maxCachedSessions, socketPath, timeout, ...opts }) { | |||
const session = sessionCache.get(servername) || null | |||
|
|||
socket = tls.connect({ | |||
// TODO: @szmarczak: move this to client.js | |||
ALPNProtocols: ['h2', 'http/1.1'], |
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.
experimental + disabled by default?
Maybe would be better to target @jasnell's node http3/quic branch? I'm not too comfortable with node core http2. nodejs/node#38233 |
@ronag what's the issue with the core node HTTP/2? |
https://github.com/nodejs/node/issues?q=is%3Aopen+is%3Aissue+label%3Ahttp2 |
It's still a HTTP/1.1 client cuz nodejs is not HTTP/2 compatible at the time of this commit. See nodejs/undici#1014 for more details.
It's still a HTTP/1.1 client cuz nodejs is not HTTP/2 compatible at the time of this commit. See nodejs/undici#1014 for more details.
a2ad318
to
904e045
Compare
dcb1656
to
af20fdc
Compare
63eab1d
to
47eb207
Compare
Superseded by #2061 |
WIP