Re: Sections 3.3.2 and 3.3.3 allow bogus Content-Length?

Jacob Champion <champion.p@gmail.com> Tue, 14 February 2017 21:56 UTC

Return-Path: <ietf-http-wg-request+bounce-httpbisa-archive-bis2juki=lists.ie@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 50F931298CF for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 14 Feb 2017 13:56:33 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.502
X-Spam-Level:
X-Spam-Status: No, score=-6.502 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_DNSWL_HI=-5, RCVD_IN_SORBS_SPAM=0.5, RP_MATCHES_RCVD=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aaNxNtPoTM28 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 14 Feb 2017 13:56:32 -0800 (PST)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id EA7FA12944E for <httpbisa-archive-bis2Juki@lists.ietf.org>; Tue, 14 Feb 2017 13:56:31 -0800 (PST)
Received: from lists by frink.w3.org with local (Exim 4.80) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1cdl32-00074b-6D for ietf-http-wg-dist@listhub.w3.org; Tue, 14 Feb 2017 21:54:08 +0000
Resent-Date: Tue, 14 Feb 2017 21:54:08 +0000
Resent-Message-Id: <E1cdl32-00074b-6D@frink.w3.org>
Received: from mimas.w3.org ([128.30.52.79]) by frink.w3.org with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <champion.p@gmail.com>) id 1cdl2y-00073g-BK for ietf-http-wg@listhub.w3.org; Tue, 14 Feb 2017 21:54:04 +0000
Received: from mail-it0-f53.google.com ([209.85.214.53]) by mimas.w3.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <champion.p@gmail.com>) id 1cdl2s-0005nB-0g for ietf-http-wg@w3.org; Tue, 14 Feb 2017 21:53:58 +0000
Received: by mail-it0-f53.google.com with SMTP id 203so52562769ith.0 for <ietf-http-wg@w3.org>; Tue, 14 Feb 2017 13:53:37 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=koD7A/IkAEmHnqTxPQ4KnTpieZhnY8I8uKnaouw0w3g=; b=N8RzS0sO3QQvIOoO+AT4zZ2+ET/80SkpXF+hAZED3YCLh/MbeA2LLi2OceYv2tuPYs 9rnEc5+IEU9QE6DYnG5/c1wuize/l0xWnkZi5l2HFeciWGqrf8cPSAPIiMftFmWcMVbP 1mWqNLDsOkS0aggsYe2kCVib+JxYjzI2/sFySN66G8O5jki+gQNQSqPcirZenu6j5gOx eFixsPTIxkgPnfnuxk4VU7wlIvg6CaJSmMS92SlWC2fRLF33TDdsMucTy+xFOQPBr8xl qe1XXtUHE54r5suW8BvgjWVw/kK8KmmIpUSECIwQzFCpigyjNK92iSaGiLJyFvi3wvmM +mhg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=koD7A/IkAEmHnqTxPQ4KnTpieZhnY8I8uKnaouw0w3g=; b=NzQOTf7WKaKIjO5zSebeRZID8bKgJXZg85LA9+0Rmiybl4Jn9Y1xiRrHGl2mvD0sme Cw2vRpNFc60A5NeuThGQMokZgC+xkxF+Q3dC0RQLtSwbDxLWShAHXeIV+5yfztflmu3E vLiQe9/EYPEDSbX5r5v6qSL4haTTERD6o/iNxipSkSpCOS9xKL6VpWMBZJqCXMqF/6yg IQdKKG7x1c4YvaBQ9iQ0INDn7T/Ktksvn/YXaecUU9EzYfTFU8gBe3WgqmlubEcNmEZp twtVxQAUR759zUwFLbklQou6zbWGlgJWKB8eM7y2zJa2MoWkiuar1M20Jg2OdrL4PQ4C ql+A==
X-Gm-Message-State: AMke39nGri/XmUUPcWVnXr9GriRqoA1oHRUKzuojlJOcT9dZ17oJGX2YwqPf28MA9WaMiQ==
X-Received: by 10.99.105.8 with SMTP id e8mr34083755pgc.217.1487109211158; Tue, 14 Feb 2017 13:53:31 -0800 (PST)
Received: from [192.168.1.2] (50-39-112-180.bvtn.or.frontiernet.net. [50.39.112.180]) by smtp.gmail.com with ESMTPSA id c18sm3057057pfj.49.2017.02.14.13.53.30 for <ietf-http-wg@w3.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Feb 2017 13:53:30 -0800 (PST)
To: ietf-http-wg@w3.org
References: <emdcb96fc0-0d2f-436c-9f1f-05beffe7593e@bodybag> <e01c4945-1116-d258-7004-ea917843bf3d@ninenines.eu> <ema747b801-6dcc-4b2d-ac95-9a027e10c0b4@bodybag>
From: Jacob Champion <champion.p@gmail.com>
Message-ID: <41c985ac-c202-1eca-8be8-c968a9e55220@gmail.com>
Date: Tue, 14 Feb 2017 13:53:29 -0800
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0
MIME-Version: 1.0
In-Reply-To: <ema747b801-6dcc-4b2d-ac95-9a027e10c0b4@bodybag>
Content-Type: text/plain; charset="utf-8"; format="flowed"
Content-Transfer-Encoding: 7bit
Received-SPF: pass client-ip=209.85.214.53; envelope-from=champion.p@gmail.com; helo=mail-it0-f53.google.com
X-W3C-Hub-Spam-Status: No, score=-6.3
X-W3C-Hub-Spam-Report: AWL=-2.050, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001, W3C_AA=-1, W3C_WL=-1
X-W3C-Scan-Sig: mimas.w3.org 1cdl2s-0005nB-0g 820f4242884fce1ca4d6b9375261a92e
X-Original-To: ietf-http-wg@w3.org
Subject: Re: Sections 3.3.2 and 3.3.3 allow bogus Content-Length?
Archived-At: <http://www.w3.org/mid/41c985ac-c202-1eca-8be8-c968a9e55220@gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/33496
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>

On 02/14/2017 01:12 PM, Adrien de Croy wrote:
> The first sentence in 3.3.2
>
> "When a message does not have a Transfer-Encoding header field, a
> Content-Length header field can provide the anticipated size, as a
> decimal number of octets, for a potential payload body."
>
> "can provide"???
> "anticipated size"???
> "potential payload body"???

Seems to me that those weird qualifications are there mostly for the 
case where Content-Length is sent without a payload body. From the same 
paragraph:

    [...] For messages
    that do include a payload body, the Content-Length field-value
    provides the framing information necessary for determining where the
    body (and message) ends.  For messages that do not include a payload
    body, the Content-Length indicates the size of the selected
    representation (Section 3 of [RFC7231]).

Without the (admittedly vague) language, you'll have people trying to 
parse bodies from responses to HEAD requests if they have a 
Content-Length, or people complaining because the server changed the 
size of a representation between the HEAD and the GET, or whatever. 
Thus, "anticipated size" and "potential payload body".

I'm curious to know what use case someone could possibly create for a 
client to send an incorrect Content-Length.

--Jacob