MAY“>
MUST“>
MUST NOT“>
OPTIONAL“>
RECOMMENDED“>
REQUIRED“>
SHALL“>
SHALL NOT“>
SHOULD“>
SHOULD NOT“>
]>
The Hypertext Transfer Protocol (HTTP)
GET-Location headergreenbytes GmbHHafenweg 16MuensterNW48155Germany+49 251 2807760julian.reschke@greenbytes.dehttp://greenbytes.de/tech/webdav/
Several hypertext transfer protocol (HTTP) extensions use methods other than
GET to expose information. This has the drawback that this kind of
information is harder to identify (missing a URL to which a GET request could
be applied) and to cache.
This document specifies a simple extension header through which a server
can advertise a substitute URL that an HTTP client subsequently can use
with the GET method.
Distribution of this document is unlimited. Please send comments to the
Hypertext Transfer Protocol (HTTP) mailing list at ietf-http-wg@w3.org, which may be joined by sending a message with subject
“subscribe” to ietf-http-wg-request@w3.org.
Discussions of the HTTP working group are archived at
.
XML versions, latest edits and the issues list for this document
are available from .
Several HTTP () extensions use methods other than
GET to expose information. This has the drawback that this kind of information
is harder to identify (missing a URL to which a GET request could
be applied) and to cache.
This document specifies a simple extension header through which a server
can advertise a substitute URL that an HTTP client subsequently can use
with the GET method.
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 .
The terminology used here follows and extends that in the HTTP specification
.
The GET-Location entity header identifies a substitute resource that
can be used in subsequent requests for the same information, but using the
GET method.
Note that, by definition, the GET-Location header can only used
on responses to safe methods.
Syntax (using the the augmented Backus-Naur Form (BNF) defined
in ):
GET-Location = “GET-Location” “:” “<” Simple-ref “>”
*( “;” location-directive ) )
location-directive = “etag=” entity-tag
| “max-age” “=” delta-seconds
| location-extension
location-extension = token [ “=” ( token | quoted-string ) ]
Simple-ref = absolute-URI | ( path-absolute [ “?” query ] )
absolute-URI = <defined in >
delta-seconds = <defined in >
entity-tag = <defined in >
path-absolute = <defined in >
quoted-string = <defined in >
query = <defined in >
token = <defined in >
Where:
Contains either the URI or the absolute path of the location.
The server can include the entity tag for the returned entity, if it would
have been retrieved by a GET request to the substitute resource. Note that
this is different from the value of the “ETag” header which could also
be included in the response, but which would apply to the resource identified
by the Request-URI.
Specifies a lifetime for the information returned by this header. A
client &MUST; discard any information related to this header after
the specified amount of time.
The freshness lifetime for the information obtained from the GET-Location
header does not depend on the cacheability of the response it was obtained from
(which, in general, may not be cacheable at all). The “max-age” directive
allows the server to specify after how many seconds a client should discard
knowledge about the alternate resource. In absence of that header, clients
&SHOULD; discard the information after 3600 seconds.
This specification introduces no new security considerations beyond those
discussed in .
This document specifies the new HTTP header listed below, to be added to
the permanent registry (see ).
GET-LocationhttpstandardIETF of this specificationKey words for use in RFCs to Indicate Requirement LevelsHarvard Universitysob@harvard.eduHypertext Transfer Protocol — HTTP/1.1University of California, Irvinefielding@ics.uci.eduW3Cjg@w3.orgCompaq Computer Corporationmogul@wrl.dec.comMIT Laboratory for Computer Sciencefrystyk@w3.orgXerox Corporationmasinter@parc.xerox.comMicrosoft Corporationpaulle@microsoft.comW3Ctimbl@w3.orgUniform Resource Identifier (URI): Generic SyntaxWorld Wide Web ConsortiumMassachusetts Institute of Technology77 Massachusetts AvenueCambridgeMA02139USA+1-617-253-5702+1-617-258-5999timbl@w3.orghttp://www.w3.org/People/Berners-Lee/Day Software5251 California Ave., Suite 110IrvineCA92617USA+1-949-679-2960+1-949-679-2972fielding@gbiv.comhttp://roy.gbiv.com/Adobe Systems Incorporated345 Park AveSan JoseCA95110USA+1-408-536-3024LMM@acm.orghttp://larry.masinter.net/Versioning Extensions to WebDAVRational Softwaregeoffrey.clemm@rational.comIBMjamsden@us.ibm.comIBMtim_ellison@uk.ibm.comMicrosoftckaler@microsoft.comUC Santa Cruz, Dept. of Computer Scienceejw@cse.ucsc.eduRegistration Procedures for Message Header FieldsHTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)CommerceNet2064 Edgewood Dr.Palo AltoCA94303USldusseault@commerce.netURI Templatejoe@bitworking.orghttp://bitworking.org/Sun MicrosystemsMarc.Hadley@sun.comhttp://sun.com/mnot@pobox.comhttp://mnot.net/BEA Systems, Inc.dorchard@bea.comhttp://bea.com/
In this example the client uses the WebDAV
PROPFIND method (“HTTP Extensions for Web Distributed Authoring and Versioning”, )
to get a list of all collection members, along with their DAV:resourcetype
property ():
>>Request
PROPFIND /collection/ HTTP/1.1
Host: example.com
Depth: 1
Content-Type: application/xml
<propfind xmlns=”DAV:”>
<prop>
<resourcetype/>
</prop>
</propfind>
The response contains the requested information, plus the
GET-Location header, identifying a separate resource which can
provide the same information using the HTTP GET method:
>>Response
HTTP/1.1 207 Multi-Status
Content-Type: application/xml
GET-Location: <http://example.com/collection/;members>; etag=”123″;
max-age=3600
<multistatus xmlns=”DAV”:>
<response>
<href>/collection/</href>
<propstat>
<prop>
<resourcetype><collection/></resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/collection/member</href>
<propstat>
<prop>
<resourcetype/>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
</multistatus>
The response provided the URL of the substitute resource, so when the
client wishes to refresh the collection information, it uses that URI.
The response contained the entity tag for the data being returned, so
it can make the request conditional:
>>Request
GET /collection/;members HTTP/1.1
Host: example.com
Accept: application/xml
If-None-Match: “123”
The information did not change, so the server does not need to return
new data:
>>Response
HTTP/1.1 304 Not Modified
Later on, the client tries again. This time, however, a second member
has been added:
>>Request
GET /collection/;members HTTP/1.1
Host: example.com
Accept: application/xml
If-None-Match: “123”
>>Response
HTTP/1.1 200 OK
Content-Type: application/xml
ETag: “124”
<multistatus xmlns=”DAV”:>
<response>
<href>/collection/</href>
<propstat>
<prop>
<resourcetype><collection/></resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/collection/member</href>
<propstat>
<prop>
<resourcetype/>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/collection/member2</href>
<propstat>
<prop>
<resourcetype/>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
</multistatus>
Finally, the collection has been removed by somebody else. The client
tries a refresh:
>>Request
GET /collection/;members HTTP/1.1
Host: example.com
Accept: application/xml
If-None-Match: “124”
>>Response
HTTP/1.1 404 Not Found
Note that it may be hard to compute strong entity tags for more complex
PROPFIND responses. For instance, most properties depend on the state
of the collection member, not the state of the collection itself, and
thus the response will change even though the state of the collection
itself did not change.
This is why this extension leaves it to the server whether to return
a GET-Location at all, and if so, whether to return cache validators
along with it.
Here, the client uses the WebDAV PROPFIND method ()
to obtain a custom property:
>>Request
PROPFIND /collection/member HTTP/1.1
Host: example.com
Depth: 0
Content-Type: application/xml
<propfind xmlns=”DAV:”>
<prop>
<title xmlns=”http://ns.example.com/”/>
</prop>
</propfind>
>>Response
HTTP/1.1 207 Multi-Status
Content-Type: application/xml
GET-Location: </collection/member;prop=title>; etag=”1″
<multistatus xmlns=”DAV”:>
<response>
<href>/collection/member</href>
<propstat>
<prop>
<title xmlns=”http://ns.example.com/”
>Document Title</title>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
</multistatus>
>>Request
GET /collection/member;prop=title HTTP/1.1
Host: example.com
If-None-Match: “1”
>>Response
HTTP/1.1 304 Not Modified
Later, the request is repeated after the title property indeed changed…:
>>Request
GET /collection/member;prop=title HTTP/1.1
Host: example.com
If-None-Match: “1”
>>Response
HTTP/1.1 200 OK
Content-Type: application/xml
ETag: “2”
<multistatus xmlns=”DAV”:>
<response>
<href>/collection/member</href>
<propstat>
<prop>
<title xmlns=”http://ns.example.com/”
>New Document Title</title>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
</multistatus>
Although this example may look like every WebDAV property would need a
separate entity tag, this is of course not the case. For instance, a
server that stores all custom properties in a single place (like a properties
file) could use the same computation for the entity tag for all properties.
Also, it could implement resources representing multiple custom property
values the same way.
Here, the client uses the DeltaV DAV:version-tree report (“Versioning Extensions to WebDAV”, )
to obtain the members of the version history of a version-controlled resource.
>>Request
REPORT /collection/member HTTP/1.1
Host: example.com
Depth: 0
Content-Type: application/xml
<version-tree xmlns=”DAV:”>
<prop>
<resourcetype/>
</prop>
</version-tree>
>>Response
HTTP/1.1 207 Multi-Status
Content-Type: application/xml
GET-Location: </version-storage/12345/;justmembers>
<multistatus xmlns=”DAV”:>
<response>
<href>/version-storage/12345/V1</href>
<propstat>
<prop>
<resourcetype><collection/></resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/version-storage/12345/V2</href>
<propstat>
<prop>
<resourcetype><collection/></resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
</multistatus>
Note that in this case, the substitute resource can be almost identical
to the one from the PROPFIND/Depth:1 example: the only difference being
that the report result does not contain a DAV:response element for the
collection itself.
This section discusses some related HTTP features and explains why they
can’t be used for the given use case.
defines the status code 303 (See Other):
The response to the request can be found under a different URI and
&SHOULD; be retrieved using a GET method on that resource. This method exists
primarily to allow the output of a POST-activated script to redirect the
user agent to a selected resource.
The new URI is not a substitute reference for the originally requested resource.
The 303 response &MUST-NOT; be cached, but the response to the second (redirected)
request might be cacheable.
On first glance, it may look as if this addresses exactly the given use
case. However:
It says:
“The new URI is not a substitute reference for the originally requested resource. The 303 response &MUST-NOT; be cached, but the response to the second (redirected) request might be cacheable.”
That is, the information about the alternate resource is not cacheable.
Servers returning a 303 status instead of the one expected by the client,
such as 207 Multistatus, would likely break existing clients.
states:
The Content-Location value is not a replacement for the original requested URI;
it is only a statement of the location of the resource corresponding to this
particular entity at the time of the request. (…)
However, the purpose of “GET-Location” is to enable the server to provide a
permanent replacement URI.
states:
The Location response-header field is used to redirect the recipient to a
location other than the Request-URI for completion of the request or
identification of a new resource. (…)
Neither of these cases (“redirect to a location for completion of the request” and
“identification of a new resource”) matches the use case “GET-Location” covers.
Should it be possible to use Content Negotiation on the resource identified
by GET-Location? A use case could be a metadata provider that would
support different formats, such as WebDAV’s multistatus format (MIME type
missing!), RDF, JSON, whatever.
This could be done using a location-extension specifying the Accept
header for the GET operation.
Should we allow servers to return URI templates (), so that clients can
compute substitute URLs for other requests as well?
For instance, this could be done by allowing a URI template instead of the
Simple-ref, and to return another template specifying how to derive
the template variable from the Request-URI:
>>Request
PROPFIND /documents/a/b HTTP/1.1
Host: example.com
Depth: 0
Content-Type: application/xml
>>Response
HTTP/1.1 207 Multi-Status
Content-Type: application/xml
GET-Location: </metadata/{path};members>; path-template=</a/b/{path}>
…
So in this case, the actual URI to be used would be <http://example.com/metadata/a/b;members>.
Do we need a registry for new location-directive values?