-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactoring WebSocket connections #1243
Comments
CC’ing @letitz because the DNS discussion is also related to WICG/private-network-access#51 My hope in avoiding is largely a proximity of the complexity it introduces, and because of the handwave “magic happens here” part of the composability of different protocol layers.
I do think you’re right that we need some aspect of handwave to “turn this host into a collection of IP addresses”, which can then be accounted for in things like WebSockets or private network access, but specifying it in a way in which these differences continue to remain valid/opaque alternatives, and not accidentally specifying a linear sequence that MUST be followed, is the tricky part. That said, I think your proposed approach generally sounds workable. One bit of challenge for Chromium is that we don’t (generally) think of dedicatedness as an explicit input parameter. In general, we want a new connection, either with a particular protocol version (e.g. if an H/2 server wants to use TLS Client cert auth or NTLM/Negotiate and responds with HTTP_1_1_REQUIRED, or situations like WebSockets where H/2 may not be allowed widely), or explicitly reusing the current connection (e.g. completing the third leg of an NTLM/Negotiate handshake). While in the current proposal, I think the existing implementation would conform with your rough proposed language, I worry if there might end up being impedance mismatches if that parameter gets reused elsewhere. |
Here's a hypothetical privacy attack on a non-partitioned side-table:
This permits evil.com to associate the two sessions. Is this a privacy attack we need to worry about? |
@ricea: Yes, I think that attack is exactly the sort of thing network partitioning is intended to mitigate. |
Here's a sketch for resolve a domain:
Picking an IP address from this set to obtain a connection from can be done in an implementation-defined manner. I suppose the WebSocket connection steps would compare each IP address against existing WebSocket connection IP addresses. @sleevi how does WebSocket obtain a new-or-existing connection in Chromium with that setup then? We have the dedicated parameter for WebTransport. It seems like WebSocket needs it as well, though in a more limited way. I'm not aware of anything else needing it. @ricea thanks! I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1713748 to track that in Firefox. My proposal is that we use the network partitioning key, but the way Chrome defines that key it would be far less successful at avoiding the DOS concerns this cache was meant to address, I think. Not sure to what extent that's a problem. |
This would be useful for Fetch to define a couple more aspects of connections. Context: whatwg/fetch#1243.
Chrome uses a separate pseudo-socket pool for non-H2/H3 WebSocket connections, which enforces WebSocket connection limits (And uses slightly different connection attempt ordering rules in the case of multiple IP addresses for a single DNS lookup, since WebSocket enforces limits on a per-IP-address basis, I believe). Chrome never repurposes an HTTP/1.x socket for use with WebSockets. For H2 WebSocket connections, it looks for an existing H2 connection that supports WebSockets to the corresponding origin. |
This would be useful for Fetch to define a couple more aspects of connections. Context: whatwg/fetch#1243.
In particular, define resolving domains and allow connection creation to be a race. As a result this also inlines some of the time capture moments to be directly inside the obtain a connection algorithm. This helps with #1243.
In particular, define resolving domains and allow connection creation to be a race. As a result this also inlines some of the time capture moments to be directly inside the obtain a connection algorithm. This helps with #1243.
This is a further incremental step toward making it possible to properly layer WebSocket connections on top of this primitive (see #1243). WebTransport PR: w3c/webtransport#351.
The objective is to make WebSocket connections hook into "obtain a connection" to make it clear what logic is shared.
There are two problems:
dns-prefetch
, but I recall @sleevi hoping we could avoid it.We could side step some of the first problem by changing the monkey patching in "obtain a WebSocket connection", but that does not seem like a good long term solution.
This came out of a discussion in #1241 which had a rather optimistic-and-wrong take on what sharing more logic would mean. As I envision it now we would keep the "obtain a WebSocket connection" operation, but we'd pass it a partition key as well, inline the relevant bits from the RFC as outlined above, and make it use "obtain a connection".
If this seems like a good plan I will make time to work on this. (I would like to solve this before #889 and #1118.)
cc @ddragana @MattMenke2 @ricea @yutakahirano
The text was updated successfully, but these errors were encountered: