10. HTTP Headers for Distributed Authoring
WebDAV defines several new HTTP headers and extends existing ones to support distributed authoring functionality.
10.1 DAV Header
Purpose: Indicates WebDAV compliance classes and supported features.
Syntax:
DAV = "DAV" ":" #(compliance-class)
compliance-class = ("1" | "2" | "3" | extend)
Example:
DAV: 1, 2, 3, \`http://example.com/my-features\`
Compliance Classes:
- Class 1: Basic WebDAV support (PROPFIND, PROPPATCH, COPY, MOVE, MKCOL, etc.)
- Class 2: Class 1 + Locking support (LOCK, UNLOCK)
- Class 3: Class 1 + ordered collections
Usage: MUST be returned in OPTIONS response. MAY be returned in other responses.
10.2 Depth Header
Purpose: Specifies the depth of operation for methods applied to collections.
Syntax:
Depth = "Depth" ":" ("0" | "1" | "infinity")
Values:
- 0: Apply to target resource only
- 1: Apply to target and direct children
- infinity: Apply to target and all descendants recursively
Example:
PROPFIND /collection/ HTTP/1.1
Depth: 1
Default Behavior:
- PROPFIND: If omitted, treated as
infinity - LOCK: If omitted, treated as
infinity - COPY/MOVE: If omitted, treated as
infinity
Constraints: Some servers MAY reject Depth: infinity due to resource constraints.
10.3 Destination Header
Purpose: Specifies the destination URI for COPY and MOVE operations.
Syntax:
Destination = "Destination" ":" Simple-ref
Example:
COPY /source HTTP/1.1
Host: example.com
Destination: http://example.com/dest
Requirements:
- MUST be an absolute URI
- MUST be on the same host as the Request-URI (for most implementations)
- URI encoding rules apply
10.4 If Header
Purpose: Provides conditional execution based on state tokens (ETags or lock tokens).
Syntax:
If = "If" ":" ( 1*No-tag-list | 1*Tagged-list )
No-tag-list = List
Tagged-list = Resource-Tag 1*List
List = "(" 1*Condition ")"
Condition = ["Not"] (State-token | "[" entity-tag "]")
State-token = Coded-URL
Examples:
1. Simple Lock Token Submission:
PUT /resource HTTP/1.1
If: (<opaquelocktoken:a515cfa4-5da4-22e1-f5b5-00a0451e6bf7>)
2. Multiple Conditions (OR):
DELETE /resource HTTP/1.1
If: (<locktoken1>) (<locktoken2>)
3. Multiple Conditions (AND):
MOVE /resource HTTP/1.1
If: (<locktoken>) (["etag123"])
4. Tagged List (Multiple Resources):
COPY /a HTTP/1.1
Destination: /b
If: </a> (<locktoken-a>) </b> (Not <locktoken-b>)
5. NOT Condition:
PUT /resource HTTP/1.1
If: (Not <DAV:no-lock>)
Evaluation:
- Lists within
()are AND-ed - Multiple lists are OR-ed
Notnegates the condition- If header evaluation failure returns
412 Precondition Failed
10.5 Lock-Token Header
Purpose: Provides the lock token for UNLOCK operations.
Syntax:
Lock-Token = "Lock-Token" ":" Coded-URL
Example:
UNLOCK /resource HTTP/1.1
Lock-Token: <opaquelocktoken:a515cfa4-5da4-22e1-f5b5-00a0451e6bf7>
Requirements:
- MUST be used with UNLOCK method
- Contains exactly one lock token
- Lock token MUST be in angle brackets
< >
10.6 Overwrite Header
Purpose: Specifies whether to overwrite the destination resource in COPY/MOVE.
Syntax:
Overwrite = "Overwrite" ":" ("T" | "F")
Values:
- T (True): Overwrite destination if it exists (default)
- F (False): Fail if destination exists (return 412)
Example:
COPY /source HTTP/1.1
Destination: http://example.com/dest
Overwrite: F
Default: If omitted, treated as T.
Behavior:
- With
Overwrite: F, returns412 Precondition Failedif destination exists - With
Overwrite: T, destination is silently replaced
10.7 Timeout Header
Purpose: Specifies the requested lock timeout duration.
Syntax:
Timeout = "Timeout" ":" 1#TimeType
TimeType = ("Second-" DAVTimeOutVal | "Infinite")
DAVTimeOutVal = 1*DIGIT
Examples:
LOCK /resource HTTP/1.1
Timeout: Second-3600
LOCK /resource HTTP/1.1
Timeout: Infinite, Second-3600
Semantics:
- Second-n: Request lock for n seconds
- Infinite: Request lock with no timeout
- Multiple values indicate preference order
- Server chooses from client's list or uses its own value
- Actual granted timeout returned in response
Response Example:
<D:timeout>Second-3600</D:timeout>
Header Summary Table
| Header | Methods | Required | Default | Values |
|---|---|---|---|---|
| DAV | OPTIONS | MUST | - | 1, 2, 3, extend |
| Depth | PROPFIND, LOCK, COPY, MOVE | MAY | infinity | 0, 1, infinity |
| Destination | COPY, MOVE | MUST | - | Absolute URI |
| If | All | MAY | - | State-tokens, ETags |
| Lock-Token | UNLOCK | MUST | - | Lock token URI |
| Overwrite | COPY, MOVE | MAY | T | T, F |
| Timeout | LOCK | MAY | Server-decided | Second-n, Infinite |
Usage Patterns
Pattern 1: Conditional Update with Lock
PUT /file.txt HTTP/1.1
If: (<opaquelocktoken:...>)
Content-Type: text/plain
New content
Pattern 2: Safe COPY (Don't Overwrite)
COPY /source HTTP/1.1
Destination: /dest
Overwrite: F
Depth: infinity
Pattern 3: Lock with Timeout Preference
LOCK /resource HTTP/1.1
Timeout: Infinite, Second-7200, Second-3600
Depth: 0
Pattern 4: Complex If Conditions
DELETE /locked-resource HTTP/1.1
If: (<locktoken>) (["current-etag"])
Note: For complete header specifications including ABNF syntax, see RFC 4918 Section 10.