Skip to content
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

Closed
wants to merge 2 commits into from
Closed

feat: HTTP/2 support #1014

wants to merge 2 commits into from

Conversation

szmarczak
Copy link
Member

@szmarczak szmarczak commented Sep 1, 2021

WIP

  • PoC is working
  • unref session when 0 pending streams, ref on stream\
  • ...

}

try {
request.onConnect((err) => {
Copy link
Member Author

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) {
Copy link
Member Author

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?

Copy link
Member

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
Copy link
Member

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'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

experimental + disabled by default?

@ronag
Copy link
Member

ronag commented Sep 1, 2021

Maybe would be better to target @jasnell's node http3/quic branch? I'm not too comfortable with node core http2. nodejs/node#38233

@espoal
Copy link

espoal commented Sep 1, 2021

@ronag what's the issue with the core node HTTP/2?

@ronag
Copy link
Member

ronag commented Sep 1, 2021

@ronag what's the issue with the core node HTTP/2?

https://github.com/nodejs/node/issues?q=is%3Aopen+is%3Aissue+label%3Ahttp2

lifehome added a commit to lifehome/whmcs_stockchecker that referenced this pull request Sep 9, 2021
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.
lifehome added a commit to lifehome/whmcs_stockchecker that referenced this pull request Sep 11, 2021
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.
@ronag ronag force-pushed the main branch 2 times, most recently from a2ad318 to 904e045 Compare October 29, 2021 12:45
@ronag ronag force-pushed the main branch 3 times, most recently from dcb1656 to af20fdc Compare November 22, 2021 20:15
@ronag ronag force-pushed the main branch 2 times, most recently from 63eab1d to 47eb207 Compare December 12, 2021 12:27
@metcoder95 metcoder95 mentioned this pull request Apr 12, 2023
20 tasks
@nickserv
Copy link

nickserv commented Sep 8, 2023

Superseded by #2061

@mcollina mcollina closed this Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants