Re: p2: Expect: 100-continue and "final" status codes

Zhong Yu <zhong.j.yu@gmail.com> Tue, 23 April 2013 17:43 UTC

Return-Path: <ietf-http-wg-request@listhub.w3.org>
X-Original-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Delivered-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id E8C6D21F91B2 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 23 Apr 2013 10:43:30 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -10.598
X-Spam-Level:
X-Spam-Status: No, score=-10.598 tagged_above=-999 required=5 tests=[AWL=-0.000, BAYES_00=-2.599, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-8]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mxv5G6wlvPo1 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 23 Apr 2013 10:43:29 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) by ietfa.amsl.com (Postfix) with ESMTP id 5DD9D21F95CE for <httpbisa-archive-bis2Juki@lists.ietf.org>; Tue, 23 Apr 2013 10:43:24 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.72) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1UUhEk-0002cl-Gn for ietf-http-wg-dist@listhub.w3.org; Tue, 23 Apr 2013 17:42:38 +0000
Resent-Date: Tue, 23 Apr 2013 17:42:38 +0000
Resent-Message-Id: <E1UUhEk-0002cl-Gn@frink.w3.org>
Received: from maggie.w3.org ([128.30.52.39]) by frink.w3.org with esmtp (Exim 4.72) (envelope-from <zhong.j.yu@gmail.com>) id 1UUhEb-0002c1-QA for ietf-http-wg@listhub.w3.org; Tue, 23 Apr 2013 17:42:29 +0000
Received: from mail-ob0-f181.google.com ([209.85.214.181]) by maggie.w3.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.72) (envelope-from <zhong.j.yu@gmail.com>) id 1UUhEa-0000BZ-CJ for ietf-http-wg@w3.org; Tue, 23 Apr 2013 17:42:29 +0000
Received: by mail-ob0-f181.google.com with SMTP id ta17so738624obb.26 for <ietf-http-wg@w3.org>; Tue, 23 Apr 2013 10:42:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=JnfqKgwMz5+RgB8kgxUQQz2+JS5yQQis4zlDyGGkNpQ=; b=Rx6qY5sHmgP+kjrxizZKjpIk+hhWV2LYoM4RKbxzhJQ8UbhtE4yAa1ztdbWC0xM9q4 w1kBwG62qLX4Z86/YEiX1QWRo0J8jqFL741GKCJ3XHGqJdsydDJdMcp4S0cm/iVE+vHI vvERD735jfcZCTnP66M0lY2xSCKduM7Xj/IvYDMhuscXmqL9oDLsv35rqmKCpoHBtYnW otcMq2g4X+lKO/HsSUJjGDZ+QkGYOvimDiUTvxUjv3EzbBHVu0aYJXtH97sZndVxGuc+ 6hFDQSVWtgZO5V4+QVfLPciX2OoO8wRWbcspjXHiEKWXrzUhExYauphr7mK2b53TU5ph gNdQ==
MIME-Version: 1.0
X-Received: by 10.60.173.196 with SMTP id bm4mr2007960oec.108.1366738922235; Tue, 23 Apr 2013 10:42:02 -0700 (PDT)
Received: by 10.76.22.130 with HTTP; Tue, 23 Apr 2013 10:42:02 -0700 (PDT)
In-Reply-To: <750CBB7A-3E82-4D2A-871E-159E9F030E6F@mnot.net>
References: <750CBB7A-3E82-4D2A-871E-159E9F030E6F@mnot.net>
Date: Tue, 23 Apr 2013 12:42:02 -0500
Message-ID: <CACuKZqGmrDiNQvG0SVw=XXcy_n-BBxK-pnp+ar7uAbnwkumRag@mail.gmail.com>
From: Zhong Yu <zhong.j.yu@gmail.com>
To: Mark Nottingham <mnot@mnot.net>
Cc: "ietf-http-wg@w3.org Group" <ietf-http-wg@w3.org>
Content-Type: multipart/alternative; boundary="089e01184cf8f5f3fb04db0ab353"
Received-SPF: pass client-ip=209.85.214.181; envelope-from=zhong.j.yu@gmail.com; helo=mail-ob0-f181.google.com
X-W3C-Hub-Spam-Status: No, score=-4.4
X-W3C-Hub-Spam-Report: AWL=-1.704, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001
X-W3C-Scan-Sig: maggie.w3.org 1UUhEa-0000BZ-CJ 8f58bea8eea2711edc6cc905a193aaf5
X-Original-To: ietf-http-wg@w3.org
Subject: Re: p2: Expect: 100-continue and "final" status codes
Archived-At: <http://www.w3.org/mid/CACuKZqGmrDiNQvG0SVw=XXcy_n-BBxK-pnp+ar7uAbnwkumRag@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/17509
X-Loop: ietf-http-wg@w3.org
Resent-Sender: ietf-http-wg-request@w3.org
Precedence: list
List-Id: <ietf-http-wg.w3.org>
List-Help: <http://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>

#Expect 100-continue without a body

If a client sends a request without a body yet with a "Expect:
100-continue" header, the request ought to be considered a bad request,
because of a previous requirement:

   o  A client MUST NOT send an Expect header field with the "100-
      continue" expectation if it does not intend to send a payload
      body.

However a server may not be able to detect all bad requests. If it sees a
request without a body, it may simply assume that there's no 100-continue
expectation.

The spec may add a leeway for server

   o  Upon receiving a request with "100-continue" expectation yet without
a message body (i.e. both Transfer-Encoding and Content-Length are
missing), an origin server SHOULD either respond with 400 (Bad Request), or
ignore the expectation.


#Performing request method without reading request body

I don't understand why the origin server must not perform the request
method if it opts not to read the request body. Even though it's probably
the right thing to do in almost all cases, do we have to make it an
absolute requirement?


#Managing connection

The last requirement for the origin server talks about requests *without* a
"100-continue" expectation. Therefore it should not be in this section. The
subject is covered very well in p1#6.6 already, I think we can simply
delete it from this section.

On the other hand, the spec does not address connection management
adequately in the most important use case of the section. It currently says
(paraphrasing)

    upon receiving a request that includes the 100-continue expectation, if
the origin server responds with a final status code instead of 100
(Continue), after sending the response, it may either close the connection
or continue to read and discard the rest of the request.

I think we can give better advice than that. If a server responds with a
final status code instead of 100 (Continue)

1. The response must be the last response on the connection. The response
should contain "Connection: close" header. After the response is written,
the server must initiate a lingering close of the connection (p1#6.6).

2. If the client receives a final status code instead of 100 (Continue), it
should stop sending request body if it is doing so; it must close the
connection after the response is received.

This is to avoid the RST problem if the client decides to start to write
request body before receiving any response from the server.


Zhong Yu


On Tue, Apr 23, 2013 at 2:22 AM, Mark Nottingham <mnot@mnot.net> wrote:

> p2 5.1.1.1 explains the semantics of 100-continue: "If the origin server
> responds with a final status code, it must not have performed the request
> method and may either close the connection or continue to read and discard
> the rest of the request."
>
> In my (admittedly quick) testing, pretty much nobody does this, at least
> by default; i.e., if I send a GET to a server with Expect: 100-continue,
> it's going to give me a 200 or 30x, not a 417. Sure, they might send 417
> for a request with a body, but as written pretty much no one is conformant.
>
> One thing we could do would be to only place requirements upon proxies and
> servers when Expect: 100-continue is on a request with a body.
>
> Stepping back, though, I have to wonder if it's reasonable to only allow
> 100 (Continue) or, effectively, an error (since the request can't be
> "applied") in the presence of Expect: 100-continue. I've seen many
> implementations that purposefully ignore Expect: 100-continue and send back
> 200 (OK) responses to avoid the interop problems that expect/continue
> brings.
>
> OTOH if we do maintain the notion that a final response to an Expect:
> 100-continue request needs to NOT be applied on the server, we should use
> more specific terminology (i.e., say that it needs to be a 4xx or 5xx
> response status, not just a "final response.").
>
> Thoughts?
>
> --
> Mark Nottingham   http://www.mnot.net/
>
>
>
>
>