fix: force HTTP/1.1 via ALPNProtocols to prevent h2 framing mismatch

api.spotify.com negotiates HTTP/2 via TLS ALPN but https.request uses
HTTP/1.1 framing — the protocol mismatch silently hangs the connection.
wget on Alpine doesn't advertise h2 so it works fine. ALPNProtocols:
['http/1.1'] forces HTTP/1.1 on both ends.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
HoneyandClaude Sonnet 4.6 committed 2026-05-10 18:01:12 +02:00
1 parent d2cb1bed68
commit bb52717c95
1 file changed
+3
+3
View File
@@ -78,6 +78,9 @@ function _fetchTimeout(url, opts = {}, ms = 10000) {
hostname: u.hostname, port: 443, hostname: u.hostname, port: 443,
path: u.pathname + u.search, path: u.pathname + u.search,
method: opts.method || 'GET', method: opts.method || 'GET',
// Force HTTP/1.1 — api.spotify.com negotiates h2 via ALPN but
// https.request uses HTTP/1.1 framing, causing a silent hang.
ALPNProtocols: ['http/1.1'],
headers: { headers: {
'User-Agent': 'NovaSonic/1.0', 'User-Agent': 'NovaSonic/1.0',
'Accept': 'application/json', 'Accept': 'application/json',