Very large values (Re: Call For Adoption Live Byte Ranges)

Martin Thomson <martin.thomson@gmail.com> Tue, 03 January 2017 00:41 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 894DE12951C for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Mon, 2 Jan 2017 16:41:09 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -10.101
X-Spam-Level:
X-Spam-Status: No, score=-10.101 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, RP_MATCHES_RCVD=-3.1, 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 7TVg_6AgibTz for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Mon, 2 Jan 2017 16:41:08 -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 350441293F8 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Mon, 2 Jan 2017 16:41:07 -0800 (PST)
Received: from lists by frink.w3.org with local (Exim 4.80) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1cOD74-0000Bt-Gs for ietf-http-wg-dist@listhub.w3.org; Tue, 03 Jan 2017 00:38:02 +0000
Resent-Date: Tue, 03 Jan 2017 00:38:02 +0000
Resent-Message-Id: <E1cOD74-0000Bt-Gs@frink.w3.org>
Received: from titan.w3.org ([128.30.52.76]) by frink.w3.org with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <martin.thomson@gmail.com>) id 1cOD70-0000Ag-PQ for ietf-http-wg@listhub.w3.org; Tue, 03 Jan 2017 00:37:58 +0000
Received: from mail-qt0-f170.google.com ([209.85.216.170]) by titan.w3.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <martin.thomson@gmail.com>) id 1cOD6u-0001Uy-Ss for ietf-http-wg@w3.org; Tue, 03 Jan 2017 00:37:53 +0000
Received: by mail-qt0-f170.google.com with SMTP id d45so229176496qta.1 for <ietf-http-wg@w3.org>; Mon, 02 Jan 2017 16:37:32 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=qr4jAksS6A/Tk5EqDaw06Oto7Gf8YBqxb1hPX/fXqpY=; b=YKxRUZK9ieiI1/kOGw+LaQ4ZkkTS6qFzftqrPdjHLBYYa+zfuWaIoPr0YhLTu68n6C u7ZpmTd1jEy2akE/HSKUMEE+LwgyD46Y9LhUUvIaRrtXbDc0IZ5LYDNNAWp0ftxZczOu WndJWszN7Nb34Es3PwPLGnnPvfUblxCZVdTAlsY4xa1zd+lmel7O0O/OjcWeeyQVvaaJ +oz00ACjhkrae3a2SiVuug/8aNfQub/8DIqBzENin/mBj6T5lOdjHGdm5N/carQZQNpu 0GCk9lDYDQfCLUouJ5OGo0qmoTcWKvNKGXhRx/HNWP4AeWHGceqw45z6P5goT+xXIMIR 5iaQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=qr4jAksS6A/Tk5EqDaw06Oto7Gf8YBqxb1hPX/fXqpY=; b=PaCexL1GcubV8PZI91r4wW2OO+SteSiKfE0lVHWB1oedGGT7SxtjeDBgFNGWNxn7BY GmNcRaO+p53Ax9OQGCkOEzo9uML8zSW8wkuSQEiOZ/Bc9qOLyz+6+qKuHnQOPGpYJcoP wnAlh7qPkkNGbU+99+xWfgKcbsGEcBU0+zGoLXSTDqjIr4+f9t62xu3DDk6X/Kc08Bdo DU42zcv/7tjyEAO7BJ+fgVWtSiypHXhCSxBPPV/nlHQRMhsQVok2ttSCSDeu1hhUnInp iAe4pio6vKDk3sqHPBiFGnk8eAdD49SvcZAPa2qqV/WZfAX0jKphK+PeUQAS0X/Xu3O3 rHpA==
X-Gm-Message-State: AIkVDXLo6S5l2bqSJiLhrSiNOfQQnVD9K18Brz90FQD8L9zVETK4sagQ/xjLllRo6DYwuP4Ucxxm5Q1mpyjKkw==
X-Received: by 10.200.48.28 with SMTP id f28mr62183996qte.247.1483403846873; Mon, 02 Jan 2017 16:37:26 -0800 (PST)
MIME-Version: 1.0
Received: by 10.140.38.233 with HTTP; Mon, 2 Jan 2017 16:37:26 -0800 (PST)
From: Martin Thomson <martin.thomson@gmail.com>
Date: Tue, 03 Jan 2017 11:37:26 +1100
Message-ID: <CABkgnnVj6yKkdr=QZiZpqMDsbYDpO39bbYThi6bPOcOx7Sdi5Q@mail.gmail.com>
To: Craig Pratt <craig@ecaspia.com>
Cc: HTTP Working Group <ietf-http-wg@w3.org>
Content-Type: text/plain; charset="UTF-8"
Received-SPF: pass client-ip=209.85.216.170; envelope-from=martin.thomson@gmail.com; helo=mail-qt0-f170.google.com
X-W3C-Hub-Spam-Status: No, score=-6.4
X-W3C-Hub-Spam-Report: AWL=0.361, 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, SPF_PASS=-0.001, W3C_AA=-1, W3C_DB=-1, W3C_IRA=-1, W3C_WL=-1
X-W3C-Scan-Sig: titan.w3.org 1cOD6u-0001Uy-Ss a2fd37a9325b354a330ffa0c024b69ff
X-Original-To: ietf-http-wg@w3.org
Subject: Very large values (Re: Call For Adoption Live Byte Ranges)
Archived-At: <http://www.w3.org/mid/CABkgnnVj6yKkdr=QZiZpqMDsbYDpO39bbYThi6bPOcOx7Sdi5Q@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/33257
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 3 January 2017 at 10:00, Craig Pratt <craig@ecaspia.com> wrote:
> 2^63 is 9223372036854775808 (decimal). I've defined a smaller value to avoid
> potential conflicts and to make the value more easily identifiable:
> 9222999999999999999.
>
> I think having a clearly-defined Very Large Value such as this to represent
> the indeterminate end of content will be more deterministic/easily
> implemented than having a Server try to establish a VLV in each HTTP
> exchange. But I'd appreciate any thoughts prior to revising the draft.

I think that any value you choose will be OK-ish.  The question is
whether you think that there is a response that will exceed that size.
If there is, then no single value you choose will be enough.  If that
is possible, then you don't want a single fixed value at all, just a
recommendation to pick a big number that far exceeds the size you
want/expect.

I guess the other concern is that 9222999999999999999 (which I had to
copy because I go cross-eyed counting those nines), is too big for
some numeric formats.  Javascript has trouble with that number, which
it reads as 9223000000000000000 instead, a problem that starts with
9007199254740993 (just paste that into your browser console and see
what comes back). That suggests a smaller value might be safer, but
then you have more problems with overflow.

Note that whatever value you pick has to be safe for a great many
implementations, even if those implementations never need that space.
They still have to parse the value properly, preferably without
resorting to use of bignums.

If you believe it to be possible to pick a safe value that will never
be exceeded, then ignore the rest of my mail :)


The risk in specifying a single value is that implementations will
hard-code checks around that value like (end == VLV) or if things are
done poorly (end >= VLV).  Implementations that have that check will
assume indefinite ranges, even if there isn't an indefinite range and
might get caught with bugs, like infinite loops:

10: I have up to <VLV>, I need more bytes
20: ask for a range from current end to <VLV> (i.e., VLV-VLV)
30: get a zero-length range back
40: if need more bytes, goto 20

That leads to problems: implementations won't be able to send
responses of exactly the size you choose (however unlikely that is),
or in the bad case, you won't ever be able to exceed that value.

You can get the same effect if major implementations pick the same value.

On the other hand, a client can just pick an arbitrary stupidly large
value (ASLV).  This can be an increment on what the client already
has, and should probably include some randomness.  If there is that
much still remaining, then they just have to make a new request.

Thus, clients can pick a minimum increment that won't cause too much
pain for them.  2^32 might be enough for clients that don't mind
making a request every 4Gb or so, and it might make sense to start
with "smaller" increments like that to avoid triggering
incompatibility problems.

Adding some amount of randomness will provide greater surety that the
server has read and understood the request.  e.g.,

aslv = lastByte + 2**32 + random(2**32)
request.setHeader('Content-Range, 'bytes %d-%d/*' % (lastByte, aslv)