Re: Byte range PATCH

Austin William Wright <aaa@bzfx.net> Sat, 06 August 2022 02:21 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 B06CDC16ECA2 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Fri, 5 Aug 2022 19:21:44 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.759
X-Spam-Level:
X-Spam-Status: No, score=-2.759 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_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 8vFH1J7Wlxp4 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Fri, 5 Aug 2022 19:21:39 -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 5BB69C14F75F for <httpbisa-archive-bis2Juki@lists.ietf.org>; Fri, 5 Aug 2022 19:21:38 -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 1oK9RM-007OCe-Mh for ietf-http-wg-dist@listhub.w3.org; Sat, 06 Aug 2022 02:21:24 +0000
Resent-Date: Sat, 06 Aug 2022 02:21:24 +0000
Resent-Message-Id: <E1oK9RM-007OCe-Mh@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 1oK9RL-007OBD-W8 for ietf-http-wg@listhub.w3.org; Sat, 06 Aug 2022 02:21:23 +0000
Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) 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 1oK9RJ-00Bcf9-7B for ietf-http-wg@w3.org; Sat, 06 Aug 2022 02:21:22 +0000
Received: by mail-pl1-x62a.google.com with SMTP id d16so4041736pll.11 for <ietf-http-wg@w3.org>; Fri, 05 Aug 2022 19:21:20 -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=ohVkDNgu7GzecAK+9n+DZ63merqrjoLWcd0tYbuZYK4=; b=XuBOQ5j0bTFvCt9yj58mJpLhLc42b7Ko9xAm0ZVftNrPjMb6cZuMxKITNqLrMB473d GuSSaQ8wCbpuh+8nv4WF+iW37d2sQUkwD0o1wVdKH3PlwbgDf/FCO5DAjGzNgVc/9j0s uSiDwsgq2T0xbIVFuBj8rEMngo3cH69hwJt1o=
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=ohVkDNgu7GzecAK+9n+DZ63merqrjoLWcd0tYbuZYK4=; b=wswr4jCFZgRVUIsteg4lFLoASPg3vfis18S99HTSKNzFtJl+x5KSK99J2KGT/8cXqI vR2xDTCS8P8mG5Dk2qw2Yjpikb/oI1o/YnC+DvZxaAzDBpWiVnGmK93olYSdXA6Xe837 dSsIH9fKQHXlk1iOU0iVtVfc7/IoMFr2Z8Rfyj7CJErkhrPA0zvcj7Av0gekA8Hde7t4 a0LGrIZfnYyxK9BMJGkjgTQq6sAxORUD3e68rxix++wvWPWZANr0oF6yUgGPZy9QC+We GqITv5iedapDiri34RLg79mUjVpr37N51RB2kF5XwNHuUivswUHU1BjlssM5r8fyw0/C ALXg==
X-Gm-Message-State: ACgBeo2SgRVYmSd4XyycR2tnoU7qr+/Heu2QaYorJ4DAlY54baMQRvox dhUUEF98ENoPVWsVEzySOZnT9Yi3FG/KQA==
X-Google-Smtp-Source: AA6agR56D5ptI6qk2C+bsGP2KTNcoPkkYW6DWqyRkUZteXCt1NIFmlm3w7LJmFdHc2nxtsobGvElNQ==
X-Received: by 2002:a17:90b:2407:b0:1ec:dd93:511a with SMTP id nr7-20020a17090b240700b001ecdd93511amr19054274pjb.212.1659752469840; Fri, 05 Aug 2022 19:21:09 -0700 (PDT)
Received: from smtpclient.apple (71-223-183-211.phnx.qwest.net. [71.223.183.211]) by smtp.gmail.com with ESMTPSA id g2-20020a17090a7d0200b001f069352d73sm3648800pjl.25.2022.08.05.19.21.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Aug 2022 19:21:09 -0700 (PDT)
From: Austin William Wright <aaa@bzfx.net>
Message-Id: <3C2712C9-A569-4768-B317-F3784B3A952E@bzfx.net>
Content-Type: multipart/alternative; boundary="Apple-Mail=_00BF1F93-E489-4123-8BD9-FBA2076B0165"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\))
Date: Fri, 05 Aug 2022 19:21:08 -0700
In-Reply-To: <1826f5936e3.12880653a24925.7175395345130599948@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> <41c96787-7330-e9e0-da59-68c6dd197c58@gmx.de> <98341B31-B3A9-46C9-B755-8265CC478664@bzfx.net> <1826f5936e3.12880653a24925.7175395345130599948@zoho.com>
X-Mailer: Apple Mail (2.3696.120.41.1.1)
Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=aaa@bzfx.net; helo=mail-pl1-x62a.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 1oK9RJ-00Bcf9-7B a4c8be1bac6b51293184c008249c6c86
X-Original-To: ietf-http-wg@w3.org
Subject: Re: Byte range PATCH
Archived-At: <https://www.w3.org/mid/3C2712C9-A569-4768-B317-F3784B3A952E@bzfx.net>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/40307
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 5, 2022, at 11:51, Eric J Bowman <mellowmutt@zoho.com> wrote:
> 
> >
> > 2. It allows segments to express HTTP semantics; for example,
> > creating a resource relies on attaching a Content-Type field. You
> > might even attach a Digest field indicating the expected hash of
> > the final resource.
> >
> 
> Resources are not created. They are defined by the creation of 1+n representations which also convey the (temporal) state of the resource. My httpd uses XProc 3 as its configuration language, so it's trivial to accept a PATCH of text/plain and run it through two XSLT stylesheets, resulting in (synchronized) HTML and PDF representations.

Could you please suggest a different phrasing?

Despite the technical definition of a resource, “create” is still an unambiguous term (it’s relative to the current moment in time), and appropriate here: What’s important is that previously the server would return 404 (Not Found) and now it returns 200 (OK). And presumably, the operation that caused this change responded 201 (Created).

> If the client and server have the same copy of the XSLT in question, yes a Digest header can perform a CRC.
> 
> I don't grok "final resource". I do grok "final resource state" resulting from some change request.

“Final resource state” is a good suggestion.

> If a PATCH request is just some plaintext, I still don't see where it makes sense to "create" anything. I do think it should be identified as text/plain, but I don't think that should be coupled to any "file format" returned by the server on GET/HEAD.

PATCH may create resources, depending on how the media type is defined. If I’m using PATCH on a resource that doesn’t exist (404 Not Found), then there’s only one useful thing that that request could possibly be asking for (i.e. create the resource). There’s also conditional request headers to require (If-None-Match: *) or prohibit (If-Match: *) this creation behavior.

If this weren’t able to create the resource, I would have to use a PUT to create it, and there would be no way to indicate, during this operation, the “intended final length” of the resource.

> 
> For the sake of argument, all my httpd does is filter requests and responses over a FastCGI interface to WordPress running in a BSD jail. Let's hypothetically enable PATCH support on WP. Every malformed PATCH request which makes it through to WP shall be considered a design failure.
> 
> Which has me preferring a multipart/* solution over a message/* solution, in general. Despite the parsing required, at least it's possible (and with well-known media types) to head 'em off at the pass (intermediaries, front-end), so WP only ever gets validated and sanitized requests its (hypothetical) PATCH extension understands.

It is also possible to validate message/byterange: It’s identical to an HTTP message without the "start-line", and you can validate it with a regular expression (which is impossible with multipart/*).

> 
> Sure, your way I could use Content-Type to indicate this byte-range of plaintext is meant to update either an application/pdf or text/html representation. Sure, the client could repeat the PATCH request with another Content-Type, at the cost of synchronicity. Which while allowed, is I think a bad practice I first read about in TBL's old work that I'm too busy to dig up atm.
> 
> But it's why the world eschewed language negotiation (representations of the same resource) vs. en. es. de. fr. etc. wikipedia.org -- each variant language is a discrete resource rather than a translation (variant representations); because they're not synchronized, they have their own independent state. The definition of the resource, then, varies by language. Not the representations.
> 
> For me, hardest thing to wrap my head around in REST architecture is the resource/representation dichotomy (or Force Dyad lol). Because, thanks to caching, we can even have multiple temporal variants of the same representation, floating around out there at any given moment (even with the same media type), representing different resource states. Without changing the definition of the resource.

I’m not sure what the practical effect of this is; PATCH and caching both have well-defined semantics that play nicely with each other. (Generally a client knows when it’s getting a cached copy instead of an origin response, and conditional requests can avoid lost writes if the client’s cached copy is outdated.)

Thanks,

Austin.