http2-wrapper icon indicating copy to clipboard operation
http2-wrapper copied to clipboard

Support HTTPS servers without HTTP/2 support in auto.js

Open tgambet opened this issue 1 year ago • 0 comments

While running some requests through got using http2-wrapper I stumbled upon the following error when requesting websites that support SSL but do not seem to support HTTP/2. Edit: I believe it might be related to redirects.

Protocol "https:" not supported. Expected "http:"

The culprit seems to be this line:

https://github.com/szmarczak/http2-wrapper/blob/f1a1776d4b1aef1cd47d55b1a950986e86145a09/source/auto.js#L220

Changing it to

return delayAsyncDestroy((isHttps ? https : http).request(options, callback)); 

fixed the issue for me.

Have someone else been affected by this error ? Is it the correct fix ?

tgambet avatar Feb 12 '24 20:02 tgambet