-
Notifications
You must be signed in to change notification settings - Fork 539
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
http2 demo not working as expected #2257
Comments
maybe a "forceH2" option is needed? |
technically it should use http2 if alpn says it's available |
I need to dig deeper into it, but the bug is quite peculiar. The ALPN negotiation was successful, and the socket has been connected through |
I also find smaller improvements that I'll push soon. I'll try to dig deeper soon into this to see if I can find the root cause |
nvm, find the issue 😓 |
setGlobalDispatcher(new Agent({
allowH2: true
}))
// Not working as expected
// the request is done using HTTP/1.1
const res1 = await fetch(`https://http2.pro/api/v1`)
console.log(await res1.json()) This part does not work properly because Agent uses lib/pool.js, and allowH2 is not passed here. The relevant logic is in Lines 53 to 62 in 9fa8224
And Lines 21 to 25 in 9fa8224
Client will be used only if connections is set to 1, otherwise Pool will be used, so you need to set connections: 1 (I don’t know if it is reasonable) setGlobalDispatcher(new Agent({
allowH2: true,
connections: 1
})) |
Consider the following:
The text was updated successfully, but these errors were encountered: