W3C home > Mailing lists > Public > ietf-http-wg@w3.org > October to December 2019

Re: [Http-use] 401 response from server on Expect 100 continue and re-using the connection

From: Roy T. Fielding <fielding@gbiv.com>
Date: Mon, 14 Oct 2019 12:57:16 -0700
Message-Id: <7E18CC06-8790-4452-9D0C-4598DC3B6F11@gbiv.com>
Cc: Ashok Kumar <ashokkumarj@gmail.com>, HTTP Working Group <ietf-http-wg@w3.org>
To: Patrick McManus <mcmanus@ducksong.com>
> On Oct 14, 2019, at 9:31 AM, Patrick McManus <mcmanus@ducksong.com> wrote:
> 
> 
> On Mon, Oct 14, 2019 at 9:09 AM Roy T. Fielding <fielding@gbiv.com <mailto:fielding@gbiv.com>> wrote:
> 
>> I see some clients which are behaving differently i.e. sending the next request on receiving a 401 and I'm unable to ascertain If this is correct.
> 
> That would depend on the method and body length, but for practical purposes
> an HTTP/1.1 client will only send "Expect: 100-continue" if they intend to close
> the connection upon error instead of sending a body.
> 
> 
>  I agree that's practical advice.. but due to race conditions I could see the client having actually sent the whole body before processing the error and there might not be a lot to be gained by throwing away the connection in that case..

Right, which is why it is specified this way instead of requiring either side to close.

To be clear, when the server doesn't indicate the connection is closed:
a client continuing to send a whole message before sending their next
request is the "okay" case, and terminating the connection upon receipt
of the 4xx code is the "normal" case, whereas sending a new request on the
same connection before completing the prior request's framing would be a bug
in the client.

> or perhaps more more obtrusely, the client might be able to truncate the request body if it is chunking.. so the server should be prepared for the possibility of reuse (unless it marks the connection closed itself).

Also true, in the rare cases that allow use of chunked request bodies, that
sending a zero chunk early is fine because the request semantics no longer
matter (we are sending data for the sole purpose of delimiting the message).

However, due to the complexity and race conditions inherent in Expect 100
processing, clients avoid using it except in those conditions where there is a
very clear advantage to waiting a RTT for the 100 instead of risking a wasted
body send. Anything close to borderline is usually sent without Expect.

Hence, clients do not typically finesse the error handling even when they can
(except maybe for Patrick's client, because it's an interesting challenge ;-).

....Roy


Received on Monday, 14 October 2019 19:57:29 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:15:43 UTC