Skip to content
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

Add HTTP fetch step on 421. #1141

Merged
merged 2 commits into from
Mar 5, 2021
Merged

Add HTTP fetch step on 421. #1141

merged 2 commits into from
Mar 5, 2021

Conversation

yoichio
Copy link
Contributor

@yoichio yoichio commented Jan 20, 2021

(See WHATWG Working Mode: Changes for more details.)

Fixes #497, #982


Preview | Diff

@annevk
Copy link
Member

annevk commented Jan 21, 2021

Do we also want to do this if the service worker returns a 421 or only if the network returns one? We should probably have test coverage either way.

Also, I think we should cover what should happen for a non-streaming request.

Could you also restore the pull request template?

@yoichio
Copy link
Contributor Author

yoichio commented Jan 25, 2021

Do we also want to do this if the service worker returns a 421 or only if the network returns one?

Both Chrome and Firefox retry only if the network returns 421.

Also, I think we should cover what should happen for a non-streaming request.

Chrome does this retry during "7.3. Set response to the result of making an HTTP request over connection using request" in 4.6. HTTP-network fetch.
How might we write it down ?

We should probably have test coverage either way.

Sure.

Could you also restore the pull request template?

Done.

@annevk
Copy link
Member

annevk commented Jan 25, 2021

In https://fetch.spec.whatwg.org/#http-network-or-cache-fetch we have checks for 401 and 407. I think we should handle 421 there as well, in a similar manner. This means that if a service worker creates a 421 the API will see it. Is there any kind of limit on the number of retries?

@yoichio
Copy link
Contributor Author

yoichio commented Jan 26, 2021

Though fetch event is captured by a service worker or not, HTTP-network fetch retries only once.

@yutakahirano
Copy link
Member

The PR description is copied from elsewhere. Please update it.

@yoichio
Copy link
Contributor Author

yoichio commented Jan 26, 2021

The PR description is copied from elsewhere. Please update it.

What kind of update is needed?

@yoichio
Copy link
Contributor Author

yoichio commented Jan 26, 2021

Updated #http-network-or-cache-fetch after 407 checking. PTAL.
I'm not sure how we can limit the retry only once.

@yutakahirano
Copy link
Member

https://crbug.com/1167013 is a different bug.

"N/A as streaming request body has not been implemented" is incorrect for this change because "we should cover what should happen for a non-streaming request."

@yoichio yoichio changed the title Make HTTP fetch rejecting a streaming upload request on 421. Add HTTP fetch step on 421. Jan 26, 2021
@yoichio
Copy link
Contributor Author

yoichio commented Jan 26, 2021

Updated the title and the description:

  • Add wpt pull-request
  • Update Implementation bugs

@yutakahirano
Copy link
Member

I think we should have a dedicated issue for Chromium (for streaming request).

@yoichio
Copy link
Contributor Author

yoichio commented Jan 27, 2021

Done (https://crbug.com/1171011: Fetch streaming upload should fail on a 421 (Misdirected Request) response).

@yutakahirano
Copy link
Member

The current logic leads to endless retry. Using another connection, which is required by the RFC, is also missing.

I'm not sure how in detail it should be specified, but at least some notes are needed. @annevk, thoughts?

@annevk
Copy link
Member

annevk commented Jan 28, 2021

I think it's okay for the initial version to have something like

User agents should have an <a>implementation-defined</a> recursion limit.

as a separate paragraph below the recursive invocation. It's not immediately clear to me if this limit can be exploited in some way, but I guess we'll learn that over time...

@annevk
Copy link
Member

annevk commented Jan 30, 2021

This will also fix #497 and we should note that in the final commit message.

@annevk annevk requested a review from mnot January 30, 2021 10:53
fetch.bs Outdated Show resolved Hide resolved
fetch.bs Show resolved Hide resolved
@yoichio
Copy link
Contributor Author

yoichio commented Feb 1, 2021

Added recursion limit and updated the PR description including #497 .

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation could use some cleanup, but otherwise this looks good to me.

fetch.bs Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, except for the one missing parameter. I have some editorial nits I can push in a fixup commit.

fetch.bs Outdated Show resolved Hide resolved
@yoichio
Copy link
Contributor Author

yoichio commented Feb 26, 2021

I misunderstood column was in 80 characters instead of 100.
Thanks. LGTM.

@annevk
Copy link
Member

annevk commented Mar 3, 2021

@yoichio I updated this per the discussion in httpwg/http-core#789. In particular:

  1. If you get a 421 while you do a stream upload, we just pass the 421 on to the caller.
  2. If you get a 421 a second time, we just pass the 421 on the caller (and don't allow for another retry).

Are you willing to update the tests if that seems reasonable? I can also help out. Just let me know.

@yoichio
Copy link
Contributor Author

yoichio commented Mar 4, 2021

LGTM. I'll update the test.

author Yoichi Osato <yoichio@chromium.org> 1611037428 +0900
committer Yoichi Osato <yoichio@chromium.org> 1614131996 +0900

rebase
@annevk
Copy link
Member

annevk commented Mar 4, 2021

I rebased this again. So "obtain a connection" now has bypassConnectionPool and dedicated. bypassConnectionPool bypasses the connection pool on lookup, but still stores the result in the connection pool, and dedicated bypasses it completely. Should we organize this differently?

@martinthomson who had naming suggestions on the WebTransport PR might have insights here as well.

@annevk annevk requested a review from yutakahirano March 4, 2021 09:07
@annevk
Copy link
Member

annevk commented Mar 4, 2021

One thought I had was to rename this parameter to forceNew to make it clearer it only forces a new connection, nothing else.

@yoichio
Copy link
Contributor Author

yoichio commented Mar 5, 2021

forceNew sounds good to me.

fetch.bs Outdated Show resolved Hide resolved
fetch.bs Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
annevk pushed a commit to web-platform-tests/wpt that referenced this pull request Mar 5, 2021
@annevk
Copy link
Member

annevk commented Mar 5, 2021

Thanks @yoichio and @yutakahirano. I'll merge this now and I'll file a bug against Safari so they can consider supporting 421 responses.

@annevk annevk merged commit c5eb621 into whatwg:main Mar 5, 2021
@annevk annevk mentioned this pull request Mar 5, 2021
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Mar 15, 2021
…se., a=testonly

Automatic update from web-platform-tests
Fetch: tests for 421 responses

For whatwg/fetch#1141.
--

wpt-commits: ef9bff0647e97e768fa25751b9f60b07b46f61f2
wpt-pr: 27322
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Mar 15, 2021
…se., a=testonly

Automatic update from web-platform-tests
Fetch: tests for 421 responses

For whatwg/fetch#1141.
--

wpt-commits: ef9bff0647e97e768fa25751b9f60b07b46f61f2
wpt-pr: 27322

UltraBlame original commit: 9bb0faecefd9c9f46480722f9946255c2ec8d7a4
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Mar 15, 2021
…se., a=testonly

Automatic update from web-platform-tests
Fetch: tests for 421 responses

For whatwg/fetch#1141.
--

wpt-commits: ef9bff0647e97e768fa25751b9f60b07b46f61f2
wpt-pr: 27322

UltraBlame original commit: 9bb0faecefd9c9f46480722f9946255c2ec8d7a4
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Mar 15, 2021
…se., a=testonly

Automatic update from web-platform-tests
Fetch: tests for 421 responses

For whatwg/fetch#1141.
--

wpt-commits: ef9bff0647e97e768fa25751b9f60b07b46f61f2
wpt-pr: 27322

UltraBlame original commit: 9bb0faecefd9c9f46480722f9946255c2ec8d7a4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

421 Status Code
4 participants