Re: Byte range PATCH

Roberto Polli <robipolli@gmail.com> Tue, 09 August 2022 08:18 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 AFA47C15A73A for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 9 Aug 2022 01:18:10 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.761
X-Spam-Level:
X-Spam-Status: No, score=-2.761 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.248, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_BLOCKED=0.001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, URIBL_ZEN_BLOCKED_OPENDNS=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 ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0oyMvD52ePIb for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 9 Aug 2022 01:18:06 -0700 (PDT)
Received: from lyra.w3.org (lyra.w3.org [128.30.52.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id C0CDBC15A733 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Tue, 9 Aug 2022 01:18:06 -0700 (PDT)
Received: from lists by lyra.w3.org with local (Exim 4.94.2) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1oLKQ8-00FzYr-3l for ietf-http-wg-dist@listhub.w3.org; Tue, 09 Aug 2022 08:17:00 +0000
Resent-Date: Tue, 09 Aug 2022 08:17:00 +0000
Resent-Message-Id: <E1oLKQ8-00FzYr-3l@lyra.w3.org>
Received: from mimas.w3.org ([128.30.52.79]) by lyra.w3.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from <robipolli@gmail.com>) id 1oLKQ7-00FzY2-Gl for ietf-http-wg@listhub.w3.org; Tue, 09 Aug 2022 08:16:59 +0000
Received: from mail-il1-x133.google.com ([2607:f8b0:4864:20::133]) by mimas.w3.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from <robipolli@gmail.com>) id 1oLKQ5-00Aiie-UH for ietf-http-wg@w3.org; Tue, 09 Aug 2022 08:16:59 +0000
Received: by mail-il1-x133.google.com with SMTP id j20so6132008ila.6 for <ietf-http-wg@w3.org>; Tue, 09 Aug 2022 01:16:57 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc; bh=ZpOKk9mBZtFO1NcpXgAcnJmXgi7Uo+51yHwr5fIEPuc=; b=ieN65IOY0iERi3y0qsD3K9YpxQS8jqnPe5txpHx4U1+lCavu6tB194vVTFpQP6sEQx obP0zaya9Wd2O2XNFyBnLTxUrF26hVXlqUh/dGL78wUGLdFKucqxghu71ZlXiNshUU4d W62SibUu6CWn3YRgYXKf/E/yMGe2kcFTW1sjmBs4cOUmRaohRy6Bk1MLZnkoNvRz1pNL II6lGtxcFCRYowV3WmCXLGtdbxiOePopbOy42wKLrfPpow4XIiEA2lc2339IaLMGnyq3 VF2y35iu8gFxXYKZ/hjkO+YBtpvonjlfmWIgsm+fwe2hwvrI4wNXmj7BFT24Qrrlwxig iL/Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc; bh=ZpOKk9mBZtFO1NcpXgAcnJmXgi7Uo+51yHwr5fIEPuc=; b=PhOU0EEBjmPuXPzOMdwVd9x5lxJaVt+hGY9+WVXMoH48jIOFlJ4qwmvLpsh5AbjqgP Ik1fspMK6iN5rwBTC9GsepPjiRc8+zP82fo0bcDwOAp48hX/F5MZb4KO4749/JLVSbMZ kAvYLTHzS80PZMVbkQLFvGJywH8OxGgAhhNh+S0f9oeNiDEfGPEY7xSHtCq4XAX99yfX bS+o+n+Eiks9YmN3OlrgQMcO/AjT1Kr0HXzEBwyZAgT+RZggzMemeOgML8mA90XcbW+Q b8ipLbM5t0IyuDZFPe91Azvu+O5hVVwdf+jCeY1ZsrgahzXiKThS8U1qtdF2PhjrJ0yq 38Tw==
X-Gm-Message-State: ACgBeo3z+6yTd2O1C7i1aCAMVFMaOTTu8ondVkt+wQ4FlleSOMwhn5kA dQyMDUvrtDEravmZtiNO+uoegXzHS/4drJB0BZ/rfY17G5zuUA==
X-Google-Smtp-Source: AA6agR4al4511QTxKYsau1r1H6Dj3yoXojM+3+CQpgqcpFOx4/q2DAckNjBbBiouIddCYEJkYHXtzuFK0yCFyHXeUzQ=
X-Received: by 2002:a92:cc04:0:b0:2de:1abf:7414 with SMTP id s4-20020a92cc04000000b002de1abf7414mr9956012ilp.119.1660033006940; Tue, 09 Aug 2022 01:16:46 -0700 (PDT)
MIME-Version: 1.0
References: <E511F4BD-B422-46DA-8409-EBBD684098A6@bzfx.net> <CAP9qbHWtNL+U1XBHi5566S54wV2iazk2TnwZSKA5NtRVswkd=w@mail.gmail.com> <42C78A97-9CEF-46D7-B44E-3EBB09D7E243@bzfx.net>
In-Reply-To: <42C78A97-9CEF-46D7-B44E-3EBB09D7E243@bzfx.net>
From: Roberto Polli <robipolli@gmail.com>
Date: Tue, 09 Aug 2022 10:16:36 +0200
Message-ID: <CAP9qbHUjfvjOcJAbUAm9sxiX0NShtJfcQeoCp5M38NNUugoF2w@mail.gmail.com>
To: Austin William Wright <aaa@bzfx.net>
Cc: ietf-http-wg@w3.org
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=2607:f8b0:4864:20::133; envelope-from=robipolli@gmail.com; helo=mail-il1-x133.google.com
X-W3C-Hub-DKIM-Status: validation passed: (address=robipolli@gmail.com domain=gmail.com), signature is good
X-W3C-Hub-Spam-Status: No, score=-6.1
X-W3C-Hub-Spam-Report: BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, W3C_AA=-1, W3C_DB=-1, W3C_IRA=-1, W3C_WL=-1
X-W3C-Scan-Sig: mimas.w3.org 1oLKQ5-00Aiie-UH 331346ac1e1c1553da520461c4863481
X-Original-To: ietf-http-wg@w3.org
Subject: Re: Byte range PATCH
Archived-At: <https://www.w3.org/mid/CAP9qbHUjfvjOcJAbUAm9sxiX0NShtJfcQeoCp5M38NNUugoF2w@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/40323
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: <https://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>

Hi Austin,

replies inline.

Il giorno mar 9 ago 2022 alle ore 07:31 Austin William Wright
<aaa@bzfx.net> ha scritto:
> About Digest, it won't help in requests because  PATCH request content
> conveys the checksum of the enclosed representation.
> My understanding of the Digest header (RFC 3230) is that, it is the digest of the entire representation, and not necessarily the body of the message.
> The Digest header does not describe usage in requests, but there’s only a few ways that it could be useful.

Please, see this I-D which explains in detail how Digest (better, the
new Repr-Digest)
works https://httpwg.org/http-extensions/draft-ietf-httpbis-digest-headers.html#section-3.1-5

> In any event, my remark about Digest was nothing more than a cute idea, but maybe we should think about it more.
I really think that a mechanism to update specific parts of a
representation requires a Digest-like mechanism.
PATCH does not specify the representation metadata of the resource you
are updating, but only the metadata of the patch document.
Of course, we could define the behavior of Digest when used in a
message/byterange, provided that the Content-Type
is the one of the selected representation data.

```
PATCH /uploads/foo HTTP/1.1
Content-Type: message/byterange
Content-Length: 283
Accept: video/mp4
If-None-Match: *

Content-Type: video/mp4
Repr-Digest: sha256=:LCa0a2j/xo/5m0U8HTBBNBNCLXBkg7+g+YpeiGJm564=:
Content-Range: bytes 200-399/600
Content-Length: 200

[...]
```

https://httpwg.org/http-extensions/draft-ietf-httpbis-digest-headers.html#appendix-B.9


> The purpose of using the media type is because Content-Range is not reliable in requests.

This is a discussion that periodically comes up: for "is not reliable"
you mean that it's not standard, right?

> About sending multiple ranges in a single request, is it possible to
> use some mechanism such as Expect or similar to allow the client to
> send separate ranges?
>
>
> Can you give an example? “Expect" is not reliably implemented in servers, though I’m not sure why it would be necessary here even if it was.

I am just handwaving, but it could be something like that. Replace
100-continue with whatever similar mechanism.


PATCH /file
Expect-Ranges: ranges=3, status=100

Content-Range: bytes 0-199/600
Content-Type: text/plain
Content-Length: 200

[..]

HTTP/1.1 100 Continue

Content-Range: bytes 200-399/600
Content-Type: text/plain
Content-Length: 200

[..]

HTTP/1.1 100 Continue

Content-Range: bytes 400-599/600
Content-Type: text/plain
Content-Length: 200

[..]

HTTP/1.1 200 OK


> I don’t believe multipart/byteranges would be useful for resumable uploads.
> Resumable uploads is just one use that I foresee, among other uses.
> For example, "multipart/byteranges" might be used to append data to the end of a WAV audio file, [..]
> there’s several regions that need to be updated at the same time.
Ok. Have you already read the TUS spec? There's an ongoing discussion in httpapi
https://datatracker.ietf.org/doc/draft-tus-httpbis-resumable-uploads-protocol/

Have a nice day,
R.