-
Notifications
You must be signed in to change notification settings - Fork 342
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
421 and upload streams #982
Comments
Since ReadableStream is not replayable, 421 handling should be referred to the web author. I guess supporting early responses cancel is hard as same as bidirectional support given Chromium starts response handling after whole request body sending. |
I'm no expert on the mechanics of sockets, but if we write and the socket is half-closed by the other end, without reading from it, my recollection is we tend to get connection resets, as opposed connection closed notifications. This behavior is observed across all platforms. Once Windows notifies a consumer of a connection reset, you can no longer read from the socket, even if there was a 421 response pending. So just trying to read from a socket after uploading the request body fails, which would be much simpler than supporting full duplex sockets, won't give us a 421 response on Windows. On other platforms, we do actually read from the body on connection resets of upload attempts, and return 4xx/5xx responses, if we get them. Note that this only applies to H1, I'm not sure what H2/QUIC do in this case, or if they even have an analog of half-closed sockets. |
Ping @annevk ? |
I don't really have a stake in the outcome, but when we pass it on to the web developer (and when we retry) needs to be clear. |
If fetch upload failed, promise reject is called. If it succeeded and server returns 421, the web author gets 421. |
I meant in the specification. 😊 |
I don't understand yet what is special and unclear about 421 specification and the upload stream. |
Well, the request cannot be retried and therefore the 421 is forwarded to the application, whereas in other cases retrying is allowed. (I haven't tested what browsers do with it in general though.) |
I confirmed that both Chrome and Firefox retried the request once upon the 421 response for simple string fetch except As fetch() fails on redirect resolution, how about |
I think we should require retrying (similar to how we require redirects to be followed, etc.) and forbid it when a request body is a stream. |
I agree with not retrying when a request body is a stream. |
I'm saying MUST. Fetch is defining a type of client after all. I suppose we could make it less strict initially, but if every browser already does it I don't see why we would. |
Discussing the relation between 421 response and other body fetching is out of this issue blocking upload-streaming. |
Ping? |
@yoichio ping for what? |
The current spec states "Clients receiving a 421 (Misdirected Request) response from a server MAY retry the request". |
Right, because Fetch defines a particular type of client that ideally all behave the same. |
I overlooked the auxiliary verbs meaning: MAY is absolutely optional. If changing the MAY to MUST is required to mean we must not retry streams body, I agree with you. |
Anne, what do you think of my above comment? |
I'm not entirely sure what it means. What I think needs to happen is that Fetch mandates a particular behavior in response to 421 responses for all types of requests Fetch can make. |
A particular behavior means a same action? |
Sorry, I did phrase that awkwardly. I meant that we should specify how to react to 421 responses for all requests. And "how" can be different depending on the type of request. E.g., if request's body is a stream, we return the response. If it's not, we refetch. (Similar indeed to how the specification details how to deal with 1XX and 304 for instance.) |
Thanks for clarifying that. I'm not familiar with the spec grammar and writing.
? |
This would have to be in Fetch as browser considerations for 421 are not universal. I suspect it would be easiest for you to reach out to @yutakahirano for advice on how to go about it. |
@yoichio, last year we discussed this and IIRC you were willing to handle this issue, so I assigned this issue to you. Please let me know if you need any help. |
Yes. I'll pull-request. |
Following whatwg/fetch#982, fetch upload streaming on 421 (Misdirected Request) should be rejected. Why this results with PASS though we don't have an implementation yet is because the uploading always fails over H/1 (see crrev.com/c/2174099 for detail). Bug: 688906 Change-Id: I4cb02663f0c8294fe25d675b60978b4a7fcbc749
Per #497 browsers implement 421. What does a 421 mean for an upload stream? Would we reveal the 421 to the caller after streaming completed?
Would clients that support early responses cancel the stream in addition?
cc @whatwg/http @yutakahirano
The text was updated successfully, but these errors were encountered: