分享
 
 
 

RFC2518 - HTTP Extensions for Distributed Authoring -- WEBDAV

王朝other·作者佚名  2008-05-31
窄屏简体版  字體: |||超大  

Network Working Group Y. Goland

Request for Comments: 2518 Microsoft

Category: Standards Track E. Whitehead

UC Irvine

A. Faizi

Netscape

S. Carter

Novell

D. Jensen

Novell

February 1999

HTTP Extensions for Distributed Authoring -- WEBDAV

Status of this Memo

This document specifies an Internet standards track protocol for the

Internet community, and requests discussion and suggestions for

improvements. Please refer to the current edition of the "Internet

Official Protocol Standards" (STD 1) for the standardization state

and status of this protocol. Distribution of this memo is unlimited.

Copyright Notice

Copyright (C) The Internet Society (1999). All Rights Reserved.

Abstract

This document specifies a set of methods, headers, and content-types

ancillary to HTTP/1.1 for the management of resource properties,

creation and management of resource collections, namespace

manipulation, and resource locking (collision avoidance).

Table of Contents

ABSTRACT............................................................1

1 INTRODUCTION .....................................................5

2 NOTATIONAL CONVENTIONS ...........................................7

3 TERMINOLOGY ......................................................7

4 DATA MODEL FOR RESOURCE PROPERTIES ...............................8

4.1 The Resource Property Model ...................................8

4.2 Existing Metadata Proposals ...................................8

4.3 Properties and HTTP Headers ...................................9

4.4 Property Values ...............................................9

4.5 Property Names ...............................................10

4.6 Media Independent Links ......................................10

5 COLLECTIONS OF WEB RESOURCES ....................................11

5.1 HTTP URL Namespace Model .....................................11

5.2 Collection Resources .........................................11

5.3 Creation and Retrieval of Collection Resources ...............12

5.4 Source Resources and Output Resources ........................13

6 LOCKING .........................................................14

6.1 Exclusive Vs. Shared Locks ...................................14

6.2 Required Support .............................................16

6.3 Lock Tokens ..................................................16

6.4 opaquelocktoken Lock Token URI Scheme ........................16

6.4.1 Node Field Generation Without the IEEE 802 Address ........17

6.5 Lock Capability Discovery ....................................19

6.6 Active Lock Discovery ........................................19

6.7 Usage Considerations .........................................19

7 WRITE LOCK ......................................................20

7.1 Methods Restricted by Write Locks ............................20

7.2 Write Locks and Lock Tokens ..................................20

7.3 Write Locks and Properties ...................................20

7.4 Write Locks and Null Resources ...............................21

7.5 Write Locks and Collections ..................................21

7.6 Write Locks and the If Request Header ........................22

7.6.1 Example - Write Lock ......................................22

7.7 Write Locks and COPY/MOVE ....................................23

7.8 Refreshing Write Locks .......................................23

8 HTTP METHODS FOR DISTRIBUTED AUTHORING ..........................23

8.1 PROPFIND .....................................................24

8.1.1 Example - Retrieving Named Properties .....................25

8.1.2 Example - Using allprop to Retrieve All Properties ........26

8.1.3 Example - Using propname to Retrieve all Property Names ...29

8.2 PROPPATCH ....................................................31

8.2.1 Status Codes for use with 207 (Multi-Status) ..............31

8.2.2 Example - PROPPATCH .......................................32

8.3 MKCOL Method .................................................33

8.3.1 Request ...................................................33

8.3.2 Status Codes ..............................................33

8.3.3 Example - MKCOL ...........................................34

8.4 GET, HEAD for Collections ....................................34

8.5 POST for Collections .........................................35

8.6 DELETE .......................................................35

8.6.1 DELETE for Non-Collection Resources .......................35

8.6.2 DELETE for Collections ....................................36

8.7 PUT ..........................................................36

8.7.1 PUT for Non-Collection Resources ..........................36

8.7.2 PUT for Collections .......................................37

8.8 COPY Method ..................................................37

8.8.1 COPY for HTTP/1.1 resources ...............................37

8.8.2 COPY for Properties .......................................38

8.8.3 COPY for Collections ......................................38

8.8.4 COPY and the Overwrite Header .............................39

8.8.5 Status Codes ..............................................39

8.8.6 Example - COPY with Overwrite .............................40

8.8.7 Example - COPY with No Overwrite ..........................40

8.8.8 Example - COPY of a Collection ............................41

8.9 MOVE Method ..................................................42

8.9.1 MOVE for Properties .......................................42

8.9.2 MOVE for Collections ......................................42

8.9.3 MOVE and the Overwrite Header .............................43

8.9.4 Status Codes ..............................................43

8.9.5 Example - MOVE of a Non-Collection ........................44

8.9.6 Example - MOVE of a Collection ............................44

8.10 LOCK Method ..................................................45

8.10.1 Operation .................................................46

8.10.2 The Effect of Locks on Properties and Collections .........46

8.10.3 Locking Replicated Resources ..............................46

8.10.4 Depth and Locking .........................................46

8.10.5 Interaction with other Methods ............................47

8.10.6 Lock Compatibility Table ..................................47

8.10.7 Status Codes ..............................................48

8.10.8 Example - Simple Lock Request .............................48

8.10.9 Example - Refreshing a Write Lock .........................49

8.10.10 Example - Multi-Resource Lock Request ....................50

8.11 UNLOCK Method ................................................51

8.11.1 Example - UNLOCK ..........................................52

9 HTTP HEADERS FOR DISTRIBUTED AUTHORING ..........................52

9.1 DAV Header ...................................................52

9.2 Depth Header .................................................52

9.3 Destination Header ...........................................54

9.4 If Header ....................................................54

9.4.1 No-tag-list Production ....................................55

9.4.2 Tagged-list Production ....................................55

9.4.3 not Production ............................................56

9.4.4 Matching Function .........................................56

9.4.5 If Header and Non-DAV Compliant Proxies ...................57

9.5 Lock-Token Header ............................................57

9.6 Overwrite Header .............................................57

9.7 Status-URI Response Header ...................................57

9.8 Timeout Request Header .......................................58

10 STATUS CODE EXTENSIONS TO HTTP/1.1 ............................59

10.1 102 Processing ...............................................59

10.2 207 Multi-Status .............................................59

10.3 422 Unprocessable Entity .....................................60

10.4 423 Locked ...................................................60

10.5 424 Failed Dependency ........................................60

10.6 507 Insufficient Storage .....................................60

11 MULTI-STATUS RESPONSE .........................................60

12 XML ELEMENT DEFINITIONS .......................................61

12.1 activelock XML Element .......................................61

12.1.1 depth XML Element .........................................61

12.1.2 locktoken XML Element .....................................61

12.1.3 timeout XML Element .......................................61

12.2 collection XML Element .......................................62

12.3 href XML Element .............................................62

12.4 link XML Element .............................................62

12.4.1 dst XML Element ...........................................62

12.4.2 src XML Element ...........................................62

12.5 lockentry XML Element ........................................63

12.6 lockinfo XML Element .........................................63

12.7 lockscope XML Element ........................................63

12.7.1 exclusive XML Element .....................................63

12.7.2 shared XML Element ........................................63

12.8 locktype XML Element .........................................64

12.8.1 write XML Element .........................................64

12.9 multistatus XML Element ......................................64

12.9.1 response XML Element ......................................64

12.9.2 responsedescription XML Element ...........................65

12.10 owner XML Element ...........................................65

12.11 prop XML element ............................................66

12.12 propertybehavior XML element ................................66

12.12.1 keepalive XML element ....................................66

12.12.2 omit XML element .........................................67

12.13 propertyupdate XML element ..................................67

12.13.1 remove XML element .......................................67

12.13.2 set XML element ..........................................67

12.14 propfind XML Element ........................................68

12.14.1 allprop XML Element ......................................68

12.14.2 propname XML Element .....................................68

13 DAV PROPERTIES ................................................68

13.1 creationdate Property ........................................69

13.2 displayname Property .........................................69

13.3 getcontentlanguage Property ..................................69

13.4 getcontentlength Property ....................................69

13.5 getcontenttype Property ......................................70

13.6 getetag Property .............................................70

13.7 getlastmodified Property .....................................70

13.8 lockdiscovery Property .......................................71

13.8.1 Example - Retrieving the lockdiscovery Property ...........71

13.9 resourcetype Property ........................................72

13.10 source Property .............................................72

13.10.1 Example - A source Property ..............................72

13.11 supportedlock Property ......................................73

13.11.1 Example - Retrieving the supportedlock Property ..........73

14 INSTRUCTIONS FOR PROCESSING XML IN DAV ........................74

15 DAV COMPLIANCE CLASSES ........................................75

15.1 Class 1 ......................................................75

15.2 Class 2 ......................................................75

16 INTERNATIONALIZATION CONSIDERATIONS ...........................76

17 SECURITY CONSIDERATIONS .......................................77

17.1 Authentication of Clients ....................................77

17.2 Denial of Service ............................................78

17.3 Security through Obscurity ...................................78

17.4 Privacy Issues Connected to Locks ............................78

17.5 Privacy Issues Connected to Properties .......................79

17.6 Reduction of Security due to Source Link .....................79

17.7 Implications of XML External Entities ........................79

17.8 Risks Connected with Lock Tokens .............................80

18 IANA CONSIDERATIONS ...........................................80

19 INTELLECTUAL PROPERTY .........................................81

20 ACKNOWLEDGEMENTS ..............................................82

21 REFERENCES ....................................................82

21.1 Normative References .........................................82

21.2 Informational References .....................................83

22 AUTHORS' ADDRESSES ............................................84

23 APPENDICES ....................................................86

23.1 Appendix 1 - WebDAV Document Type Definition .................86

23.2 Appendix 2 - ISO 8601 Date and Time Profile ..................88

23.3 Appendix 3 - Notes on Processing XML Elements ................89

23.3.1 Notes on Empty XML Elements ...............................89

23.3.2 Notes on Illegal XML Processing ...........................89

23.4 Appendix 4 -- XML Namespaces for WebDAV ......................92

23.4.1 Introduction ..............................................92

23.4.2 Meaning of Qualified Names ................................92

24 FULL COPYRIGHT STATEMENT ......................................94

1 Introduction

This document describes an extension to the HTTP/1.1 protocol that

allows clients to perform remote web content authoring operations.

This extension provides a coherent set of methods, headers, request

entity body formats, and response entity body formats that provide

operations for:

Properties: The ability to create, remove, and query information

about Web pages, such as their authors, creation dates, etc. Also,

the ability to link pages of any media type to related pages.

Collections: The ability to create sets of documents and to retrieve

a hierarchical membership listing (like a Directory listing in a file

system).

Locking: The ability to keep more than one person from working on a

document at the same time. This prevents the "lost update problem,"

in which modifications are lost as first one author then another

writes changes without merging the other author's changes.

Namespace Operations: The ability to instruct the server to copy and

move Web resources.

Requirements and rationale for these operations are described in a

companion document, "Requirements for a Distributed Authoring and

Versioning Protocol for the World Wide Web" [RFC2291].

The sections below provide a detailed introduction to resource

properties (section 4), collections of resources (section 5), and

locking operations (section 6). These sections introduce the

abstractions manipulated by the WebDAV-specific HTTP methods

described in section 8, "HTTP Methods for Distributed Authoring".

In HTTP/1.1, method parameter information was exclusively encoded in

HTTP headers. Unlike HTTP/1.1, WebDAV encodes method parameter

information either in an Extensible Markup Language (XML) [REC-XML]

request entity body, or in an HTTP header. The use of XML to encode

method parameters was motivated by the ability to add extra XML

elements to existing structures, providing extensibility; and by

XML's ability to encode information in ISO 10646 character sets,

providing internationalization support. As a rule of thumb,

parameters are encoded in XML entity bodies when they have unbounded

length, or when they may be shown to a human user and hence require

encoding in an ISO 10646 character set. Otherwise, parameters are

encoded within HTTP headers. Section 9 describes the new HTTP

headers used with WebDAV methods.

In addition to encoding method parameters, XML is used in WebDAV to

encode the responses from methods, providing the extensibility and

internationalization advantages of XML for method output, as well as

input.

XML elements used in this specification are defined in section 12.

The XML namespace extension (Appendix 4) is also used in this

specification in order to allow for new XML elements to be added

without fear of colliding with other element names.

While the status codes provided by HTTP/1.1 are sufficient to

describe most error conditions encountered by WebDAV methods, there

are some errors that do not fall neatly into the existing categories.

New status codes developed for the WebDAV methods are defined in

section 10. Since some WebDAV methods may operate over many

resources, the Multi-Status response has been introduced to return

status information for multiple resources. The Multi-Status response

is described in section 11.

WebDAV employs the property mechanism to store information about the

current state of the resource. For example, when a lock is taken out

on a resource, a lock information property describes the current

state of the lock. Section 13 defines the properties used within the

WebDAV specification.

Finishing off the specification are sections on what it means to be

compliant with this specification (section 15), on

internationalization support (section 16), and on security (section

17).

2 Notational Conventions

Since this document describes a set of extensions to the HTTP/1.1

protocol, the augmented BNF used herein to describe protocol elements

is exactly the same as described in section 2.1 of [RFC2068]. Since

this augmented BNF uses the basic production rules provided in

section 2.2 of [RFC2068], these rules apply to this document as well.

The key Words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",

"SHOULD", SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this

document are to be interpreted as described in RFC2119 [RFC2119].

3 Terminology

URI/URL - A Uniform Resource Identifier and Uniform Resource Locator,

respectively. These terms (and the distinction between them) are

defined in [RFC2396].

Collection - A resource that contains a set of URIs, termed member

URIs, which identify member resources and meets the requirements in

section 5 of this specification.

Member URI - A URI which is a member of the set of URIs contained by

a collection.

Internal Member URI - A Member URI that is immediately relative to

the URI of the collection (the definition of immediately relative is

given in section 5.2).

Property - A name/value pair that contains descriptive information

about a resource.

Live Property - A property whose semantics and syntax are enforced by

the server. For example, the live "getcontentlength" property has

its value, the length of the entity returned by a GET request,

automatically calculated by the server.

Dead Property - A property whose semantics and syntax are not

enforced by the server. The server only records the value of a dead

property; the client is responsible for maintaining the consistency

of the syntax and semantics of a dead property.

Null Resource - A resource which responds with a 404 (Not Found) to

any HTTP/1.1 or DAV method except for PUT, MKCOL, OPTIONS and LOCK.

A NULL resource MUST NOT appear as a member of its parent collection.

4 Data Model for Resource Properties

4.1 The Resource Property Model

Properties are pieces of data that describe the state of a resource.

Properties are data about data.

Properties are used in distributed authoring environments to provide

for efficient discovery and management of resources. For example, a

'subject' property might allow for the indexing of all resources by

their subject, and an 'author' property might allow for the discovery

of what authors have written which documents.

The DAV property model consists of name/value pairs. The name of a

property identifies the property's syntax and semantics, and provides

an address by which to refer to its syntax and semantics.

There are two categories of properties: "live" and "dead". A live

property has its syntax and semantics enforced by the server. Live

properties include cases where a) the value of a property is read-

only, maintained by the server, and b) the value of the property is

maintained by the client, but the server performs syntax checking on

submitted values. All instances of a given live property MUST comply

with the definition associated with that property name. A dead

property has its syntax and semantics enforced by the client; the

server merely records the value of the property verbatim.

4.2 Existing Metadata Proposals

Properties have long played an essential role in the maintenance of

large document repositories, and many current proposals contain some

notion of a property, or discuss web metadata more generally. These

include PICS [REC-PICS], PICS-NG, XML, Web Collections, and several

proposals on representing relationships within Html. Work on PICS-NG

and Web Collections has been subsumed by the Resource Description

Framework (RDF) metadata activity of the World Wide Web Consortium.

RDF consists of a network-based data model and an XML representation

of that model.

Some proposals come from a digital library perspective. These

include the Dublin Core [RFC2413] metadata set and the Warwick

Framework [WF], a container architecture for different metadata

schemas. The literature includes many examples of metadata,

including MARC [USMARC], a bibliographic metadata format, and a

technical report bibliographic format employed by the Dienst system

[RFC1807]. Additionally, the proceedings from the first IEEE Metadata

conference describe many community-specific metadata sets.

Participants of the 1996 Metadata II Workshop in Warwick, UK [WF],

noted that "new metadata sets will develop as the networked

infrastructure matures" and "different communities will propose,

design, and be responsible for different types of metadata." These

observations can be corroborated by noting that many community-

specific sets of metadata already exist, and there is significant

motivation for the development of new forms of metadata as many

communities increasingly make their data available in digital form,

requiring a metadata format to assist data location and cataloging.

4.3 Properties and HTTP Headers

Properties already exist, in a limited sense, in HTTP message

headers. However, in distributed authoring environments a relatively

large number of properties are needed to describe the state of a

resource, and setting/returning them all through HTTP headers is

inefficient. Thus a mechanism is needed which allows a principal to

identify a set of properties in which the principal is interested and

to set or retrieve just those properties.

4.4 Property Values

The value of a property when eXPressed in XML MUST be well formed.

XML has been chosen because it is a flexible, self-describing,

structured data format that supports rich schema definitions, and

because of its support for multiple character sets. XML's self-

describing nature allows any property's value to be extended by

adding new elements. Older clients will not break when they

encounter extensions because they will still have the data specified

in the original schema and will ignore elements they do not

understand. XML's support for multiple character sets allows any

human-readable property to be encoded and read in a character set

familiar to the user. XML's support for multiple human languages,

using the "xml:lang" attribute, handles cases where the same

character set is employed by multiple human languages.

4.5 Property Names

A property name is a universally unique identifier that is associated

with a schema that provides information about the syntax and

semantics of the property.

Because a property's name is universally unique, clients can depend

upon consistent behavior for a particular property across multiple

resources, on the same and across different servers, so long as that

property is "live" on the resources in question, and the

implementation of the live property is faithful to its definition.

The XML namespace mechanism, which is based on URIs [RFC2396], is

used to name properties because it prevents namespace collisions and

provides for varying degrees of administrative control.

The property namespace is flat; that is, no hierarchy of properties

is explicitly recognized. Thus, if a property A and a property A/B

exist on a resource, there is no recognition of any relationship

between the two properties. It is expected that a separate

specification will eventually be produced which will address issues

relating to hierarchical properties.

Finally, it is not possible to define the same property twice on a

single resource, as this would cause a collision in the resource's

property namespace.

4.6 Media Independent Links

Although HTML resources support links to other resources, the Web

needs more general support for links between resources of any media

type (media types are also known as MIME types, or content types).

WebDAV provides such links. A WebDAV link is a special type of

property value, formally defined in section 12.4, that allows typed

connections to be established between resources of any media type.

The property value consists of source and destination Uniform

Resource Identifiers (URIs); the property name identifies the link

type.

5 Collections of Web Resources

This section provides a description of a new type of Web resource,

the collection, and discusses its interactions with the HTTP URL

namespace. The purpose of a collection resource is to model

collection-like objects (e.g., file system directories) within a

server's namespace.

All DAV compliant resources MUST support the HTTP URL namespace model

specified herein.

5.1 HTTP URL Namespace Model

The HTTP URL namespace is a hierarchical namespace where the

hierarchy is delimited with the "/" character.

An HTTP URL namespace is said to be consistent if it meets the

following conditions: for every URL in the HTTP hierarchy there

exists a collection that contains that URL as an internal member.

The root, or top-level collection of the namespace under

consideration is exempt from the previous rule.

Neither HTTP/1.1 nor WebDAV require that the entire HTTP URL

namespace be consistent. However, certain WebDAV methods are

prohibited from producing results that cause namespace

inconsistencies.

Although implicit in [RFC2068] and [RFC2396], any resource, including

collection resources, MAY be identified by more than one URI. For

example, a resource could be identified by multiple HTTP URLs.

5.2 Collection Resources

A collection is a resource whose state consists of at least a list of

internal member URIs and a set of properties, but which may have

additional state such as entity bodies returned by GET. An internal

member URI MUST be immediately relative to a base URI of the

collection. That is, the internal member URI is equal to a

containing collection's URI plus an additional segment for non-

collection resources, or additional segment plus trailing slash "/"

for collection resources, where segment is defined in section 3.3 of

[RFC2396].

Any given internal member URI MUST only belong to the collection

once, i.e., it is illegal to have multiple instances of the same URI

in a collection. Properties defined on collections behave exactly as

do properties on non-collection resources.

For all WebDAV compliant resources A and B, identified by URIs U and

V, for which U is immediately relative to V, B MUST be a collection

that has U as an internal member URI. So, if the resource with URL

http://foo.com/bar/blah is WebDAV compliant and if the resource with

URL http://foo.com/bar/ is WebDAV compliant then the resource with

URL http://foo.com/bar/ must be a collection and must contain URL

http://foo.com/bar/blah as an internal member.

Collection resources MAY list the URLs of non-WebDAV compliant

children in the HTTP URL namespace hierarchy as internal members but

are not required to do so. For example, if the resource with URL

http://foo.com/bar/blah is not WebDAV compliant and the URL

http://foo.com/bar/ identifies a collection then URL

http://foo.com/bar/blah may or may not be an internal member of the

collection with URL http://foo.com/bar/.

If a WebDAV compliant resource has no WebDAV compliant children in

the HTTP URL namespace hierarchy then the WebDAV compliant resource

is not required to be a collection.

There is a standing convention that when a collection is referred to

by its name without a trailing slash, the trailing slash is

automatically appended. Due to this, a resource may accept a URI

without a trailing "/" to point to a collection. In this case it

SHOULD return a content-location header in the response pointing to

the URI ending with the "/". For example, if a client invokes a

method on http://foo.bar/blah (no trailing slash), the resource

http://foo.bar/blah/ (trailing slash) may respond as if the operation

were invoked on it, and should return a content-location header with

http://foo.bar/blah/ in it. In general clients SHOULD use the "/"

form of collection names.

A resource MAY be a collection but not be WebDAV compliant. That is,

the resource may comply with all the rules set out in this

specification regarding how a collection is to behave without

necessarily supporting all methods that a WebDAV compliant resource

is required to support. In such a case the resource may return the

DAV:resourcetype property with the value DAV:collection but MUST NOT

return a DAV header containing the value "1" on an OPTIONS response.

5.3 Creation and Retrieval of Collection Resources

This document specifies the MKCOL method to create new collection

resources, rather than using the existing HTTP/1.1 PUT or POST

method, for the following reasons:

In HTTP/1.1, the PUT method is defined to store the request body at

the location specified by the Request-URI. While a description

format for a collection can readily be constructed for use with PUT,

the implications of sending such a description to the server are

undesirable. For example, if a description of a collection that

omitted some existing resources were PUT to a server, this might be

interpreted as a command to remove those members. This would extend

PUT to perform DELETE functionality, which is undesirable since it

changes the semantics of PUT, and makes it difficult to control

DELETE functionality with an Access control scheme based on methods.

While the POST method is sufficiently open-ended that a "create a

collection" POST command could be constructed, this is undesirable

because it would be difficult to separate access control for

collection creation from other uses of POST.

The exact definition of the behavior of GET and PUT on collections is

defined later in this document.

5.4 Source Resources and Output Resources

For many resources, the entity returned by a GET method exactly

matches the persistent state of the resource, for example, a GIF file

stored on a disk. For this simple case, the URI at which a resource

is accessed is identical to the URI at which the source (the

persistent state) of the resource is accessed. This is also the case

for HTML source files that are not processed by the server prior to

transmission.

However, the server can sometimes process HTML resources before they

are transmitted as a return entity body. For example, a server-

side-include directive within an HTML file might instruct a server to

replace the directive with another value, such as the current date.

In this case, what is returned by GET (HTML plus date) differs from

the persistent state of the resource (HTML plus directive).

Typically there is no way to access the HTML resource containing the

unprocessed directive.

Sometimes the entity returned by GET is the output of a data-

producing process that is described by one or more source resources

(that may not even have a location in the URI namespace). A single

data-producing process may dynamically generate the state of a

potentially large number of output resources. An example of this is

a CGI script that describes a "finger" gateway process that maps part

of the namespace of a server into finger requests, such as

http://www.foo.bar.org/finger_gateway/user@host.

In the absence of distributed authoring capabilities, it is

acceptable to have no mapping of source resource(s) to the URI

namespace. In fact, preventing access to the source resource(s) has

desirable security benefits. However, if remote editing of the

source resource(s) is desired, the source resource(s) should be given

a location in the URI namespace. This source location should not be

one of the locations at which the generated output is retrievable,

since in general it is impossible for the server to differentiate

requests for source resources from requests for process output

resources. There is often a many-to-many relationship between source

resources and output resources.

On WebDAV compliant servers the URI of the source resource(s) may be

stored in a link on the output resource with type DAV:source (see

section 13.10 for a description of the source link property).

Storing the source URIs in links on the output resources places the

burden of discovering the source on the authoring client. Note that

the value of a source link is not guaranteed to point to the correct

source. Source links may break or incorrect values may be entered.

Also note that not all servers will allow the client to set the

source link value. For example a server which generates source links

on the fly for its CGI files will most likely not allow a client to

set the source link value.

6 Locking

The ability to lock a resource provides a mechanism for serializing

access to that resource. Using a lock, an authoring client can

provide a reasonable guarantee that another principal will not modify

a resource while it is being edited. In this way, a client can

prevent the "lost update" problem.

This specification allows locks to vary over two client-specified

parameters, the number of principals involved (exclusive vs. shared)

and the type of access to be granted. This document defines locking

for only one access type, write. However, the syntax is extensible,

and permits the eventual specification of locking for other access

types.

6.1 Exclusive Vs. Shared Locks

The most basic form of lock is an exclusive lock. This is a lock

where the access right in question is only granted to a single

principal. The need for this arbitration results from a desire to

avoid having to merge results.

However, there are times when the goal of a lock is not to exclude

others from exercising an access right but rather to provide a

mechanism for principals to indicate that they intend to exercise

their access rights. Shared locks are provided for this case. A

shared lock allows multiple principals to receive a lock. Hence any

principal with appropriate access can get the lock.

With shared locks there are two trust sets that affect a resource.

The first trust set is created by access permissions. Principals who

are trusted, for example, may have permission to write to the

resource. Among those who have access permission to write to the

resource, the set of principals who have taken out a shared lock also

must trust each other, creating a (typically) smaller trust set

within the access permission write set.

Starting with every possible principal on the Internet, in most

situations the vast majority of these principals will not have write

access to a given resource. Of the small number who do have write

access, some principals may decide to guarantee their edits are free

from overwrite conflicts by using exclusive write locks. Others may

decide they trust their collaborators will not overwrite their work

(the potential set of collaborators being the set of principals who

have write permission) and use a shared lock, which informs their

collaborators that a principal may be working on the resource.

The WebDAV extensions to HTTP do not need to provide all of the

communications paths necessary for principals to coordinate their

activities. When using shared locks, principals may use any out of

band communication channel to coordinate their work (e.g., face-to-

face interaction, written notes, post-it notes on the screen,

telephone conversation, Email, etc.) The intent of a shared lock is

to let collaborators know who else may be working on a resource.

Shared locks are included because experience from web distributed

authoring systems has indicated that exclusive locks are often too

rigid. An exclusive lock is used to enforce a particular editing

process: take out an exclusive lock, read the resource, perform

edits, write the resource, release the lock. This editing process

has the problem that locks are not always properly released, for

example when a program crashes, or when a lock owner leaves without

unlocking a resource. While both timeouts and administrative action

can be used to remove an offending lock, neither mechanism may be

available when needed; the timeout may be long or the administrator

may not be available.

6.2 Required Support

A WebDAV compliant server is not required to support locking in any

form. If the server does support locking it may choose to support

any combination of exclusive and shared locks for any access types.

The reason for this flexibility is that locking policy strikes to the

very heart of the resource management and versioning systems employed

by various storage repositories. These repositories require control

over what sort of locking will be made available. For example, some

repositories only support shared write locks while others only

provide support for exclusive write locks while yet others use no

locking at all. As each system is sufficiently different to merit

exclusion of certain locking features, this specification leaves

locking as the sole axis of negotiation within WebDAV.

6.3 Lock Tokens

A lock token is a type of state token, represented as a URI, which

identifies a particular lock. A lock token is returned by every

successful LOCK operation in the lockdiscovery property in the

response body, and can also be found through lock discovery on a

resource.

Lock token URIs MUST be unique across all resources for all time.

This uniqueness constraint allows lock tokens to be submitted across

resources and servers without fear of confusion.

This specification provides a lock token URI scheme called

opaquelocktoken that meets the uniqueness requirements. However

resources are free to return any URI scheme so long as it meets the

uniqueness requirements.

Having a lock token provides no special access rights. Anyone can

find out anyone else's lock token by performing lock discovery.

Locks MUST be enforced based upon whatever authentication mechanism

is used by the server, not based on the secrecy of the token values.

6.4 opaquelocktoken Lock Token URI Scheme

The opaquelocktoken URI scheme is designed to be unique across all

resources for all time. Due to this uniqueness quality, a client may

submit an opaque lock token in an If header on a resource other than

the one that returned it.

All resources MUST recognize the opaquelocktoken scheme and, at

minimum, recognize that the lock token does not refer to an

outstanding lock on the resource.

In order to guarantee uniqueness across all resources for all time

the opaquelocktoken requires the use of the Universal Unique

Identifier (UUID) mechanism, as described in [ISO-11578].

Opaquelocktoken generators, however, have a choice of how they create

these tokens. They can either generate a new UUID for every lock

token they create or they can create a single UUID and then add

extension characters. If the second method is selected then the

program generating the extensions MUST guarantee that the same

extension will never be used twice with the associated UUID.

OpaqueLockToken-URI = "opaquelocktoken:" UUID [Extension] ; The UUID

production is the string representation of a UUID, as defined in

[ISO-11578]. Note that white space (LWS) is not allowed between

elements of this production.

Extension = path ; path is defined in section 3.2.1 of RFC2068

[RFC2068]

6.4.1 Node Field Generation Without the IEEE 802 Address

UUIDs, as defined in [ISO-11578], contain a "node" field that

contains one of the IEEE 802 addresses for the server machine. As

noted in section 17.8, there are several security risks associated

with exposing a machine's IEEE 802 address. This section provides an

alternate mechanism for generating the "node" field of a UUID which

does not employ an IEEE 802 address. WebDAV servers MAY use this

algorithm for creating the node field when generating UUIDs. The

text in this section is originally from an Internet-Draft by Paul

Leach and Rich Salz, who are noted here to properly attribute their

work.

The ideal solution is to oBTain a 47 bit cryptographic quality random

number, and use it as the low 47 bits of the node ID, with the most

significant bit of the first octet of the node ID set to 1. This bit

is the unicast/multicast bit, which will never be set in IEEE 802

addresses obtained from network cards; hence, there can never be a

conflict between UUIDs generated by machines with and without network

cards.

If a system does not have a primitive to generate cryptographic

quality random numbers, then in most systems there are usually a

fairly large number of sources of randomness available from which one

can be generated. Such sources are system specific, but often

include:

- the percent of memory in use

- the size of main memory in bytes

- the amount of free main memory in bytes

- the size of the paging or swap file in bytes

- free bytes of paging or swap file

- the total size of user virtual address space in bytes

- the total available user address space bytes

- the size of boot disk drive in bytes

- the free disk space on boot drive in bytes

- the current time

- the amount of time since the system booted

- the individual sizes of files in various system directories

- the creation, last read, and modification times of files in

various system directories

- the utilization factors of various system resources (heap, etc.)

- current mouse cursor position

- current caret position

- current number of running processes, threads

- handles or IDs of the desktop window and the active window

- the value of stack pointer of the caller

- the process and thread ID of caller

- various processor architecture specific performance counters

(instructions executed, cache misses, TLB misses)

(Note that it is precisely the above kinds of sources of randomness

that are used to seed cryptographic quality random number generators

on systems without special hardware for their construction.)

In addition, items such as the computer's name and the name of the

operating system, while not strictly speaking random, will help

differentiate the results from those obtained by other systems.

The exact algorithm to generate a node ID using these data is system

specific, because both the data available and the functions to obtain

them are often very system specific. However, assuming that one can

concatenate all the values from the randomness sources into a buffer,

and that a cryptographic hash function such as MD5 is available, then

any 6 bytes of the MD5 hash of the buffer, with the multicast bit

(the high bit of the first byte) set will be an appropriately random

node ID.

Other hash functions, such as SHA-1, can also be used. The only

requirement is that the result be suitably random _ in the sense that

the outputs from a set uniformly distributed inputs are themselves

uniformly distributed, and that a single bit change in the input can

be expected to cause half of the output bits to change.

6.5 Lock Capability Discovery

Since server lock support is optional, a client trying to lock a

resource on a server can either try the lock and hope for the best,

or perform some form of discovery to determine what lock capabilities

the server supports. This is known as lock capability discovery.

Lock capability discovery differs from discovery of supported access

control types, since there may be access control types without

corresponding lock types. A client can determine what lock types the

server supports by retrieving the supportedlock property.

Any DAV compliant resource that supports the LOCK method MUST support

the supportedlock property.

6.6 Active Lock Discovery

If another principal locks a resource that a principal wishes to

access, it is useful for the second principal to be able to find out

who the first principal is. For this purpose the lockdiscovery

property is provided. This property lists all outstanding locks,

describes their type, and where available, provides their lock token.

Any DAV compliant resource that supports the LOCK method MUST support

the lockdiscovery property.

6.7 Usage Considerations

Although the locking mechanisms specified here provide some help in

preventing lost updates, they cannot guarantee that updates will

never be lost. Consider the following scenario:

Two clients A and B are interested in editing the resource '

index.html'. Client A is an HTTP client rather than a WebDAV client,

and so does not know how to perform locking.

Client A doesn't lock the document, but does a GET and begins

editing.

Client B does LOCK, performs a GET and begins editing.

Client B finishes editing, performs a PUT, then an UNLOCK.

Client A performs a PUT, overwriting and losing all of B's changes.

There are several reasons why the WebDAV protocol itself cannot

prevent this situation. First, it cannot force all clients to use

locking because it must be compatible with HTTP clients that do not

comprehend locking. Second, it cannot require servers to support

locking because of the variety of repository implementations, some of

which rely on reservations and merging rather than on locking.

Finally, being stateless, it cannot enforce a sequence of operations

like LOCK / GET / PUT / UNLOCK.

WebDAV servers that support locking can reduce the likelihood that

clients will accidentally overwrite each other's changes by requiring

clients to lock resources before modifying them. Such servers would

effectively prevent HTTP 1.0 and HTTP 1.1 clients from modifying

resources.

WebDAV clients can be good citizens by using a lock / retrieve /

write /unlock sequence of operations (at least by default) whenever

they interact with a WebDAV server that supports locking.

HTTP 1.1 clients can be good citizens, avoiding overwriting other

clients' changes, by using entity tags in If-Match headers with any

requests that would modify resources.

Information managers may attempt to prevent overwrites by

implementing client-side procedures requiring locking before

modifying WebDAV resources.

7 Write Lock

This section describes the semantics specific to the write lock type.

The write lock is a specific instance of a lock type, and is the only

lock type described in this specification.

7.1 Methods Restricted by Write Locks

A write lock MUST prevent a principal without the lock from

successfully executing a PUT, POST, PROPPATCH, LOCK, UNLOCK, MOVE,

DELETE, or MKCOL on the locked resource. All other current methods,

GET in particular, function independently of the lock.

Note, however, that as new methods are created it will be necessary

to specify how they interact with a write lock.

7.2 Write Locks and Lock Tokens

A successful request for an exclusive or shared write lock MUST

result in the generation of a unique lock token associated with the

requesting principal. Thus if five principals have a shared write

lock on the same resource there will be five lock tokens, one for

each principal.

7.3 Write Locks and Properties

While those without a write lock may not alter a property on a

resource it is still possible for the values of live properties to

change, even while locked, due to the requirements of their schemas.

Only dead properties and live properties defined to respect locks are

guaranteed not to change while write locked.

7.4 Write Locks and Null Resources

It is possible to assert a write lock on a null resource in order to

lock the name.

A write locked null resource, referred to as a lock-null resource,

MUST respond with a 404 (Not Found) or 405 (Method Not Allowed) to

any HTTP/1.1 or DAV methods except for PUT, MKCOL, OPTIONS, PROPFIND,

LOCK, and UNLOCK. A lock-null resource MUST appear as a member of

its parent collection. Additionally the lock-null resource MUST have

defined on it all mandatory DAV properties. Most of these

properties, such as all the get* properties, will have no value as a

lock-null resource does not support the GET method. Lock-Null

resources MUST have defined values for lockdiscovery and

supportedlock properties.

Until a method such as PUT or MKCOL is successfully executed on the

lock-null resource the resource MUST stay in the lock-null state.

However, once a PUT or MKCOL is successfully executed on a lock-null

resource the resource ceases to be in the lock-null state.

If the resource is unlocked, for any reason, without a PUT, MKCOL, or

similar method having been successfully executed upon it then the

resource MUST return to the null state.

7.5 Write Locks and Collections

A write lock on a collection, whether created by a "Depth: 0" or

"Depth: infinity" lock request, prevents the addition or removal of

member URIs of the collection by non-lock owners. As a consequence,

when a principal issues a PUT or POST request to create a new

resource under a URI which needs to be an internal member of a write

locked collection to maintain HTTP namespace consistency, or issues a

DELETE to remove a resource which has a URI which is an existing

internal member URI of a write locked collection, this request MUST

fail if the principal does not have a write lock on the collection.

However, if a write lock request is issued to a collection containing

member URIs identifying resources that are currently locked in a

manner which conflicts with the write lock, the request MUST fail

with a 423 (Locked) status code.

If a lock owner causes the URI of a resource to be added as an

internal member URI of a locked collection then the new resource MUST

be automatically added to the lock. This is the only mechanism that

allows a resource to be added to a write lock. Thus, for example, if

the collection /a/b/ is write locked and the resource /c is moved to

/a/b/c then resource /a/b/c will be added to the write lock.

7.6 Write Locks and the If Request Header

If a user agent is not required to have knowledge about a lock when

requesting an operation on a locked resource, the following scenario

might occur. Program A, run by User A, takes out a write lock on a

resource. Program B, also run by User A, has no knowledge of the

lock taken out by Program A, yet performs a PUT to the locked

resource. In this scenario, the PUT succeeds because locks are

associated with a principal, not a program, and thus program B,

because it is acting with principal A's credential, is allowed to

perform the PUT. However, had program B known about the lock, it

would not have overwritten the resource, preferring instead to

present a dialog box describing the conflict to the user. Due to

this scenario, a mechanism is needed to prevent different programs

from accidentally ignoring locks taken out by other programs with the

same authorization.

In order to prevent these collisions a lock token MUST be submitted

by an authorized principal in the If header for all locked resources

that a method may interact with or the method MUST fail. For

example, if a resource is to be moved and both the source and

destination are locked then two lock tokens must be submitted, one

for the source and the other for the destination.

7.6.1 Example - Write Lock

>>Request

COPY /~fielding/index.html HTTP/1.1

Host: www.ics.uci.edu

Destination: http://www.ics.uci.edu/users/f/fielding/index.html

If: <http://www.ics.uci.edu/users/f/fielding/index.html>

(<opaquelocktoken:f81d4fae-7dec-11d0-a765-00a0c91e6bf6>)

>>Response

HTTP/1.1 204 No Content

In this example, even though both the source and destination are

locked, only one lock token must be submitted, for the lock on the

destination. This is because the source resource is not modified by

a COPY, and hence unaffected by the write lock. In this example, user

agent authentication has previously occurred via a mechanism outside

the scope of the HTTP protocol, in the underlying transport layer.

7.7 Write Locks and COPY/MOVE

A COPY method invocation MUST NOT duplicate any write locks active on

the source. However, as previously noted, if the COPY copies the

resource into a collection that is locked with "Depth: infinity",

then the resource will be added to the lock.

A successful MOVE request on a write locked resource MUST NOT move

the write lock with the resource. However, the resource is subject to

being added to an existing lock at the destination, as specified in

section 7.5. For example, if the MOVE makes the resource a child of a

collection that is locked with "Depth: infinity", then the resource

will be added to that collection's lock. Additionally, if a resource

locked with "Depth: infinity" is moved to a destination that is

within the scope of the same lock (e.g., within the namespace tree

covered by the lock), the moved resource will again be a added to the

lock. In both these examples, as specified in section 7.6, an If

header must be submitted containing a lock token for both the source

and destination.

7.8 Refreshing Write Locks

A client MUST NOT submit the same write lock request twice. Note

that a client is always aware it is resubmitting the same lock

request because it must include the lock token in the If header in

order to make the request for a resource that is already locked.

However, a client may submit a LOCK method with an If header but

without a body. This form of LOCK MUST only be used to "refresh" a

lock. Meaning, at minimum, that any timers associated with the lock

MUST be re-set.

A server may return a Timeout header with a lock refresh that is

different than the Timeout header returned when the lock was

originally requested. Additionally clients may submit Timeout

headers of arbitrary value with their lock refresh requests.

Servers, as always, may ignore Timeout headers submitted by the

client.

If an error is received in response to a refresh LOCK request the

client SHOULD assume that the lock was not refreshed.

8 HTTP Methods for Distributed Authoring

The following new HTTP methods use XML as a request and response

format. All DAV compliant clients and resources MUST use XML parsers

that are compliant with [REC-XML]. All XML used in either requests

or responses MUST be, at minimum, well formed. If a server receives

ill-formed XML in a request it MUST reject the entire request with a

400 (Bad Request). If a client receives ill-formed XML in a response

then it MUST NOT assume anything about the outcome of the executed

method and SHOULD treat the server as malfunctioning.

8.1 PROPFIND

The PROPFIND method retrieves properties defined on the resource

identified by the Request-URI, if the resource does not have any

internal members, or on the resource identified by the Request-URI

and potentially its member resources, if the resource is a collection

that has internal member URIs. All DAV compliant resources MUST

support the PROPFIND method and the propfind XML element (section

12.14) along with all XML elements defined for use with that element.

A client may submit a Depth header with a value of "0", "1", or

"infinity" with a PROPFIND on a collection resource with internal

member URIs. DAV compliant servers MUST support the "0", "1" and

"infinity" behaviors. By default, the PROPFIND method without a Depth

header MUST act as if a "Depth: infinity" header was included.

A client may submit a propfind XML element in the body of the request

method describing what information is being requested. It is

possible to request particular property values, all property values,

or a list of the names of the resource's properties. A client may

choose not to submit a request body. An empty PROPFIND request body

MUST be treated as a request for the names and values of all

properties.

All servers MUST support returning a response of content type

text/xml or application/xml that contains a multistatus XML element

that describes the results of the attempts to retrieve the various

properties.

If there is an error retrieving a property then a proper error result

MUST be included in the response. A request to retrieve the value of

a property which does not exist is an error and MUST be noted, if the

response uses a multistatus XML element, with a response XML element

which contains a 404 (Not Found) status value.

Consequently, the multistatus XML element for a collection resource

with member URIs MUST include a response XML element for each member

URI of the collection, to whatever depth was requested. Each response

XML element MUST contain an href XML element that gives the URI of

the resource on which the properties in the prop XML element are

defined. Results for a PROPFIND on a collection resource with

internal member URIs are returned as a flat list whose order of

entries is not significant.

In the case of allprop and propname, if a principal does not have the

right to know whether a particular property exists then the property

should be silently excluded from the response.

The results of this method SHOULD NOT be cached.

8.1.1 Example - Retrieving Named Properties

>>Request

PROPFIND /file HTTP/1.1

Host: www.foo.bar

Content-type: text/xml; charset="utf-8"

Content-Length: xxxx

<?xml version="1.0" encoding="utf-8" ?>

<D:propfind xmlns:D="DAV:">

<D:prop xmlns:R="http://www.foo.bar/boxschema/">

<R:bigbox/>

<R:author/>

<R:DingALing/>

<R:Random/>

</D:prop>

</D:propfind>

>>Response

HTTP/1.1 207 Multi-Status

Content-Type: text/xml; charset="utf-8"

Content-Length: xxxx

<?xml version="1.0" encoding="utf-8" ?>

<D:multistatus xmlns:D="DAV:">

<D:response>

<D:href>http://www.foo.bar/file</D:href>

<D:propstat>

<D:prop xmlns:R="http://www.foo.bar/boxschema/">

<R:bigbox>

<R:BoxType>Box type A</R:BoxType>

</R:bigbox>

<R:author>

<R:Name>J.J. Johnson</R:Name>

</R:author>

</D:prop>

<D:status>HTTP/1.1 200 OK</D:status>

</D:propstat>

<D:propstat>

<D:prop><R:DingALing/><R:Random/></D:prop>

<D:status>HTTP/1.1 403 Forbidden</D:status>

<D:responsedescription> The user does not have access to

the DingALing property.

</D:responsedescription>

</D:propstat>

</D:response>

<D:responsedescription> There has been an access violation error.

</D:responsedescription>

</D:multistatus>

In this example, PROPFIND is executed on a non-collection resource

http://www.foo.bar/file. The propfind XML element specifies the name

of four properties whose values are being requested. In this case

only two properties were returned, since the principal issuing the

request did not have sufficient access rights to see the third and

fourth properties.

8.1.2 Example - Using allprop to Retrieve All Properties

>>Request

PROPFIND /container/ HTTP/1.1

Host: www.foo.bar

Depth: 1

Content-Type: text/xml; charset="utf-8"

Content-Length: xxxx

<?xml version="1.0" encoding="utf-8" ?>

<D:propfind xmlns:D="DAV:">

<D:allprop/>

</D:propfind>

>>Response

HTTP/1.1 207 Multi-Status

Content-Type: text/xml; charset="utf-8"

Content-Length: xxxx

<?xml version="1.0" encoding="utf-8" ?>

<D:multistatus xmlns:D="DAV:">

<D:response>

<D:href>http://www.foo.bar/container/</D:href>

<D:propstat>

<D:prop xmlns:R="http://www.foo.bar/boxschema/">

<R:bigbox>

<R:BoxType>Box type A</R:BoxType>

</R:bigbox>

<R:author>

<R:Name>Hadrian</R:Name>

</R:author>

<D:creationdate>

1997-12-01T17:42:21-08:00

</D:creationdate>

<D:displayname>

Example collection

</D:displayname>

<D:resourcetype><D:collection/></D:resourcetype>

<D:supportedlock>

<D:lockentry>

<D:lockscope><D:exclusive/></D:lockscope>

<D:locktype><D:write/></D:locktype>

</D:lockentry>

<D:lockentry>

<D:lockscope><D:shared/></D:lockscope>

<D:locktype><D:write/></D:locktype>

</D:lockentry>

</D:supportedlock>

</D:prop>

<D:status>HTTP/1.1 200 OK</D:status>

</D:propstat>

</D:response>

<D:response>

<D:href>http://www.foo.bar/container/front.html</D:href>

<D:propstat>

<D:prop xmlns:R="http://www.foo.bar/boxschema/">

<R:bigbox>

<R:BoxType>Box type B</R:BoxType>

</R:bigbox>

<D:creationdate>

1997-12-01T18:27:21-08:00

</D:creationdate>

<D:displayname>

Example HTML resource

</D:displayname>

<D:getcontentlength>

4525

</D:getcontentlength>

<D:getcontenttype>

text/html

</D:getcontenttype>

<D:getetag>

zzyzx

</D:getetag>

<D:getlastmodified>

Monday, 12-Jan-98 09:25:56 GMT

</D:getlastmodified>

<D:resourcetype/>

<D:supportedlock>

<D:lockentry>

<D:lockscope><D:exclusive/></D:lockscope>

<D:locktype><D:write/></D:locktype>

</D:lockentry>

<D:lockentry>

<D:lockscope><D:shared/></D:lockscope>

<D:locktype><D:write/></D:locktype>

</D:lockentry>

</D:supportedlock>

</D:prop>

<D:status>HTTP/1.1 200 OK</D:status>

</D:propstat>

</D:response>

</D:multistatus>

In this example, PROPFIND was invoked on the resource

http://www.foo.bar/container/ with a Depth header of 1, meaning the

request applies to the resource and its children, and a propfind XML

element containing the allprop XML element, meaning the request

should return the name and value of all properties defined on each

resource.

The resource http://www.foo.bar/container/ has six properties defined

on it:

http://www.foo.bar/boxschema/bigbox,

http://www.foo.bar/boxschema/author, DAV:creationdate,

DAV:displayname, DAV:resourcetype, and DAV:supportedlock.

The last four properties are WebDAV-specific, defined in section 13.

Since GET is not supported on this resource, the get* properties

(e.g., getcontentlength) are not defined on this resource. The DAV-

specific properties assert that "container" was created on December

1, 1997, at 5:42:21PM, in a time zone 8 hours west of GMT

(creationdate), has a name of "Example collection" (displayname), a

collection resource type (resourcetype), and supports exclusive write

and shared write locks (supportedlock).

The resource http://www.foo.bar/container/front.html has nine

properties defined on it:

http://www.foo.bar/boxschema/bigbox (another instance of the "bigbox"

property type), DAV:creationdate, DAV:displayname,

DAV:getcontentlength, DAV:getcontenttype, DAV:getetag,

DAV:getlastmodified, DAV:resourcetype, and DAV:supportedlock.

The DAV-specific properties assert that "front.html" was created on

December 1, 1997, at 6:27:21PM, in a time zone 8 hours west of GMT

(creationdate), has a name of "Example HTML resource" (displayname),

a content length of 4525 bytes (getcontentlength), a MIME type of

"text/html" (getcontenttype), an entity tag of "zzyzx" (getetag), was

last modified on Monday, January 12, 1998, at 09:25:56 GMT

(getlastmodified), has an empty resource type, meaning that it is not

a collection (resourcetype), and supports both exclusive write and

shared write locks (supportedlock).

8.1.3 Example - Using propname to Retrieve all Property Names

>>Request

PROPFIND /container/ HTTP/1.1

Host: www.foo.bar

Content-Type: text/xml; charset="utf-8"

Content-Length: xxxx

<?xml version="1.0" encoding="utf-8" ?>

<propfind xmlns="DAV:">

<propname/>

</propfind>

>>Response

HTTP/1.1 207 Multi-Status

Content-Type: text/xml; charset="utf-8"

Content-Length: xxxx

<?xml version="1.0" encoding="utf-8" ?>

<multistatus xmlns="DAV:">

<response>

<href>http://www.foo.bar/container/</href>

<propstat>

<prop xmlns:R="http://www.foo.bar/boxschema/">

<R:bigbox/>

<R:author/>

<creationdate/>

<displayname/>

<resourcetype/>

<supportedlock/>

</prop>

<status>HTTP/1.1 200 OK</status>

</propstat>

</response>

<response>

<href>http://www.foo.bar/container/front.html</href>

<propstat>

<prop xmlns:R="http://www.foo.bar/boxschema/">

<R:bigbox/>

<creationdate/>

<displayname/>

<getcontentlength/>

<getcontenttype/>

<getetag/>

<getlastmodified/>

<resourcetype/>

<supportedlock/>

</prop>

<status>HTTP/1.1 200 OK</status>

</propstat>

</response>

</multistatus>

In this example, PROPFIND is invoked on the collection resource

http://www.foo.bar/container/, with a propfind XML element containing

the propname XML element, meaning the name of all properties should

be returned. Since no Depth header is present, it assumes its

default value of "infinity", meaning the name of the properties on

the collection and all its progeny should be returned.

Consistent with the previous example, resource

http://www.foo.bar/container/ has six properties defined on it,

http://www.foo.bar/boxschema/bigbox,

http://www.foo.bar/boxschema/author, DAV:creationdate,

DAV:displayname, DAV:resourcetype, and DAV:supportedlock.

The resource http://www.foo.bar/container/index.html, a member of the

"container" collection, has nine properties defined on it,

http://www.foo.bar/boxschema/bigbox, DAV:creationdate,

DAV:displayname, DAV:getcontentlength, DAV:getcontenttype,

DAV:getetag, DAV:getlastmodified, DAV:resourcetype, and

DAV:supportedlock.

This example also demonstrates the use of XML namespace scoping, and

the default namespace. Since the "xmlns" attribute does not contain

an explicit "shorthand name" (prefix) letter, the namespace applies

by default to all enclosed elements. Hence, all elements which do

not explicitly state the namespace to which they belong are members

of the "DAV:" namespace schema.

8.2 PROPPATCH

The PROPPATCH method processes instructions specified in the request

body to set and/or remove properties defined on the resource

identified by the Request-URI.

All DAV compliant resources MUST support the PROPPATCH method and

MUST process instructions that are specified using the

propertyupdate, set, and remove XML elements of the DAV schema.

Execution of the directives in this method is, of course, subject to

access control constraints. DAV compliant resources SHOULD support

the setting of arbitrary dead properties.

The request message body of a PROPPATCH method MUST contain the

propertyupdate XML element. Instruction processing MUST occur in the

order instructions are received (i.e., from top to bottom).

Instructions MUST either all be executed or none executed. Thus if

any error occurs during processing all executed instructions MUST be

undone and a proper error result returned. Instruction processing

details can be found in the definition of the set and remove

instructions in section 12.13.

8.2.1 Status Codes for use with 207 (Multi-Status)

The following are examples of response codes one would expect to be

used in a 207 (Multi-Status) response for this method. Note,

however, that unless explicitly prohibited any 2/3/4/5xx series

response code may be used in a 207 (Multi-Status) response.

200 (OK) - The command succeeded. As there can be a mixture of sets

and removes in a body, a 201 (Created) seems inappropriate.

403 (Forbidden) - The client, for reasons the server chooses not to

specify, cannot alter one of the properties.

409 (Conflict) - The client has provided a value whose semantics are

not appropriate for the property. This includes trying to set read-

only properties.

423 (Locked) - The specified resource is locked and the client either

is not a lock owner or the lock type requires a lock token to be

submitted and the client did not submit it.

507 (Insufficient Storage) - The server did not have sufficient space

to record the property.

8.2.2 Example - PROPPATCH

>>Request

PROPPATCH /bar.html HTTP/1.1

Host: www.foo.com

Content-Type: text/xml; charset="utf-8"

Content-Length: xxxx

<?xml version="1.0" encoding="utf-8" ?>

<D:propertyupdate xmlns:D="DAV:"

xmlns:Z="http://www.w3.com/standards/z39.50/">

<D:set>

<D:prop>

<Z:authors>

<Z:Author>Jim Whitehead</Z:Author>

<Z:Author>Roy Fielding</Z:Author>

</Z:authors>

</D:prop>

</D:set>

<D:remove>

<D:prop><Z:Copyright-Owner/></D:prop>

</D:remove>

</D:propertyupdate>

>>Response

HTTP/1.1 207 Multi-Status

Content-Type: text/xml; charset="utf-8"

Content-Length: xxxx

<?xml version="1.0" encoding="utf-8" ?>

<D:multistatus xmlns:D="DAV:"

xmlns:Z="http://www.w3.com/standards/z39.50">

<D:response>

<D:href>http://www.foo.com/bar.html</D:href>

<D:propstat>

<D:prop><Z:Authors/></D:prop>

<D:status>HTTP/1.1 424 Failed Dependency</D:status>

</D:propstat>

<D:propstat>

<D:prop><Z:Copyright-Owner/></D:prop>

<D:status>HTTP/1.1 409 Conflict</D:status>

</D:propstat>

<D:responsedescription> Copyright Owner can not be deleted or

altered.</D:responsedescription>

</D:response>

</D:multistatus>

In this example, the client requests the server to set the value of

the http://www.w3.com/standards/z39.50/Authors property, and to

remove the property http://www.w3.com/standards/z39.50/Copyright-

Owner. Since the Copyright-Owner property could not be removed, no

property modifications occur. The 424 (Failed Dependency) status

code for the Authors property indicates this action would have

succeeded if it were not for the conflict with removing the

Copyright-Owner property.

8.3 MKCOL Method

The MKCOL method is used to create a new collection. All DAV

compliant resources MUST support the MKCOL method.

8.3.1 Request

MKCOL creates a new collection resource at the location specified by

the Request-URI. If the resource identified by the Request-URI is

non-null then the MKCOL MUST fail. During MKCOL processing, a server

MUST make the Request-URI a member of its parent collection, unless

the Request-URI is "/". If no such ancestor exists, the method MUST

fail. When the MKCOL operation creates a new collection resource,

all ancestors MUST already exist, or the method MUST fail with a 409

(Conflict) status code. For example, if a request to create

collection /a/b/c/d/ is made, and neither /a/b/ nor /a/b/c/ exists,

the request must fail.

When MKCOL is invoked without a request body, the newly created

collection SHOULD have no members.

A MKCOL request message may contain a message body. The behavior of

a MKCOL request when the body is present is limited to creating

collections, members of a collection, bodies of members and

properties on the collections or members. If the server receives a

MKCOL request entity type it does not support or understand it MUST

respond with a 415 (Unsupported Media Type) status code. The exact

behavior of MKCOL for various request media types is undefined in

this document, and will be specified in separate documents.

8.3.2 Status Codes

Responses from a MKCOL request MUST NOT be cached as MKCOL has non-

idempotent semantics.

201 (Created) - The collection or structured resource was created in

its entirety.

403 (Forbidden) - This indicates at least one of two conditions: 1)

the server does not allow the creation of collections at the given

location in its namespace, or 2) the parent collection of the

Request-URI exists but cannot accept members.

405 (Method Not Allowed) - MKCOL can only be executed on a

deleted/non-existent resource.

409 (Conflict) - A collection cannot be made at the Request-URI until

one or more intermediate collections have been created.

415 (Unsupported Media Type)- The server does not support the request

type of the body.

507 (Insufficient Storage) - The resource does not have sufficient

space to record the state of the resource after the execution of this

method.

8.3.3 Example - MKCOL

This example creates a collection called /webdisc/xfiles/ on the

server www.server.org.

>>Request

MKCOL /webdisc/xfiles/ HTTP/1.1

Host: www.server.org

>>Response

HTTP/1.1 201 Created

8.4 GET, HEAD for Collections

The semantics of GET are unchanged when applied to a collection,

since GET is defined as, "retrieve whatever information (in the form

of an entity) is identified by the Request-URI" [RFC2068]. GET when

applied to a collection may return the contents of an "index.html"

resource, a human-readable view of the contents of the collection, or

something else altogether. Hence it is possible that the result of a

GET on a collection will bear no correlation to the membership of the

collection.

Similarly, since the definition of HEAD is a GET without a response

message body, the semantics of HEAD are unmodified when applied to

collection resources.

8.5 POST for Collections

Since by definition the actual function performed by POST is

determined by the server and often depends on the particular

resource, the behavior of POST when applied to collections cannot be

meaningfully modified because it is largely undefined. Thus the

semantics of POST are unmodified when applied to a collection.

8.6 DELETE

8.6.1 DELETE for Non-Collection Resources

If the DELETE method is issued to a non-collection resource whose

URIs are an internal member of one or more collections, then during

DELETE processing a server MUST remove any URI for the resource

identified by the Request-URI from collections which contain it as a

member.

8.6.2 DELETE for Collections

The DELETE method on a collection MUST act as if a "Depth: infinity"

header was used on it. A client MUST NOT submit a Depth header with

a DELETE on a collection with any value but infinity.

DELETE instructs that the collection specified in the Request-URI and

all resources identified by its internal member URIs are to be

deleted.

If any resource identified by a member URI cannot be deleted then all

of the member's ancestors MUST NOT be deleted, so as to maintain

namespace consistency.

Any headers included with DELETE MUST be applied in processing every

resource to be deleted.

When the DELETE method has completed processing it MUST result in a

consistent namespace.

If an error occurs with a resource other than the resource identified

in the Request-URI then the response MUST be a 207 (Multi-Status).

424 (Failed Dependency) errors SHOULD NOT be in the 207 (Multi-

Status). They can be safely left out because the client will know

that the ancestors of a resource could not be deleted when the client

receives an error for the ancestor's progeny. Additionally 204 (No

Content) errors SHOULD NOT be returned in the 207 (Multi-Status).

The reason for this prohibition is that 204 (No Content) is the

default success code.

8.6.2.1 Example - DELETE

>>Request

DELETE /container/ HTTP/1.1

Host: www.foo.bar

>>Response

HTTP/1.1 207 Multi-Status

Content-Type: text/xml; charset="utf-8"

Content-Length: xxxx

<?xml version="1.0" encoding="utf-8" ?>

<d:multistatus xmlns:d="DAV:">

<d:response>

<d:href>http://www.foo.bar/container/resource3</d:href>

<d:status>HTTP/1.1 423 Locked</d:status>

</d:response>

</d:multistatus>

In this example the attempt to delete

http://www.foo.bar/container/resource3 failed because it is locked,

and no lock token was submitted with the request. Consequently, the

attempt to delete http://www.foo.bar/container/ also failed. Thus the

client knows that the attempt to delete http://www.foo.bar/container/

must have also failed since the parent can not be deleted unless its

child has also been deleted. Even though a Depth header has not been

included, a depth of infinity is assumed because the method is on a

collection.

8.7 PUT

8.7.1 PUT for Non-Collection Resources

A PUT performed on an existing resource replaces the GET response

entity of the resource. Properties defined on the resource may be

recomputed during PUT processing but are not otherwise affected. For

example, if a server recognizes the content type of the request body,

it may be able to automatically extract information that could be

profitably exposed as properties.

A PUT that would result in the creation of a resource without an

appropriately scoped parent collection MUST fail with a 409

(Conflict).

8.7.2 PUT for Collections

As defined in the HTTP/1.1 specification [RFC2068], the "PUT method

requests that the enclosed entity be stored under the supplied

Request-URI." Since submission of an entity representing a

collection would implicitly encode creation and deletion of

resources, this specification intentionally does not define a

transmission format for creating a collection using PUT. Instead,

the MKCOL method is defined to create collections.

When the PUT operation creates a new non-collection resource all

ancestors MUST already exist. If all ancestors do not exist, the

method MUST fail with a 409 (Conflict) status code. For example, if

resource /a/b/c/d.html is to be created and /a/b/c/ does not exist,

then the request must fail.

8.8 COPY Method

The COPY method creates a duplicate of the source resource,

identified by the Request-URI, in the destination resource,

identified by the URI in the Destination header. The Destination

header MUST be present. The exact behavior of the COPY method

depends on the type of the source resource.

All WebDAV compliant resources MUST support the COPY method.

However, support for the COPY method does not guarantee the ability

to copy a resource. For example, separate programs may control

resources on the same server. As a result, it may not be possible to

copy a resource to a location that appears to be on the same server.

8.8.1 COPY for HTTP/1.1 resources

When the source resource is not a collection the result of the COPY

method is the creation of a new resource at the destination whose

state and behavior match that of the source resource as closely as

possible. After a successful COPY invocation, all properties on the

source resource MUST be duplicated on the destination resource,

subject to modifying headers and XML elements, following the

definition for copying properties. Since the environment at the

destination may be different than at the source due to factors

outside the scope of control of the server, such as the absence of

resources required for correct operation, it may not be possible to

completely duplicate the behavior of the resource at the destination.

Subsequent alterations to the destination resource will not modify

the source resource. Subsequent alterations to the source resource

will not modify the destination resource.

8.8.2. COPY for Properties

The following section defines how properties on a resource are

handled during a COPY operation.

Live properties SHOULD be duplicated as identically behaving live

properties at the destination resource. If a property cannot be

copied live, then its value MUST be duplicated, octet-for-octet, in

an identically named, dead property on the destination resource

subject to the effects of the propertybehavior XML element.

The propertybehavior XML element can specify that properties are

copied on best effort, that all live properties must be successfully

copied or the method must fail, or that a specified list of live

properties must be successfully copied or the method must fail. The

propertybehavior XML element is defined in section 12.12.

8.8.3 COPY for Collections

The COPY method on a collection without a Depth header MUST act as if

a Depth header with value "infinity" was included. A client may

submit a Depth header on a COPY on a collection with a value of "0"

or "infinity". DAV compliant servers MUST support the "0" and

"infinity" Depth header behaviors.

A COPY of depth infinity instructs that the collection resource

identified by the Request-URI is to be copied to the location

identified by the URI in the Destination header, and all its internal

member resources are to be copied to a location relative to it,

recursively through all levels of the collection hierarchy.

A COPY of "Depth: 0" only instructs that the collection and its

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有