-
Notifications
You must be signed in to change notification settings - Fork 375
Description
What is the issue with the Fetch Standard?
Fetch allows setting method to "CONNECT", a concept requiring filling in pseudo-headers in H2/H3, which isn't done, so WebTransport has to hand-wave about it:
Set request’s method to "CONNECT", and set the method’s associated pseudo-headers as follows:
:protocolto "webtransport",:scheme,:authority, and:pathfrom request’s URL.
WT can do so ahead of fetch because H2/H3 is a requirement, but other protocols like WebSocket use extended CONNECT for H2/H3 as well but also has to work with H1.1. whatwg/websockets#70
Pseudo-headers are protocol-specific and probably shouldn't be exposed to JS Request as regular headers.
One option might be a new connect-protocol internal slot on request. But we already have mode (which already drives the Origin rule), so HTTP-network fetch might already have all the information it needs to fill in these fields correctly once it knows what kind of connection it got. Something like:
- If request’s method is "CONNECT", request’s mode is "webtransport" or "websocket", and connection is using HTTP/2 or HTTP/3, then
- Wait for SETTINGS from the server
- If SETTINGS_ENABLE_CONNECT_PROTOCOL is not "1", return failure
- Encode the request as extended CONNECT and include pseudo-headers:
:method = CONNECT, :protocol = request’s mode, and :scheme, :authority, :path from request’s URL - Do not send Connection/Upgrade fields