Module Webdavz.Request

WebDAV request body parsing.

Parses PROPFIND and PROPPATCH XML request bodies as defined in RFC 4918.

PROPFIND Request Bodies

A PROPFIND body specifies which properties to retrieve (Section 9.1):

PROPPATCH Request Bodies

A PROPPATCH body contains <set> and <remove> instructions (Section 9.2).

PROPFIND

type propfind =
  1. | Allprop of (string * string) list
    (*

    Retrieve all properties. The name list contains additional properties requested via <include> (Section 14.2).

    *)
  2. | Propname
    (*

    Retrieve property names only (no values).

    *)
  3. | Props of (string * string) list
    (*

    Retrieve the listed properties. Properties not found on a resource appear in a 404 propstat.

    *)

PROPFIND request variants.

val parse_propfind : string -> propfind option

parse_propfind xml parses a PROPFIND request body. Returns None on malformed XML.

val propfind_of_body : string option -> propfind

propfind_of_body body_opt parses a PROPFIND body, defaulting to Allprop [] for None or empty string per Section 9.1: "A client may choose not to submit a request body. An empty PROPFIND request body MUST be treated as if it were an 'allprop' request."

PROPPATCH

type propupdate =
  1. | Set of string * string * Webdavz__.Webdavz_xml.tree list
    (*

    Set a property to the given value.

    *)
  2. | Remove of string * string
    (*

    Remove a property.

    *)

A single property update instruction.

val parse_proppatch : string -> propupdate list option

parse_proppatch xml parses a PROPPATCH <propertyupdate> body. Returns a list of update instructions in document order, or None on malformed XML.

Depth Header

The Depth header controls recursion for collection operations.

type depth =
  1. | Zero
    (*

    Apply to the resource only.

    *)
  2. | One
    (*

    Apply to the resource and its immediate children.

    *)
  3. | Infinity
    (*

    Apply to the resource and all descendants.

    *)

PROPFIND/COPY/MOVE depth.

val parse_depth : string option -> (depth, [> `Bad_request ]) result

parse_depth header_value parses a Depth header value.