| 2360 | }, |
| 2361 | |
| 2362 | onResponseError (_controller, error) { |
| 2363 | if (this.abort) { |
| 2364 | fetchParams.controller.off('terminated', this.abort) |
| 2365 | } |
| 2366 | |
| 2367 | if ( |
| 2368 | request.mode === 'websocket' && |
| 2369 | allowH2 !== false && |
| 2370 | error?.code === 'UND_ERR_INFO' && |
| 2371 | error?.message === 'HTTP/2: Extended CONNECT protocol not supported by server' |
| 2372 | ) { |
| 2373 | // The origin negotiated H2, but RFC 8441 websocket support is unavailable. |
| 2374 | // Retry the opening handshake on a fresh HTTP/1.1-only connection instead. |
| 2375 | resolve(dispatchWithProtocolPreference(body, false)) |
| 2376 | return |
| 2377 | } |
| 2378 | |
| 2379 | this.body?.destroy(error) |
| 2380 | |
| 2381 | fetchParams.controller.terminate(error) |
| 2382 | |
| 2383 | reject(error) |
| 2384 | }, |
| 2385 | |
| 2386 | onRequestUpgrade (controller, status, headers, socket) { |
| 2387 | // We need to support 200 for websocket over h2 as per RFC-8441 |