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
Specify behavior on incomplete requests #1643
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bbda80c
HTTP_EARLY_RESPONSE not defined (Whoops\!)
MikeBishop 24bbe71
Define HTTP_INCOMPLETE_REQUEST
MikeBishop a9c73a0
Recommend bidirectional cancellation for clients
MikeBishop 482badb
More separated
MikeBishop c777723
Usable
MikeBishop 59da706
(that too)
MikeBishop File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -306,9 +306,10 @@ Trailing header fields are carried in an additional header block following the | |
body. Senders MUST send only one header block in the trailers section; | ||
receivers MUST discard any subsequent header blocks. | ||
|
||
An HTTP request/response exchange fully consumes a QUIC stream. After sending a | ||
request, a client closes the stream for sending; after sending a response, the | ||
server closes the stream for sending and the QUIC stream is fully closed. | ||
An HTTP request/response exchange fully consumes a bidirectional QUIC stream. | ||
After sending a request, a client closes the stream for sending; after sending a | ||
response, the server closes the stream for sending and the QUIC stream is fully | ||
closed. | ||
|
||
A server can send a complete response prior to the client sending an entire | ||
request if the response does not depend on any portion of the request that has | ||
|
@@ -317,8 +318,13 @@ client abort transmission of a request without error by triggering a QUIC | |
STOP_SENDING with error code HTTP_EARLY_RESPONSE, sending a complete response, | ||
and cleanly closing its streams. Clients MUST NOT discard complete responses as | ||
a result of having their request terminated abruptly, though clients can always | ||
discard responses at their discretion for other reasons. Servers MUST NOT | ||
abort a response in progress as a result of receiving a solicited RST_STREAM. | ||
discard responses at their discretion for other reasons. | ||
|
||
Servers MUST NOT abort a response in progress as a result of receiving a | ||
solicited RST_STREAM (i.e. with error code STOPPING). If the request stream | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing comma after "i.e." |
||
terminates for any other reason without containing a fully-formed HTTP request, | ||
the server SHOULD abort its response with the error code | ||
HTTP_INCOMPLETE_REQUEST. | ||
|
||
### Header Formatting and Compression | ||
|
||
|
@@ -388,10 +394,11 @@ detects an error with the stream or the QUIC connection. | |
|
||
### Request Cancellation | ||
|
||
Either client or server can cancel requests by closing the stream (QUIC | ||
RST_STREAM or STOP_SENDING frames, as appropriate) with an error type of | ||
Either client or server can cancel requests by aborting the stream (QUIC | ||
RST_STREAM or STOP_SENDING frames, as appropriate) with an error code of | ||
HTTP_REQUEST_CANCELLED ({{http-error-codes}}). When the client cancels a | ||
request or response, it indicates that the response is no longer of interest. | ||
Clients SHOULD cancel requests by aborting both directions of a stream. | ||
|
||
When the server cancels either direction of the request stream using | ||
HTTP_REQUEST_CANCELLED, it indicates that no application processing was | ||
|
@@ -1185,6 +1192,9 @@ HTTP_PUSH_ALREADY_IN_CACHE (0x04): | |
HTTP_REQUEST_CANCELLED (0x05): | ||
: The client no longer needs the requested data. | ||
|
||
HTTP_INCOMPLETE_REQUEST (0x06): | ||
: The client's stream terminated without containing a fully-formed request. | ||
|
||
HTTP_CONNECT_ERROR (0x07): | ||
: The connection established in response to a CONNECT request was reset or | ||
abnormally closed. | ||
|
@@ -1220,6 +1230,10 @@ HTTP_WRONG_STREAM_DIRECTION (0x0010): | |
: A unidirectional stream type was used by a peer which is not permitted to do | ||
so. | ||
|
||
HTTP_EARLY_RESPONSE (0x0011): | ||
: The remainder of the client's request is not needed to produce a response. | ||
For use in STOP_SENDING only. | ||
|
||
HTTP_GENERAL_PROTOCOL_ERROR (0x00FF): | ||
: Peer violated protocol requirements in a way which doesn't match a more | ||
specific error code, or endpoint declines to use the more specific error code. | ||
|
@@ -1677,6 +1691,7 @@ The entries in the following table are registered by this document. | |
| HTTP_INTERNAL_ERROR | 0x0003 | Internal error | {{http-error-codes}} | | ||
| HTTP_PUSH_ALREADY_IN_CACHE | 0x0004 | Pushed content already cached | {{http-error-codes}} | | ||
| HTTP_REQUEST_CANCELLED | 0x0005 | Data no longer needed | {{http-error-codes}} | | ||
| HTTP_INCOMPLETE_REQUEST | 0x0006 | Stream terminated early | {{http-error-codes}} | | ||
| HTTP_CONNECT_ERROR | 0x0007 | TCP reset or error on CONNECT request | {{http-error-codes}} | | ||
| HTTP_EXCESSIVE_LOAD | 0x0008 | Peer generating excessive load | {{http-error-codes}} | | ||
| HTTP_VERSION_FALLBACK | 0x0009 | Retry over HTTP/2 | {{http-error-codes}} | | ||
|
@@ -1687,6 +1702,7 @@ The entries in the following table are registered by this document. | |
| HTTP_WRONG_STREAM_COUNT | 0x000E | Too many unidirectional streams | {{http-error-codes}} | | ||
| HTTP_CLOSED_CRITICAL_STREAM | 0x000F | Critical stream was closed | {{http-error-codes}} | | ||
| HTTP_WRONG_STREAM_DIRECTION | 0x0010 | Unidirectional stream in wrong direction | {{http-error-codes}} | | ||
| HTTP_EARLY_RESPONSE | 0x0011 | Remainder of request not needed | {{http-error-codes}} | | ||
| HTTP_MALFORMED_FRAME | 0x01XX | Error in frame formatting or use | {{http-error-codes}} | | ||
| ----------------------------------- | ---------- | ---------------------------------------- | ---------------------- | | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Perhaps the way to do this is to say:
Cancellation of a request stream does not prevent a server from sending a response. A client that does not want a response SHOULD send a STOP_SENDING frame. A server does not need to take receipt of a RST_STREAM as a signal that it cannot provide a response, though it might be unable to do so. If a stream is reset by the client and the server is unable to respond as a result, it can treat that as a stream error of type HTTP_INCOMPLETE_REQUEST.
This is a different structure - it says that any STOP_SENDING and RST_STREAM on the request side of a stream only cancel the request and not the response. But I think that this is neater - it avoids all of the coupling you have going on here.
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 think that's basically what I was going for (the error at the server is that it doesn't have a complete request, not that the RST occurred), but that's a clearer way to state it.