-
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
Enforce limit on inflight keepalive bytes #419
Conversation
fetch.bs
Outdated
@@ -3122,10 +3122,17 @@ steps: | |||
|
|||
<li> | |||
<p>If <var>contentLengthValue</var> is non-null, <var>httpRequest</var>'s | |||
<a>keepalive flag</a> is set, and <var>contentLengthValue</var> is greater than a | |||
user-agent-defined maximum, then return a <a>network error</a>. | |||
<a>keepalive flag</a> is set: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/,/ and/
fetch.bs
Outdated
<ul> | ||
<li>Let <var>group</var> be <var>httpRequest</var>'s <a>client</a>'s <a>fetch group</a>. | ||
<li>Let <var>inflight keepalive bytes</var> be the sum of <a>request</a> <a>body</a>'s | ||
<a>total bytes</a> for each <a>record</a> in <var>group</var> whose <a>done flag</a> is unset. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get what you're trying to say, but this sentence does not read well. Maybe "sum of each X's Y in Z"?
I also think this is lacking some for=""
attributes since the request you're talking about here is that of the fetch group, as is the record.
fetch.bs
Outdated
<li>Let <var>inflight keepalive bytes</var> be the sum of <a>request</a> <a>body</a>'s | ||
<a>total bytes</a> for each <a>record</a> in <var>group</var> whose <a>done flag</a> is unset. | ||
<li>If the sum of <var>contentLengthValue</var> and <var>inflight keepalive bytes</var> is | ||
greater than 64KB, then return a <a>network error</a>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KiB, presumably? I wonder if we should use <abbr>
for the occasion.
@annevk ack, updated. I've split up the sum step.. hopefully that makes it more clear. |
You need to use I also think some steps can be grouped together again, but I'm happy to make that change later on. Is there someone else that can review this? And do we have tests for this somewhere? |
looks good |
To be clear, still need an update on the testing scenario. |
@annevk sorry, forgot about that. Are you looking for web-platform tests? No one has implemented this yet, so no, we don't have those.. yet. We (Chrome) are looking to implement this (and associated sendBeacon changes) in short order, so that should be resolved fairly soon. |
bump @annevk anything else I can help unblock on this one? |
I'm sorry. I totally forgot about this. Yeah I am looking for web-platform-tests. If they are being written as part of the implementation I suppose that might be sufficient, though not ideal. Perhaps a simple test can be added? We have a new policy where each standard PR also has a WPT PR and then the former lands after the latter. |
Thanks, I'll rebase this PR meanwhile. Tests can probably land pretty quickly if nobody else has feedback and my minor nits are fixed. |
Hmm, I'm not sure how to rebase this since you added the commits on master. |
The tests moved to web-platform-tests/wpt#4878. @igrigorik I'm still blocked on you sorting out how to rebase this. |
Requests with keepalive flag set are allowed to outlive the environment settings object. We want to make sure that such requests do not negatively impact the user experience when a page is unloaded, etc. This limits the amount of (body) bytes that can be inflight at any point when the request has the keepalive flag set; this flag is set by sendBeacon. Background: w3c/beacon#39
- split sum step into a for loop - added group definition - use KiB
@annevk apologies about the delay. Updated.. ptal. |
I made some formatting changes. Please review. Also note that we're currently blocked on speced/bikeshed#936. |
@annevk lgtm, good to merge once Bikeshed issue is resolved. |
@igrigorik also, it's fine filing bugs now we have an agreed upon standard change and tests. Can you do that? Just file a bug against everyone that hasn't implemented this with a pointer to this PR and the tests. |
AFAIK, Edge already has it implemented. |
We also need one for WebKit, right? |
@annevk indeed. Opened & updated the list above. |
I'd also appreciate one more final review since I had to make a couple more changes for Bikeshed. |
Took another scrub.. LGTM. |
Initial set of quota tests for keepalive fetch requests. See whatwg/fetch#419 for details.
Great, thanks for reporting the bugs! |
I don't suppose a different name for this could be used? Calling it "keepalive" is going to be confusing for some HTTP people... |
I don't think any code has shipped thus far, though Edge has implemented. So if we have a better name we could rename, but we'd have to be quick I think and @igrigorik should confirm. |
@mnot it's request level keepalive... which—I think—is a good semantic fit with what we're trying to communicate here. I don't think we have have to monopolize keepalive for connection level semantics; most developers will never touch connection keepalive. |
most developers will never touch connection keepalive That's a surprising assertion, but OK... |
One more possibly stupid question - why is this in |
No stupid questions. I don't think there's an observable difference and I suspect @igrigorik did it this way because the former already had a handle on the body size. |
Requests with keepalive flag set are allowed to outlive the environment
settings object. We want to make sure that such requests do not
negatively impact the user experience when a page is unloaded, etc.
This limits the amount of (body) bytes that can be inflight at any point
when the request has the keepalive flag set; this flag is set by
sendBeacon.
Background: w3c/beacon#39
Preview | Diff