Skip to content

Commit

Permalink
fix: protocol determination
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-guggisberg committed May 18, 2023
1 parent 42cdda4 commit 8f50fa5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/core/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ const determineProtocol = async (ctx, url, signal) => {
case 'http:':
// for simplicity, we assume unencrypted HTTP to be HTTP/1.1
// (although, theoretically, it could also be plain-text HTTP/2 (h2c))
return { ALPN_HTTP1_1 };
return { protocol: ALPN_HTTP1_1 };

case 'http2:':
// HTTP/2 over TCP (h2c)
return { ALPN_HTTP2C };
return { protocol: ALPN_HTTP2C };

case 'https:':
// need to negotiate protocol
Expand All @@ -142,7 +142,7 @@ const determineProtocol = async (ctx, url, signal) => {
if (ctx.alpnProtocols.length === 1
&& (ctx.alpnProtocols[0] === ALPN_HTTP1_1 || ctx.alpnProtocols[0] === ALPN_HTTP1_0)) {
// shortcut: forced HTTP/1.X, default to HTTP/1.1 (no need to use ALPN to negotiate protocol)
return { ALPN_HTTP1_1 };
return { protocol: ALPN_HTTP1_1 };
}

// lookup ALPN cache
Expand Down

0 comments on commit 8f50fa5

Please sign in to comment.