Re: Byte range PATCH

Austin William Wright <aaa@bzfx.net> Tue, 09 August 2022 18:45 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 91D91C157B56 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 9 Aug 2022 11:45:00 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -5.059
X-Spam-Level:
X-Spam-Status: No, score=-5.059 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_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_PASS=-0.001, 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 acquLss3LuZi for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 9 Aug 2022 11:44: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 A722CC14F726 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Tue, 9 Aug 2022 11:44:55 -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 1oLUBN-0007s9-92 for ietf-http-wg-dist@listhub.w3.org; Tue, 09 Aug 2022 18:42:25 +0000
Resent-Date: Tue, 09 Aug 2022 18:42:25 +0000
Resent-Message-Id: <E1oLUBN-0007s9-92@lyra.w3.org>
Received: from titan.w3.org ([128.30.52.76]) 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 1oLUBM-0007rC-6p for ietf-http-wg@listhub.w3.org; Tue, 09 Aug 2022 18:42:24 +0000
Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by titan.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 1oLUBK-00DDvZ-Dr for ietf-http-wg@w3.org; Tue, 09 Aug 2022 18:42:23 +0000
Received: by mail-pl1-x636.google.com with SMTP id m2so12148285pls.4 for <ietf-http-wg@w3.org>; Tue, 09 Aug 2022 11:42:21 -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=uCyh/Wr+JNhzIcjWv7RRj4Y9DYjA70KmOnlkAZ+Mc6w=; b=aZTkNWqoYYOMU1yLTRBhTBjRKzXPdscNXDp8uOeVkF99AiLa8LYzAfuLyLNEaZX0yT DnPS5JNRKuwqzCjctxl3Z+eIbs7XZoE3tYlg1xIvMF8ifUKXVuZKXDeWVcDeC0+CJVdN 9NplKyKYAeCQiM6IF7xw9h5Us40ld1H8XK34o=
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=uCyh/Wr+JNhzIcjWv7RRj4Y9DYjA70KmOnlkAZ+Mc6w=; b=GMaUHtD48Je3FUzxmYIZJ3th4LezTiSY0+gcTq7a6iY4GqGo06j5wP8A3kSCff3hux IGLScd8wQ6ipskjrO3L8DpUzm9o4o1AIGL6GaDi3eiw9ThXDurSkb3kdlmwpKmJqKfR6 GY8CX/n0C518L1zubd8I0U7M3PLCEyMYYtTJ2095ee3xbLOdowkjgdHySZZ7OWg5hkJg bfUS8ARIyxCQX0w6Z3t0ECmWBkm00nCPZTafNq7hmbSqGJYhwwqPMNZ1i7oNGPfuU+yV cKmoP8AOra/z9tzaF0/ILRL++/2ujLLu8xjNR/f9AafoxrI1+8yy8rg6Lvi08ZxVQ1jj ReOw==
X-Gm-Message-State: ACgBeo2D5mvaQ09fe5j4604sSWHeZphYDBQFtmtg1PlV9lCMD4i+DguX 6STvnwtOGXiljP2sLZun9DEl2s6EdnXotw==
X-Google-Smtp-Source: AA6agR5YxxoM5Wf40EF8ktjRd64EEwOQcWDnsPS1m19/YGQcWuUWQEBbAW6znS2KHOJ7R10Wz8ja9A==
X-Received: by 2002:a17:903:32ca:b0:16f:1c87:9ecd with SMTP id i10-20020a17090332ca00b0016f1c879ecdmr25351104plr.54.1660070530932; Tue, 09 Aug 2022 11:42:10 -0700 (PDT)
Received: from smtpclient.apple (71-223-183-211.phnx.qwest.net. [71.223.183.211]) by smtp.gmail.com with ESMTPSA id s10-20020a170903200a00b0016ccbc9db0fsm11090886pla.5.2022.08.09.11.42.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Aug 2022 11:42:09 -0700 (PDT)
From: Austin William Wright <aaa@bzfx.net>
Message-Id: <858E60E4-CC36-4CC8-8D8D-A3C5FB30AA13@bzfx.net>
Content-Type: multipart/alternative; boundary="Apple-Mail=_4584651D-0044-4788-AA62-F34F2C3E833C"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\))
Date: Tue, 09 Aug 2022 11:42:08 -0700
In-Reply-To: <1828133d77b.10112854770874.8646090352104563359@zoho.com>
Cc: ietf-http-wg <ietf-http-wg@w3.org>
To: Eric J Bowman <mellowmutt@zoho.com>
References: <E511F4BD-B422-46DA-8409-EBBD684098A6@bzfx.net> <CAP9qbHWtNL+U1XBHi5566S54wV2iazk2TnwZSKA5NtRVswkd=w@mail.gmail.com> <1828086138e.d0af5fbd69268.3210279692370972800@zoho.com> <734BB380-2BA8-45C2-BECB-2C33129FB168@bzfx.net> <1828133d77b.10112854770874.8646090352104563359@zoho.com>
X-Mailer: Apple Mail (2.3696.120.41.1.1)
Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=aaa@bzfx.net; helo=mail-pl1-x636.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_SCC_BODY_TEXT_LINE=-0.01, W3C_AA=-1, W3C_DB=-1, W3C_IRA=-1, W3C_WL=-1
X-W3C-Scan-Sig: titan.w3.org 1oLUBK-00DDvZ-Dr f4b84d3fdbc17cab3172a0dcd0bc9030
X-Original-To: ietf-http-wg@w3.org
Subject: Re: Byte range PATCH
Archived-At: <https://www.w3.org/mid/858E60E4-CC36-4CC8-8D8D-A3C5FB30AA13@bzfx.net>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/40328
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 8, 2022, at 23:03, Eric J Bowman <mellowmutt@zoho.com> wrote:
> 
> >
> > PATCH is not causing anyone any trouble.
> >
> 
> Then why is it the redheaded stepchild of HTTP methods, defined by its own RFC as opposed to being part of the core protocol?

Like Julian said, the methods in HTTP Semantics are not an endorsement of what methods you should or should not use.

HTTP Semantics only describes the essential semantics, and PATCH is not essential for understanding HTTP. It’s fine as a separate document.

> >
> > This proposal does not "overload” anything. If anything, 
> > I’m writing this to avoid overloading PUT or POST with 
> > semantics that may be misunderstood by origin servers.
> >
> 
> Did you mean to say intermediaries? No origin server I've ever coded has ever misunderstood anything about the application it's serving, let alone the intended semantics of a chosen method.

No, I mean origin. User agents are not limited to using your interface; they may use any part of the uniform interface, including PATCH, even if the server didn’t indicate so.

PATCH is useful because there's exactly one interpretation. My user-agent can know if it’s idempotent to safely retry the request. In contrast, I cannot guess at what kind of POST request I would have to send you to do the same thing. The only meaning that POST has is the one that the server gives it, and that’s not always transparent or useful.

With PATCH, it’s guaranteed; the worst thing that happens is the server returns 405, 415, or 501; in that case I have to fall back to a PUT request to make the intended changes; which may be wasteful of bandwidth if the file is very large. PATCH lets you express a PUT in terms of the existing resource, so you only need to describe the parts that change. There’s no reason that creation can’t be a change that a client might want to express.

If byte range PATCH doesn't exist, then people might overload PUT with Content-Range headers, or use a POST request, which lack a standardized meaning at best, and can cause data corruption at worst.

> >
> > The PATCH semantics, by contrast, are being used exactly 
> > as intended and understood.
> > 
> 
> Sort of. RFC 5789 included "resource creation" sure. But do you have any examples of PATCH being used that way in the wild?

This proposal should be a sufficient example. If there’s no server that would misunderstand it, and if there’s a client that finds it useful, then there’s no problem.

Also, the “patch” command works exactly this way. The first patch in a series of patches necessarily creates the file. This should not be universe-warping.

> I can't help but wonder if there isn't a good reason it took 12 years for this issue to come up. Like maybe the RFC got it wrong? PATCH's "update" semantics are understood, and (perhaps widely) used as intended.

A PATCH is not necessarily an “update”. (Not everything must fit neatly into CRUD operations.)

PATCH allows a client to alter the current state of the resource according to enclosed instructions; it can represent any PUT operation that takes into account the current state of the resource (including lack thereof).

> Creation, not so much! Never occurred to me that it would be controversial, to think that updating something pre-assumes its existence, and should report an error otherwise. Creation via PATCH falls under my definition of "silent error correction" which makes it a "bad thing" in the HTTP universe.

In a series of patches representing a file’s change history, literally the very first one creates it. Not only does this have precedent, this is essential behavior.

If you don’t want a PATCH request to create a file then either (1) don’t use a media type that does that, or (2) add `If-Match: *` to your request.

Thanks,

Austin.