WebDAV BIND question: specifics of COPY behavior

Julian Reschke <julian.reschke@gmx.de> Mon, 08 June 2009 11:59 UTC

Return-Path: <w3c-dist-auth-request@listhub.w3.org>
X-Original-To: ietfarch-webdav-archive@core3.amsl.com
Delivered-To: ietfarch-webdav-archive@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id CA65A3A6846 for <ietfarch-webdav-archive@core3.amsl.com>; Mon, 8 Jun 2009 04:59:50 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.605
X-Spam-Level:
X-Spam-Status: No, score=-6.605 tagged_above=-999 required=5 tests=[AWL=0.494, BAYES_00=-2.599, J_CHICKENPOX_91=0.6, MANGLED_OFF=2.3, RCVD_IN_DNSWL_HI=-8, SARE_BAYES_5x7=0.6]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4sIO0E0i7scQ for <ietfarch-webdav-archive@core3.amsl.com>; Mon, 8 Jun 2009 04:59:49 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) by core3.amsl.com (Postfix) with ESMTP id AB8C73A6829 for <webdav-archive@lists.ietf.org>; Mon, 8 Jun 2009 04:59:49 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.63) (envelope-from <w3c-dist-auth-request@listhub.w3.org>) id 1MDdUX-0003Ui-Sp for w3c-dist-auth-dist@listhub.w3.org; Mon, 08 Jun 2009 11:58:17 +0000
Received: from bart.w3.org ([128.30.52.63]) by frink.w3.org with esmtp (Exim 4.63) (envelope-from <julian.reschke@gmx.de>) id 1MDdUW-0003Tz-Vc for w3c-dist-auth@listhub.w3.org; Mon, 08 Jun 2009 11:58:16 +0000
Received: from mail.gmx.net ([213.165.64.20]) by bart.w3.org with smtp (Exim 4.63) (envelope-from <julian.reschke@gmx.de>) id 1MDdUR-0003fd-3y for w3c-dist-auth@w3.org; Mon, 08 Jun 2009 11:58:16 +0000
Received: (qmail invoked by alias); 08 Jun 2009 11:57:38 -0000
Received: from mail.greenbytes.de (EHLO [192.168.1.106]) [217.91.35.233] by mail.gmx.net (mp017) with SMTP; 08 Jun 2009 13:57:38 +0200
X-Authenticated: #1915285
X-Provags-ID: V01U2FsdGVkX19P2SNduYlPhdO3BQ34Z0+xC2xp2JW9pet9iW0c+E pH6CZT7y4z+mcT
Message-ID: <4A2CFCAB.4090505@gmx.de>
Date: Mon, 08 Jun 2009 13:57:31 +0200
From: Julian Reschke <julian.reschke@gmx.de>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.0.4) Gecko/20060516 Thunderbird/1.5.0.4 Mnenhy/0.7.4.666
MIME-Version: 1.0
To: WebDAV <w3c-dist-auth@w3.org>
Content-Type: text/plain; charset="ISO-8859-1"; format="flowed"
Content-Transfer-Encoding: 7bit
X-Y-GMX-Trusted: 0
X-FuHaFi: 0.51
Received-SPF: pass
X-SPF-Guess: pass
X-W3C-Hub-Spam-Status: No, score=-2.6
X-W3C-Hub-Spam-Report: BAYES_00=-2.599, SPF_PASS=-0.001
X-W3C-Scan-Sig: bart.w3.org 1MDdUR-0003fd-3y 83f06cd48d4dd135a033730984440026
X-Original-To: w3c-dist-auth@w3.org
Subject: WebDAV BIND question: specifics of COPY behavior
Archived-At: <http://www.w3.org/mid/4A2CFCAB.4090505@gmx.de>
Resent-From: w3c-dist-auth@w3.org
X-Mailing-List: <w3c-dist-auth@w3.org> archive/latest/13128
X-Loop: w3c-dist-auth@w3.org
Sender: w3c-dist-auth-request@w3.org
Resent-Sender: w3c-dist-auth-request@w3.org
Precedence: list
List-Id: <w3c-dist-auth.w3.org>
List-Help: <http://www.w3.org/Mail/>
List-Unsubscribe: <mailto:w3c-dist-auth-request@w3.org?subject=unsubscribe>
Resent-Message-Id: <E1MDdUX-0003Ui-Sp@frink.w3.org>
Resent-Date: Mon, 08 Jun 2009 11:58:17 +0000

Hi,

the following question reached me off-list:

 > - Section 2.3.2: I'm not sure if allowing undefined behaviour in this
 > case is a good or bad idea. It seems like it might surprise a
 > potential user.

So this refers to the (new, as of version -24) example in 2.3.2, and to 
the spec text in 
<http://greenbytes.de/tech/webdav/draft-ietf-webdav-bind-24.html#rfc.section.2.3.p.4>:

"If a COPY request causes an existing resource to be updated, the 
bindings to that resource MUST be unaffected by the COPY request. Using 
the preceding example, suppose that a COPY request is issued to URI-X 
for resource R', with the Destination header set to URI-2. The content 
and dead properties of resource R would be updated to be a copy of those 
of resource R', but the mappings from URI-1, URI-2, and URI-3 to 
resource R remain unaffected. If because of multiple bindings to a 
resource, more than one source resource updates a single destination 
resource, the order of the updates is server defined (see Section 2.3.2 
for an example)."

Answer: it is very hard to specify the behavior for COPY when 
overwriting existing resources, even in absence of multiple bindings.

RFC 2518 started with a very simplistic view:

"If a resource exists at the destination and the Overwrite header is "T" 
then prior to performing the copy the server MUST perform a DELETE with 
"Depth: infinity" on the destination resource. If the Overwrite header 
is set to "F" then the operation will fail." -- 
<http://greenbytes.de/tech/webdav/rfc2518.html#rfc.section.8.8.4>

That proved to be too simple, because it means that copying *to* a 
version-controlled resource always wipes out the versioning meta data. 
Thus RFC 3253 changed it to:

"RFC 2518, Section 8.8.4 states:

"If a resource exists at the destination and the Overwrite header is "T" 
then prior to performing the copy the server MUST perform a DELETE with 
"Depth: infinity" on the destination resource."

The purpose of this sentence is to ensure that following a COPY, all 
destination resources have the same content and dead properties as the 
corresponding resources identified by the request-URL (where a resource 
with a given name relative to the Destination URL "corresponds" to a 
resource with the same name relative to the request-URL). If at the time 
of the request, there already is a resource at the destination that has 
the same resource type as the corresponding resource at the request-URL, 
that resource MUST NOT be deleted, but MUST be updated to have the 
content and dead properties of its corresponding member. If a client 
wishes all resources at the destination to be deleted prior to the COPY, 
it MUST explicitly issue a DELETE request.

The difference between updating a resource and replacing a resource with 
a new resource is especially important when resource history is being 
maintained (the former adds to an existing history, while the latter 
creates a new history). In addition, locking and access control 
constraints might allow you to update a resource, but not allow you to 
delete it and create a new one in its place.

Note that this clarification does not apply to a MOVE request. A MOVE 
request with Overwrite:T MUST perform the DELETE with "Depth:infinity" 
on the destination resource prior to performing the MOVE." -- 
<http://greenbytes.de/tech/webdav/rfc3253.html#rfc.section.1.7>

This is also reflected in the revision of RFC 2518, RFC 4918:

"If a COPY request has an Overwrite header with a value of "F", and a 
resource exists at the Destination URL, the server MUST fail the request.

When a server executes a COPY request and overwrites a destination 
resource, the exact behavior MAY depend on many factors, including 
WebDAV extension capabilities (see particularly [RFC3253]). For example, 
when an ordinary resource is overwritten, the server could delete the 
target resource before doing the copy, or could do an in-place overwrite 
to preserve live properties.

When a collection is overwritten, the membership of the destination 
collection after the successful COPY request MUST be the same membership 
as the source collection immediately before the COPY. Thus, merging the 
membership of the source and destination collections together in the 
destination is not a compliant behavior.

In general, if clients require the state of the destination URL to be 
wiped out prior to a COPY (e.g., to force live properties to be reset), 
then the client could send a DELETE to the destination before the COPY 
request to ensure this reset." -- 
<http://greenbytes.de/tech/webdav/rfc4918.html#rfc.section.9.8.4>

In general, clients always have the choice of deleting the target 
resource explicitly. In that case, the BIND spec already says the server 
SHOULD preserve the binding structure:

"If a COPY request would cause a new resource to be created as a copy of 
an existing resource, and that COPY request has already created a copy 
of that existing resource, the COPY request instead creates another 
binding to the previous copy, instead of creating a new resource (see 
Section 2.3.3 for an example)." -- 
<http://greenbytes.de/tech/webdav/draft-ietf-webdav-bind-24.html#rfc.section.2.3.p.5>

For the case discussed in 2.3.2, it just didn't seem sensible to require 
a specific choice; whatever we could have chosen might have been hard to 
implement on specific backends (where the copy process get's delegated 
to a storage system that is independent of WebDAV).

BR, Julian