Re: Byte range PATCH

Austin William Wright <aaa@bzfx.net> Tue, 09 August 2022 17:30 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 18543C14F606 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 9 Aug 2022 10:30:00 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.748
X-Spam-Level:
X-Spam-Status: No, score=-2.748 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, HTML_MESSAGE=0.001, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_BLOCKED=0.001, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_PASS=-0.001, T_MIME_MALF=0.01, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=bzfx.net
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 WyDGTJBuyO-Y for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 9 Aug 2022 10:29:55 -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 7AB4CC14F722 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Tue, 9 Aug 2022 10:29:54 -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 1oLT13-00HVZi-Ix for ietf-http-wg-dist@listhub.w3.org; Tue, 09 Aug 2022 17:27:41 +0000
Resent-Date: Tue, 09 Aug 2022 17:27:41 +0000
Resent-Message-Id: <E1oLT13-00HVZi-Ix@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 <aaa@bzfx.net>) id 1oLT11-00HVYg-Lg for ietf-http-wg@listhub.w3.org; Tue, 09 Aug 2022 17:27:39 +0000
Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by mimas.w3.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from <aaa@bzfx.net>) id 1oLT0z-00AyJI-LP for ietf-http-wg@w3.org; Tue, 09 Aug 2022 17:27:39 +0000
Received: by mail-pg1-x532.google.com with SMTP id 12so11983755pga.1 for <ietf-http-wg@w3.org>; Tue, 09 Aug 2022 10:27:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bzfx.net; s=google; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=WvD1H5xNBQ9uEKdjSCfhtDUHjLPe3JQRIo6InvDwanU=; b=qPB9uq5//d1asovwUQ5ZD+V7dSK0+3lMWOnJVeqf35hJHAI+ZrdGVHw5s0q+dkS0Fp 0HiQBJNgx1DXjsrr2VMuKxtP42pmM4DCXCyxMKBr1t8Tq6FxZgyga9KlIkZUcXm5AJAr PVc+L5yi49AJU2skYqneeGp3twsYfd/7KLTRw=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=WvD1H5xNBQ9uEKdjSCfhtDUHjLPe3JQRIo6InvDwanU=; b=cukiazHnDTVsb2BFOy8avNb8oxbxViTquYLr6XJ0wdeiX2oooXboRRksTnnGBXSMKI LpVQzsSgRuxlAszaDCL6Dd2QnkEosCK9tQIeMrC861LNPx/ajPkBVfaN2TWPFnEEcd9W Tnb5Erold+iH5vibXW/5aLSdY3uTaxniCnraLGI25oLAoWgfr7hc0iwsi+RW580OS1bL sgWzXHZiH4xriXqOKSGv9MLJAr252GYkim/HIRRPjuvqRwhVZUvqt42NhtPHDpUwDrsl ODskPF1+aBs9LsuQUze5K0g7qXIstgmHrPWPSZcgajik/DiMB7708dBZPb5aArVl6don aC3g==
X-Gm-Message-State: ACgBeo3yNIfgNWbYEwa3XpOoancovRLnhy3lhYqtsXdYs/PK+3222crf k4g+UVdDNREzl6iR7HWHhVYm3+2/WpuVEg==
X-Google-Smtp-Source: AA6agR5nZ68fLxqTuEE/+K4IHZk5Y3rlS/Tr222/jWpyIiwemKRgCfIlNn3km9dOt1UthEaxFnL3VQ==
X-Received: by 2002:a63:4b5e:0:b0:41d:e04b:4515 with SMTP id k30-20020a634b5e000000b0041de04b4515mr1189835pgl.100.1660066046143; Tue, 09 Aug 2022 10:27:26 -0700 (PDT)
Received: from smtpclient.apple (71-223-183-211.phnx.qwest.net. [71.223.183.211]) by smtp.gmail.com with ESMTPSA id jj5-20020a170903048500b0016f15ea1cb2sm11154116plb.51.2022.08.09.10.27.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Aug 2022 10:27:24 -0700 (PDT)
From: Austin William Wright <aaa@bzfx.net>
Message-Id: <15D7F028-69B9-44C7-942E-CFC67114158E@bzfx.net>
Content-Type: multipart/alternative; boundary="Apple-Mail=_7D42DE2A-6635-43CD-85F1-08BA98B8548C"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\))
Date: Tue, 09 Aug 2022 10:27:23 -0700
In-Reply-To: <CAP9qbHUjfvjOcJAbUAm9sxiX0NShtJfcQeoCp5M38NNUugoF2w@mail.gmail.com>
Cc: ietf-http-wg@w3.org
To: Roberto Polli <robipolli@gmail.com>
References: <E511F4BD-B422-46DA-8409-EBBD684098A6@bzfx.net> <CAP9qbHWtNL+U1XBHi5566S54wV2iazk2TnwZSKA5NtRVswkd=w@mail.gmail.com> <42C78A97-9CEF-46D7-B44E-3EBB09D7E243@bzfx.net> <CAP9qbHUjfvjOcJAbUAm9sxiX0NShtJfcQeoCp5M38NNUugoF2w@mail.gmail.com>
X-Mailer: Apple Mail (2.3696.120.41.1.1)
Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=aaa@bzfx.net; helo=mail-pg1-x532.google.com
X-W3C-Hub-DKIM-Status: validation passed: (address=aaa@bzfx.net domain=bzfx.net), 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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_MIME_MALF=0.01, 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 1oLT0z-00AyJI-LP 33685b5ee00639f0090e12bc64b6c1ae
X-Original-To: ietf-http-wg@w3.org
Subject: Re: Byte range PATCH
Archived-At: <https://www.w3.org/mid/15D7F028-69B9-44C7-942E-CFC67114158E@bzfx.net>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/40326
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>

> On Aug 9, 2022, at 01:16, Roberto Polli <robipolli@gmail.com> wrote:
> 
> 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

Oh, I didn’t realize this was in the process of being updated. I’ll take a look.

> 
>> 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?

Even if Content-Range was supported in PUT from the start, or if HTTP had defined it in requests, it might still be unreliable if too many servers forget to check it.

By putting the Content-Range in a media type, in a method, it’s inside two extension points that the server cannot ignore.

> 
>> 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 see, what would a client use a 100 Continue response for? Normally it tells the client that it can begin uploading, but it appears the client isn’t waiting.

If all you need to do is bundle multiple parts together, is what "multipart/*" accomplishes. Your example appears to be similar, except using Content-Length instead of a boundary:
https://www.rfc-editor.org/rfc/rfc2046#section-5.1 <https://www.rfc-editor.org/rfc/rfc2046#section-5.1>

And if the client needs to know that each part was valid before uploading the next part, it can just fire off multiple PATCH requests.

>> 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/

Yes, I’ve been providing some feedback.

To be clear, "message/byterange" would be better for resumable uploads. You could use "multipart/byteranges” but it's slower to parse if the client doesn’t send Content-Length in a part.

Thanks,

Austin.