RFC 4437
Web Distributed Authoring and Versioning (WebDAV) Redirect Reference Resources
Web Distributed Authoring and Versioning (WebDAV) Redirect Reference Resources ๐
RFC 4437, from the Network Working Group, published March 2006. The authors are J. Whitehead (U.C. Santa Cruz), G. Clemm (IBM), and J. Reschke, Ed. (greenbytes). It's marked Category: Experimental, so it's an experiment, not a standard ๐งช. The title block has no Obsoletes or Updates line, so it doesn't replace or change any other RFC ๐ .
Status of This Memo
okay so this memo defines an Experimental Protocol for the Internet community ๐งช. It is not an Internet standard of any kind. The authors want feedback and suggestions for improvement, and anyone can share this memo as widely as they like ๐ซถ.
Copyright Notice
Copyright (C) The Internet Society (2006). ๐
Abstract
this spec is an extension to WebDAV that lets clients create redirect reference resources โจ. These are resources whose default response is an HTTP/1.1 3xx (Redirection) status code ๐ฆ. A redirect reference lets you reach the target resource indirectly, through any URI that's mapped to the redirect reference resource ๐ช.
Some things this doesn't cover: remapping whole trees of resources, and regular-expression based redirections ๐ โโ๏ธ. Redirect references come with no integrity guarantees either, so keep that in mind ๐. Other mechanisms can get you the same result too. The whole point of this spec is to let operators experiment with it and figure out the best approach over time ๐ฌ.
Table of Contents
1. Introduction ....................................................3
2. Notational Conventions ..........................................4
3. Terminology .....................................................4
4. Overview of Redirect Reference Resources ........................5
5. Operations on Redirect Reference Resources ......................6
6. MKREDIRECTREF Method ............................................7
6.1. Example: Creating a Redirect Reference Resource
with MKREDIRECTREF .........................................8
7. UPDATEREDIRECTREF Method ........................................9
7.1. Example: Updating a Redirect Reference Resource with
UPDATEREDIRECTREF .........................................10
8. Operations on Collections That Contain Redirect
Reference Resources ............................................11
8.1. Example: PROPFIND on a Collection with Redirect
Reference .................................................11
8.2. Example: PROPFIND with Apply-To-Redirect-Ref on a
Collection with Redirect Reference Resources ..............13
9. Operations on Targets of Redirect Reference Resources ..........15
10. Relative References in DAV:reftarget ..........................15
10.1. Example: Resolving a Relative Reference in a
Multi-Status Response.....................................16
11. Redirect References to Collections ............................17
12. Headers .......................................................18
12.1. Redirect-Ref Response Header .............................18
12.2. Apply-To-Redirect-Ref Request Header .....................19
13. Redirect Reference Resource Properties ........................19
13.1. DAV:redirect-lifetime (protected) ........................19
13.2. DAV:reftarget (protected) ................................19
14. XML Elements ..................................................19
14.1. redirectref XML Element ..................................19
15. Extensions to the DAV:response XML Element for Multi-Status
Responses .....................................................20
16. Capability Discovery ..........................................20
16.1. Example: Discovery of Support for Redirect
Reference Resources ......................................20
17. Security Considerations .......................................21
17.1. Privacy Concerns .........................................21
17.2. Redirect Loops ...........................................21
17.3. Redirect Reference Resources and Denial of Service .......21
17.4. Revealing Private Locations ..............................22
18. Internationalization Considerations ...........................22
19. IANA Considerations ...........................................22
19.1. HTTP headers .............................................22
19.1.1. Redirect-Ref ......................................22
19.1.2. Apply-To-Redirect-Ref .............................23
20. Contributors ..................................................23
21. Acknowledgements ..............................................23
22. Normative References ..........................................23
1. Introduction โจ
okay so this spec extends the Web Distributed Authoring Protocol (WebDAV) so clients can create new access paths to existing resources ๐๏ธ. This is useful for a few reasons, and they're honestly kind of iconic ๐.
WebDAV lets you organise HTTP resources into hierarchies, grouped into things called collections ๐. Collections are way easier to browse and manage than one big flat pile. The catch is that a hierarchy forces every resource into exactly one spot, which is a real problem when something belongs in more than one category ๐ฉ. Say you have a hierarchy of vehicle descriptions with collections for cars and boats. A description of a car/boat combo could go in either one ๐โต. Ideally it would show up in both, and this spec makes that possible by letting clients create new URIs that point at the same resource ๐.
Hierarchies also make sharing harder, because a resource that's useful in lots of collections still only gets one home ๐ . Take a maths department at one university that makes a collection about fractals ๐. It links to some local resources, but it also needs access to resources hosted at other universities. Copying those resources is often a bad idea, for reasons like saving disk space, respecting copyright, or making sure any changes to the shared resource show up automatically ๐. So being able to create new access paths to existing resources, even in other collections or on completely unrelated systems, is really useful ๐.
Redirect reference resources are the mechanism this spec defines for making those alternative access paths ๐ฆ. A redirect reference resource sits in one collection, and its whole job is to redirect requests to another resource, called its target, which might live in a different collection ๐ฏ. This means clients can send requests to the target from somewhere else. Most requests get redirected using a 3xx (Redirection) status code, so you get a kind of mediated access to the target ๐.
A redirect reference is a resource with properties but no body of its own ๐ซง. Those properties can record things like who made the reference, when, and why ๐. Because redirect reference resources are built on HTTP 3xx responses, sending a request to the intended resource usually takes two round trips โณ. The good news is that redirect references work just as well for local resources and for resources on a different system from the reference ๐ .
Here's the roadmap. Section 3 defines the terms used throughout the spec ๐. Section 4 gives an overview of redirect reference resources ๐. Section 5 defines how existing methods behave when they're applied to redirect reference resources ๐ ๏ธ. Section 6 covers creating a redirect reference resource, and Section 7 covers updating one ๐. Section 8 covers what happens when collections contain redirect reference resources ๐. Sections 9 through 11 talk about other issues that come up because redirect reference resources exist ๐งฉ. Sections 12 through 15 define the new headers, properties, and XML elements required to support redirect reference resources ๐ฆ. Section 16 covers capability discovery ๐. Sections 17 through 19 cover the security, internationalization, and IANA concerns ๐. The rest of the sections are supporting information ๐.
2. Notational Conventions ๐
this document describes a set of extensions to the WebDAV Distributed Authoring Protocol [RFC2518], which is itself an extension to HTTP/1.1 ๐ง . So the augmented BNF used here to describe protocol elements is exactly the same as the one in Section 2.1 of [RFC2616] ๐ค. That augmented BNF uses the basic production rules from Section 2.2 of [RFC2616], and those rules apply to this document too โ .
In this document, the key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" are to be interpreted as described in [RFC2119] ๐. These are the official requirement-level words, so when you see them they carry real weight ๐ช.
3. Terminology ๐
the terminology here follows and extends the terms in the WebDAV Distributed Authoring Protocol specification [RFC2518] โจ. The definitions of resource, Uniform Resource Identifier (URI), and Uniform Resource Locator (URL) come from [RFC3986] ๐.
Redirect Reference Resource ๐ฆ A resource created to redirect all requests made to it, using an HTTP status code from the 3xx range, to a defined target resource.
Non-Reference Resource ๐งฑ A resource that is not a reference to another resource.
Target Resource ๐ฏ The resource to which requests are redirected by a redirect reference resource. A target resource can be anything that can be identified by an absolute URI (see [RFC3986], "absolute-URI").
This document uses the terms "precondition", "postcondition", and "protected property" as defined in [RFC3253] ๐งพ. Servers MUST report pre-/postcondition failures as described in Section 1.6 of this document. This one is a must, not a maybe, so don't skip it ๐จ.
4. Overview of Redirect Reference Resources โจ
okay so, bestie, for ANY operation you submit to a redirect reference resource, the default response is a 302 (Found) ๐
. It comes with the Redirect-Ref header (more on that in Section 12.1, below) and a Location header ([RFC2616], Section 14.30) set to the URI of the target resource ๐. So the client can just resubmit the request to that target URI. Easy peasy ๐ธ
A redirect reference resource never automatically forwards requests to its target resource ๐ โโ๏ธ. Redirect resources give you the same vibe as links in HTML documents ๐. They can be created and maintained without the involvement or even knowledge of their target resource, and that makes linking between resources way cheaper ๐.
If the client knows it's working with a redirect reference resource, it can resolve the reference by retrieving the reference resource's DAV:reftarget property (defined in Section 13.2, below). Its value contains the URI of the target resource โจ. Then the client can submit requests to the target resource ๐ฆ.
A redirect reference resource is a brand new type of resource ๐. To tell redirect reference resources apart from non-reference resources, a new value of the DAV:resourcetype property (defined in [RFC2518]), DAV:redirectref, is defined in Section 14.1, below ๐ง.
Since a redirect reference resource is a resource, methods can be applied to the reference resource as well as to its target resource ๐.
The Apply-To-Redirect-Ref request header (defined in Section 12.2, below) exists so that referencing-aware clients can control whether an operation hits the redirect reference resource itself, or whether standard HTTP/WebDAV behaviour (redirection with a 3xx status code) happens instead ๐. You can use Apply-To-Redirect-Ref with most requests to redirect reference resources. It's especially useful with PROPFIND when you want the reference resource's own properties ๐ฅ.
Implementation Note: Operations on the target of a redirect reference usually do not affect the redirect reference itself ๐. Still, clients should not rely on this behaviour, because (for instance) some servers may update redirect references as a result of namespace operations on the reference's target ๐.
5. Operations on Redirect Reference Resources
Okay, so non-referencing-aware clients can't create reference resources, but they should still be able to submit requests through the reference resources made by reference-aware WebDAV clients ๐ซถ. They should be able to follow any references to their targets ๐ฆ. To make that possible, a server that receives any request made via a redirect reference resource MUST return a 3xx range (Redirection) status code, unless the request includes an Apply-To-Redirect-Ref header specifying "T" ๐
. The client and server MUST follow [RFC2616], Section 10.3, but with these extra rules:
- The
Locationresponse header MUST contain a URI (see [RFC3986], Section 3) that identifies the target of the reference resource ๐. - The response MUST include the
Redirect-Refheader โจ. This header lets reference-aware WebDAV clients recognize the resource as a reference resource and understand why they got redirected ๐ง .
A reference-aware WebDAV client can, just like a non-referencing client, resubmit the request to the URI in the Location header to operate on the target resource ๐ธ. Or it can resubmit the request to the URI of the redirect reference resource with the Apply-To-Redirect-Ref: T header to operate on the reference resource itself ๐. In that case the request MUST be applied to the reference resource itself, and a 3xx response MUST NOT be returned ๐.
As redirect references do not have bodies, GET and PUT requests with Apply-To-Redirect-Ref: T MUST fail with status 403 (forbidden) ๐ซ. Not possible, bestie ๐ญ.
6. MKREDIRECTREF Method
The MKREDIRECTREF method requests the creation of a redirect reference resource ๐ง.
If a MKREDIRECTREF request fails, the server state preceding the request MUST be restored ๐.
Responses from a MKREDIRECTREF request MUST NOT be cached ๐ โโ๏ธ, because MKREDIRECTREF has non-idempotent and non-safe semantics (see [RFC2616], Section 9.1). Not cute to cache this one ๐.
Marshalling
The request body MUST be a DAV:mkredirectref XML element ๐.
<!ELEMENT mkredirectref (reftarget, redirect-lifetime?)>
<!ELEMENT reftarget (href)>
<!ELEMENT redirect-lifetime (permanent | temporary)>
<!ELEMENT permanent EMPTY>
<!ELEMENT temporary EMPTY>
The DAV:href element is defined in [RFC2518] (Section 12.3) and MUST contain either a URI or a relative-ref (see [RFC3986], Sections 3 and 4.2) ๐.
If no DAV:redirect-lifetime element is specified, the server MUST behave as if a value of DAV:temporary was specified โณ.
If the request succeeds, the server MUST return 201 (Created) status ๐.
If a response body for a successful request is included, it MUST be a DAV:mkredirectref-response XML element. This document doesn't define any elements for the MKREDIRECTREF response body, but DAV:mkredirectref-response is defined so future extensions that do define response body elements stay interoperable ๐ซถ.
<!ELEMENT mkredirectref-response ANY>
Preconditions
- (DAV:resource-must-be-null): A resource MUST NOT exist at the Request-URI ๐.
- (DAV:parent-resource-must-be-non-null): The Request-URI minus the last path segment MUST identify a collection ๐.
- (DAV:name-allowed): The last segment of the Request-URI is available for use as a resource name ๐ท๏ธ.
- (DAV:locked-update-allowed): If the collection identified by the Request-URI minus the last path segment is write-locked, then the appropriate token MUST be specified in an If request header ๐.
- (DAV:redirect-lifetime-supported): If the request body contains a
DAV:redirect-lifetimeelement, the server MUST support the specified lifetime. Support forDAV:temporaryis REQUIRED, while support forDAV:permanentis OPTIONAL ๐ฐ. - (DAV:legal-reftarget): The specified is a legal URI or relative-ref โ .
Postconditions
- (DAV:new-redirectref): a new redirect reference resource is created whose
DAV:reftargetproperty has the value specified in the request body ๐ฆ.
6.1. Example: Creating a Redirect Reference Resource with MKREDIRECTREF
>> Request:
MKREDIRECTREF /~whitehead/dav/spec08.ref HTTP/1.1
Host: www.example.com
Content-Type: text/xml; charset="utf-8"
Content-Length: xxx
<?xml version="1.0" encoding="utf-8" ?>
<D:mkredirectref xmlns:D="DAV:">
<D:reftarget>
<D:href>/i-d/draft-webdav-protocol-08.txt</D:href>
</D:reftarget>
</D:mkredirectref>
>> Response:
HTTP/1.1 201 Created
This request resulted in the creation of a new redirect reference resource at http://www.example.com/~whitehead/dav/spec08.ref ๐. It points to the resource identified by the DAV:reftarget property. In this example, the target resource is identified by the URI http://www.example.com/i-d/draft-webdav-protocol-08.txt ๐ฏ. The redirect reference resource's DAV:resourcetype property is set to DAV:redirectref, and its DAV:redirect-lifetime property has the value DAV:temporary ๐.
7. UPDATEREDIRECTREF Method
The UPDATEREDIRECTREF method requests the update of a redirect reference resource โ๏ธ.
If an UPDATEREDIRECTREF request fails, the server state preceding the request MUST be restored ๐.
Responses from an UPDATEREDIRECTREF request MUST NOT be cached ๐ โโ๏ธ, because UPDATEREDIRECTREF has non-safe semantics (see [RFC2616], Section 9.1).
Marshalling
The request body MUST be a DAV:updateredirectref XML element ๐.
<!ELEMENT updateredirectref (reftarget?, redirect-lifetime?)>
See Section 6 for a definition of DAV:reftarget and DAV:redirect-lifetime ๐.
If no DAV:reftarget element is specified, the server MUST NOT change the target of the redirect reference ๐ซ.
If no DAV:redirect-lifetime element is specified, the server MUST NOT change the lifetime of the redirect reference โณ.
If a response body for a successful request is included, it MUST be a DAV:updateredirectref-response XML element. This document doesn't define any elements for the UPDATEREDIRECTREF response body either, but DAV:updateredirectref-response is defined to keep future extensions interoperable ๐ซถ.
<!ELEMENT updateredirectref-response ANY>
Preconditions
- (DAV:locked-update-allowed): if the resource is write-locked, then the appropriate token MUST be specified in an If request header ๐.
- (DAV:must-be-redirectref): the resource identified by the Request-URI must be a redirect reference resource as defined by this specification ๐ฆ.
- (DAV:redirect-lifetime-supported): see Section 6 ๐ฐ.
- (DAV:redirect-lifetime-update-supported): servers MAY support changing the
DAV:redirect-lifetimeproperty; if they don't, this condition code can be used to signal failure ๐ฆ. - (DAV:legal-reftarget): see Section 6 โ .
Postconditions
- (DAV:redirectref-updated): the
DAV:reftargetandDAV:redirect-lifetimeproperties of the redirect reference have been updated accordingly โจ.
7.1. Example: Updating a Redirect Reference Resource with UPDATEREDIRECTREF
>> Request:
UPDATEREDIRECTREF /~whitehead/dav/spec08.ref HTTP/1.1
Host: www.example.com
Apply-To-Redirect-Ref: T
Content-Type: text/xml; charset="utf-8"
Content-Length: xxx
<?xml version="1.0" encoding="utf-8" ?>
<D:updateredirectref xmlns:D="DAV:">
<D:reftarget>
<D:href>/i-d/draft-webdav-protocol-08b.txt</D:href>
</D:reftarget>
</D:updateredirectref>
>> Response:
HTTP/1.1 200 OK
This request updated the redirect reference's DAV:reftarget property to "/i-d/draft-webdav-protocol-08b.txt" ๐ and didn't change the DAV:redirect-lifetime value ๐ธ. Note that the "Apply-To-Redirect-Ref" request header must be used ๐. Otherwise, the request would result in a redirect (3xx) response status ๐ญ.
8. Operations on Collections That Contain Redirect Reference Resources โจ
okay so, according to [RFC2518], Section 9.2, methods that have defined interactions with the "Depth" request header should apply all other request headers to each resource in scope ๐ . But if we applied that rule to "Apply-To-Redirect-Ref" across the board, it would be super impractical to build this spec on top of existing servers ๐ญ. It would also cause unexpected server behaviour for clients that don't even know redirect references exist ๐. The good news is that the "Depth" header lets alternate behaviours be explicitly defined, so we don't have to force it ๐ซถ.
So this spec defines the interaction between "Depth" and "Apply-To-Redirect-Ref" on a case-by-case basis ๐. It also provides a default for methods that aren't mentioned here and don't define their own behaviour โจ.
+-------------+-----------------+------------------+-----------+
| method name | defined in | supported depths | behaviour |
+-------------+-----------------+------------------+-----------+
| COPY | [RFC2518], 8.9 | 0, infinity | "T" |
| DELETE | [RFC2518], 8.7 | infinity | "T" |
| LOCK | [RFC2518], 8.11 | 0, infinity | "T" |
| MOVE | [RFC2518], 8.10 | 0, infinity | "T" |
| PROPFIND | [RFC2518], 8.2 | 0, 1, infinity | inherit |
| REPORT | [RFC3253], 3.6 | 0, 1, infinity | inherit |
| default | | | "T" |
+-------------+-----------------+------------------+-----------+
When the behaviour is defined to be "inherit", the method should follow [RFC2518]'s default behaviour for "Depth" operations ๐ธ. That means applying the value given for "Apply-To-Redirect-Ref" to each resource in scope. When the behaviour is defined to be "T" instead, the method should behave as if an "Apply-To-Redirect-Ref: T" header was specified for each operation on child resources ๐ฆ. This is the bit that keeps "Depth: infinity" operations from failing unexpectedly just because a redirect reference resource happened to be in scope ๐.
8.1. Example: PROPFIND on a Collection with Redirect Reference Resources
Suppose a PROPFIND request with Depth: infinity is submitted to the following collection, with the members shown here ๐:
/MyCollection/
(non-reference resource) diary.html
(redirect reference resource) nunavut
Request:
PROPFIND /MyCollection/ HTTP/1.1
Host: example.com
Depth: infinity
Apply-To-Redirect-Ref: F
Content-Type: text/xml
Content-Length: xxxx
<?xml version="1.0" ?>
<D:propfind xmlns:D="DAV: ">
<D:prop xmlns:J="http://example.com/jsprops/">
<D:resourcetype/>
<J:keywords/>
</D:prop>
</D:propfind>
Response:
HTTP/1.1 207 Multi-Status
Content-Type: text/xml
Content-Length: xxxx
<?xml version="1.0" ?>
<D:multistatus xmlns:D="DAV:" xmlns:J="http://example.com/jsprops/">
<D:response>
<D:href>/MyCollection/</D:href>
<D:propstat>
<D:prop>
<D:resourcetype><D:collection/></D:resourcetype>
<J:keywords>diary, interests, hobbies</J:keywords>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
<D:response>
<D:href>/MyCollection/diary.html</D:href>
<D:propstat>
<D:prop>
<D:resourcetype/>
<J:keywords>diary, travel, family, history</J:keywords>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
<D:response>
<D:href>/MyCollection/nunavut</D:href>
<D:status>HTTP/1.1 302 Found</D:status>
<D:location>
<D:href>http://example.ca/art/inuit/</D:href>
</D:location>
</D:response>
</D:multistatus>
In this example, the Depth header is set to infinity and the Apply-To-Redirect-Ref header is set to "F" โจ. The collection contains one URI that identifies a redirect reference resource. The response element for that redirect reference resource has a status of 302 (Found) and includes a DAV:location extension element, so clients can retrieve the properties of its target resource ๐ง. (The response element for the redirect reference resource doesn't include the requested properties. The client can submit another PROPFIND request to the URI in the DAV:location pseudo-property to get those properties ๐ .)
8.2. Example: PROPFIND with Apply-To-Redirect-Ref on a Collection with Redirect Reference Resources
Suppose a PROPFIND request with "Apply-To-Redirect-Ref: T" and Depth: infinity is submitted to the following collection, with the members shown here ๐:
/MyCollection/
(non-reference resource) diary.html
(redirect reference resource) nunavut
Request:
PROPFIND /MyCollection/ HTTP/1.1
Host: example.com
Depth: infinity
Apply-To-Redirect-Ref: T
Content-Type: text/xml
Content-Length: xxxx
<?xml version="1.0" ?>
<D:propfind xmlns:D="DAV:">
<D:prop>
<D:resourcetype/>
<D:reftarget/>
<D:redirect-lifetime/>
</D:prop>
</D:propfind>
Response:
HTTP/1.1 207 Multi-Status
Content-Type: text/xml
Content-Length: xxxx
<?xml version="1.0" ?>
<D:multistatus xmlns:D="DAV:">
<D:response>
<D:href>/MyCollection/</D:href>
<D:propstat>
<D:prop>
<D:resourcetype><D:collection/></D:resourcetype>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
<D:propstat>
<D:prop>
<D:reftarget/>
<D:redirect-lifetime/>
</D:prop>
<D:status>HTTP/1.1 404 Not Found</D:status>
</D:propstat>
</D:response>
<D:response>
<D:href>/MyCollection/diary.html</D:href>
<D:propstat>
<D:prop>
<D:resourcetype/>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
<D:propstat>
<D:prop>
<D:reftarget/>
<D:redirect-lifetime/>
</D:prop>
<D:status>HTTP/1.1 404 Not Found</D:status>
</D:propstat>
</D:response>
<D:response>
<D:href>/MyCollection/nunavut</D:href>
<D:propstat>
<D:prop>
<D:resourcetype><D:redirectref/></D:resourcetype>
<D:reftarget>
<D:href>http://example.ca/art/inuit/</D:href>
</D:reftarget>
<D:redirect-lifetime><D:temporary/></D:redirect-lifetime>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
</D:multistatus>
Since the "Apply-To-Redirect-Ref: T" header is present, the response shows the properties of the redirect reference resource in the collection rather than reporting a 302 status ๐.
9. Operations on Targets of Redirect Reference Resources
Operations on targets of redirect reference resources have no effect on the reference resource ๐ซถ. Bestie, the reference resource is totally independent of what happens to its target ๐ .
10. Relative References in DAV:reftarget
The URI in the href in a DAV:reftarget property MAY be a relative reference ๐ฆ. In that case, the base URI used to resolve it to absolute form is the URI used in the HTTP message to identify the redirect reference resource that the DAV:reftarget property belongs to ๐ง.
When DAV:reftarget appears in the context of a Multi-Status response, it's inside a DAV:response element that contains a single DAV:href element ๐ธ. The value of that DAV:href element serves as the base URI for resolving a relative reference in DAV:reftarget. The value of DAV:href may itself be relative, in which case it must be resolved first, so it can serve as the base URI for the relative reference in DAV:reftarget ๐ฅ. If the DAV:href element is relative, its base URI is constructed from the scheme component "http", the value of the Host header in the request, and the Request-URI ๐.
10.1. Example: Resolving a Relative Reference in a Multi-Status Response
Request:
PROPFIND /geog/ HTTP/1.1
Host: example.com
Apply-To-Redirect-Ref: T
Depth: 1
Content-Type: text/xml
Content-Length: nnn
<?xml version="1.0" ?>
<D:propfind xmlns:D="DAV:">
<D:prop>
<D:resourcetype/>
<D:reftarget/>
</D:prop>
</D:propfind>
Response:
HTTP/1.1 207 Multi-Status
Content-Type: text/xml
Content-Length: nnn
<?xml version="1/0" ?>
<D:multistatus xmlns:D="DAV:">
<D:response>
<D:href>/geog/</D:href>
<D:propstat>
<D:prop>
<D:resourcetype><D:collection/></D:resourcetype>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
<D:propstat>
<D:prop><D:reftarget/></D:prop>
<D:status>HTTP/1.1 404 Not Found</D:status>
</D:propstat>
</D:response>
<D:response>
<D:href>/geog/stats.html</D:href>
<D:propstat>
<D:prop>
<D:resourcetype><D:redirectref/></D:resourcetype>
<D:reftarget>
<D:href>statistics/population/1997.html</D:href>
</D:reftarget>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
</D:multistatus>
In this example, the relative reference "statistics/population/1997.html" is returned as the value of the DAV:reftarget property for the reference resource identified by href /geog/stats.html ๐. That href is itself a relative reference, which resolves to http://example.com/geog/stats.html. This is the base URI for resolving the relative reference in reftarget. So the absolute URI of reftarget is http://example.com/geog/statistics/population/1997.html ๐.
11. Redirect References to Collections โจ
okay so this section is where redirect reference resources get really wild ๐ญ๐. In a Request-URI /segment1/segment2/segment3, any of the three segments can be a redirect reference resource ๐ฆ. (Check [RFC3986], Section 3.3, if you want the official definitions of "path" and "segment" ๐ค.) If any segment in a Request-URI turns out to be a redirect reference resource, the response SHOULD be a 3xx ๐
. The Location header in that response gets worked out like this:
The leftmost path segment of the Request-URI that is a redirect reference resource, plus every path segment and separator to its left, gets swapped out for the redirect reference resource's DAV:reftarget property (resolved to an absolute URI) ๐. Whatever is left over in the Request-URI just gets stuck onto the end of that new path ๐ง.
Note: If theDAV:reftargetproperty ends with a/and the remainder of the Request-URI is non-empty (so it has to start with a/), the final/in theDAV:reftargetproperty gets dropped before the remainder is appended ๐.
Okay, let's do an example, because this is where it clicks ๐ธ. Say the Request-URI is /x/y/z.html. Suppose /x/ is a redirect reference resource whose target is the collection /a/. That collection holds a redirect reference resource called y, whose target is the collection /b/. And that collection holds a redirect reference resource called z.html, whose target is /c/d.html ๐.
/x/y/z.html
|
| /x -> /a
|
v
/a/y/z.html
|
| /a/y -> /b
|
v
/b/z.html
|
| /b/z.html -> /c/d.html
|
v
/c/d.html
So the client has to follow up three separate 3xx responses before it finally lands on the target resource ๐ฉ๐ค๏ธ. The server answers the first request with a 3xx and Location: /a/y/z.html, and the client resubmits the request to /a/y/z.html. The server answers that one with a 3xx and Location: /b/z.html, and the client resubmits to /b/z.html. The server answers this one with a 3xx and Location: /c/d.html, and the client resubmits to /c/d.html. Finally, that last request succeeds ๐๐.
Note: The behaviour described above may have a very serious impact on the efficiency of mapping Request-URIs to resources in HTTP request processing. Therefore, servers MAY respond with a 404 status code if the cost of checking all leading path segments for redirect references seems prohibitive ๐. (Honestly, that's a very fair escape hatch, bestie ๐.)
12. Headers ๐
12.1. Redirect-Ref Response Header
Redirect-Ref = "Redirect-Ref:" (URI | relative-ref)
; URI: see [RFC3986], Section 3
; relative-ref: see [RFC3986], Section 4.2
The Redirect-Ref header shows up in all 3xx responses from redirect reference resources ๐. Its value is the link target you specified when you created the redirect reference resource ๐.
12.2. Apply-To-Redirect-Ref Request Header
Apply-To-Redirect-Ref = "Apply-To-Redirect-Ref" ":" ("T" | "F")
The optional Apply-To-Redirect-Ref header can be used on any request to a redirect reference resource ๐ง. When it's present and set to "T", the request MUST be applied to the reference resource itself, and a 3xx response MUST NOT be returned ๐
โโ๏ธ. No redirect, no drama, just vibes ๐.
If the Apply-To-Redirect-Ref header gets used on a request to any other sort of resource besides a redirect reference resource, the server MUST ignore it ๐ซถ.
13. Redirect Reference Resource Properties ๐ธ
The properties defined below are REQUIRED on redirect reference resources ๐. A PROPFIND/allprop request SHOULD NOT return any of the properties defined in this document ๐, because nobody needs that much info dumped on them at once.
13.1. DAV:redirect-lifetime (protected)
This property tells you about the lifetime of a redirect โณ. It can be either DAV:permanent (HTTP status 301) or DAV:temporary (HTTP status 302) ๐ฆ. Future protocols may define additional values ๐ฎ.
<!ELEMENT redirect-lifetime (permanent | temporary)>
<!ELEMENT permanent EMPTY>
<!ELEMENT temporary EMPTY>
13.2. DAV:reftarget (protected)
This property gives clients an efficient way to discover the URI of the target resource ๐งญ. It's read-only after its initial creation, and its value can only be set in a MKREDIRECTREF request ๐. The value is a DAV:href element containing the URI of the target resource ๐.
<!ELEMENT reftarget href >
14. XML Elements ๐ง
14.1. redirectref XML Element
Name: redirectref
Namespace: DAV:
Purpose: Used as the value of the DAV:resourcetype property to specify that the resource type is a redirect reference resource ๐.
<!ELEMENT redirectref EMPTY >
15. Extensions to the DAV:response XML Element for Multi-Status Responses โจ
As described in Section 8, the DAV:location element may be returned in the DAV:response element of a 207 Multi-Status response ๐ฌ. That lets clients resubmit their requests to the target resource of a redirect reference resource ๐โโ๏ธ.
Because of that, the definition of the DAV:response XML element changes to the following ๐:
<!ELEMENT response (href, ((href*, status)|(propstat+)),
responsedescription?, location?) >
<!ELEMENT location (href) >
16. Capability Discovery ๐
Sections 9.1 and 15 of [RFC2518] describe how compliance classes get used with the DAV header in responses to OPTIONS, so a server can say which parts of the WebDAV Distributed Authoring protocols a resource supports ๐๏ธ. This specification defines an OPTIONAL extension to [RFC2518] ๐
. It adds a new compliance class called redirectrefs, for use with the DAV header in responses to OPTIONS requests ๐. If a resource does support redirect references, its OPTIONS response can show that by listing the new redirectrefs compliance class in the DAV header and by listing the MKREDIRECTREF method as one it supports ๐ซถ.
When it's responding to an OPTIONS request, any type of resource can include redirectrefs in the value of the DAV header ๐ฆ. Doing that tells everyone that the server permits a redirect reference resource at the Request-URI โจ.
16.1. Example: Discovery of Support for Redirect Reference Resources
>> Request:
OPTIONS /somecollection/someresource HTTP/1.1
Host: example.org
>> Response:
HTTP/1.1 200 OK
Allow: OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, COPY, MOVE
Allow: MKCOL, PROPFIND, PROPPATCH, LOCK, UNLOCK, MKREDIRECTREF
DAV: 1, 2, redirectrefs
The DAV header in the response shows that the resource /somecollection/someresource is level 1 and level 2 compliant, as defined in [RFC2518] ๐. On top of that, /somecollection/someresource supports redirect reference resources ๐. The Allow header shows that MKREDIRECTREF requests can be submitted to /somecollection/someresource ๐.
17. Security Considerations ๐๐
This section is here to make applications that implement this protocol aware of its security implications ๐จ. Bestie, please read this part carefully ๐ซถ.
All of the security considerations of HTTP/1.1 and the WebDAV Distributed Authoring Protocol specification also apply to this protocol specification ๐งฑ. On top of that, redirect reference resources bring several new security concerns and raise the risk of some existing threats ๐ฑ. Those issues are detailed below ๐.
17.1. Privacy Concerns
By creating redirect reference resources on a trusted server, it's possible for a hostile agent to trick users into sending private information to a target on an unrelated system ๐ค. This risk is mitigated somewhat, since clients are required to notify the user of the redirection for any request other than GET or HEAD ๐ก๏ธ. (See [RFC2616], Section 10.3.3, 302 Found.)
17.2. Redirect Loops
Redirect loops were already possible in HTTP 1.1, but the introduction of the MKREDIRECTREF method creates a new avenue for clients to create loops, whether by accident or on purpose ๐. If the reference resource and its target are on the same server, the server may be able to detect MKREDIRECTREF requests that would create loops ๐ต๏ธโโ๏ธ. See also [RFC2616], Section 10.3, "Redirection 3xx." ๐
17.3. Redirect Reference Resources and Denial of Service
Denial of service attacks were already possible by posting URLs that were meant for limited use at heavily used Web sites ๐. The introduction of MKREDIRECTREF creates a new avenue for similar denial of service attacks โ ๏ธ. Clients can now create redirect reference resources at heavily used sites that point to locations which were never designed for heavy traffic ๐ญ.
17.4. Revealing Private Locations
There are several ways that redirect reference resources can reveal information about collection structures ๐. First, the DAV:reftarget property of every redirect reference resource contains the URI of the target resource ๐บ๏ธ. Anyone who has access to the reference resource can discover the collection path that leads to the target resource ๐. The owner of the target resource may have wanted to keep this collection structure under wraps ๐.
Sufficiently powerful access control mechanisms can control this risk to some extent ๐. Property-level access control could stop users from examining the DAV:reftarget property ๐ซ. (The Location header returned in responses to requests on redirect reference resources reveals the same information, however ๐ฅฒ.)
This risk is no greater than the similar risk posed by HTML links ๐.
18. Internationalization Considerations ๐
All internationalization considerations mentioned in [RFC2518] also apply to this document ๐ฃ๏ธ.
19. IANA Considerations ๐
All IANA considerations mentioned in [RFC2518] also apply to this document ๐.
19.1. HTTP headers
This document specifies the two new HTTP headers listed below ๐.
19.1.1. Redirect-Ref
- Header field name:
Redirect-Ref - Applicable protocol:
http - Status:
standard - Author/Change controller:
IETF - Specification document: this specification (Section 12.1)
19.1.2 Apply-To-Redirect-Ref
- Header field name:
Apply-To-Redirect-Ref - Applicable protocol:
http - Status:
standard - Author/Change controller:
IETF - Specification document: this specification (Section 12.2)
20. Contributors ๐ซถ
Many thanks to Jason Crawford, Jim Davis, Chuck Fay, and Judith Slein ๐, who can take credit for big parts of the original design of this specification ๐.
21. Acknowledgements ๐
This document has benefited from thoughtful discussion by Jim Amsden, Peter Carlson, Steve Carter, Tyson Chihaya, Ken Coar, Ellis Cohen, Bruce Cragun, Spencer Dawkins, Mark Day, Rajiv Dulepet, David Durand, Lisa Dusseault, Stefan Eissing, Roy Fielding, Yaron Goland, Fred Hitt, Alex Hopmann, James Hunt, Marcus Jager, Chris Kaler, Manoj Kasichainula, Rohit Khare, Daniel LaLiberte, Steve Martin, Larry Masinter, Jeff McAffer, Joe Orton, Surendra Koduru Reddy, Juergen Reuter, Max Rible, Sam Ruby, Bradley Sergeant, Nick Shelness, John Stracke, John Tigue, John Turner, Kevin Wiggen, and others ๐ฅฐ๐.
22. Normative References โจ
okay so these are the docs this spec literally can't function without, bestie ๐ each one is a link you have to read to understand the whole thing ๐ซถ
- [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
- [RFC2518] Goland, Y., Whitehead, E., Faizi, A., Carter, S., and D. Jensen, "HTTP Extensions for Distributed Authoring -- WEBDAV", RFC 2518, February 1999.
- [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999.
- [RFC3253] Clemm, G., Amsden, J., Ellison, T., Kaler, C., and J. Whitehead, "Versioning Extensions to WebDAV (Web Distributed Authoring and Versioning)", RFC 3253, March 2002.
- [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform Resource Identifier (URI): Generic Syntax", STD 66, RFC 3986, January 2005.
Authors' Addresses ๐
these are the people who wrote it, so you know exactly who to thank (or blame ๐ญ)
Jim Whitehead
UC Santa Cruz, Dept. of Computer Science
1156 High Street
Santa Cruz, CA 95064
US
EMail: ejw@cse.ucsc.edu
Geoff Clemm
IBM
20 Maguire Road
Lexington, MA 02421
US
EMail: geoffrey.clemm@us.ibm.com
Julian F. Reschke (editor)
greenbytes GmbH
Hafenweg 16
Muenster, NW 48155
Germany
Phone: +49 251 2807760
Fax: +49 251 2807761
EMail: julian.reschke@greenbytes.de
URI: http://greenbytes.de/tech/webdav/
Full Copyright Statement ๐
okay the legal bit, but make it quick ๐ The Internet Society owns the copyright here (2006). This document is covered by the rights, licenses and restrictions in BCP 78, and unless that says otherwise, the authors keep all their rights.
The document and everything in it is provided "AS IS". The contributor, the organization they represent or are sponsored by (if any), the Internet Society, and the Internet Engineering Task Force all disclaim every warranty, express or implied. That includes no warranty that using the information won't infringe any rights, and no implied warranties of merchantability or fitness for a particular purpose. So use it with eyes open, periodt ๐
Intellectual Property ๐ฆ
the IETF doesn't take a side on whether any IPR (intellectual property rights) apply to the tech in here, or whether you can get a license to use it. It also hasn't checked for any rights on its own. If you want the details on how rights work for RFC docs, look at BCP 78 and BCP 79 ๐ฅ
Copies of IPR disclosures sent to the IETF Secretariat, any promised licenses, and the results of any attempt to get a general license for implementers or users are all available from the IETF's online IPR repository at http://www.ietf.org/ipr.
The IETF also invites anyone to flag copyrights, patents, patent applications, or other proprietary rights that might cover technology needed to implement this standard. Send that info to the IETF at ietf-ipr@ietf.org ๐ธ
Acknowledgement ๐ง
Funding for the RFC Editor function comes from the IETF Administrative Support Activity (IASA). Thank you, IASA, you're literally the reason these docs get published โจ๐
๐ฆ where this page comes from
- ietf: rfc4437 2006-03
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms