module Webdav_client_methods:Extension of the Http_client module for submitting WebDAV requests. See RFC 4918 (http://www.ietf.org/rfc/rfc4918.txt)sig
..end
This definition is incomplete.
Strings are encoded in UTF-8, except where something else is specified. URLs are ASCII.
This module allows it to create method objects that can be passed to HTTP pipelines, e.g.
let http = new Http_client.pipeline
let propfind_cl = new propfind "http://server/"
http # add (propfind_cl :> Http_client.http_call);
http # run();
(* now look at propfind_cl for response *)
Note that the method objects need to be coerced to http_call
before
being passed to the pipeline. There is no way of coercing them back,
so users should keep the object propfind
with the original type.
typecall_status =
[ `Client_error
| `Http_protocol_error of exn
| `Multi_status
| `Redirection
| `Server_error
| `Successful
| `Unserved ]
`Unserved
: The call has not yet been finished`HTTP_protocol_error e
: An error on HTTP level occurred. Corresponds
to the exception Http_client.Http_protocol
.`Successful
: The call is successful, and the response code is between
200 and 299 (except 207 which is special, see below).`Redirection
: The call is successful, and the response code is
between 300 and 399.`Client_error
: The call failed with a response code between 400 and
499.`Server_error
: The call failed for any other reason.`Multi_status
: The server responded with a 207 code. For
PROPFIND
and PROPPATCH
the multistatus response includes
detailed data about properties. For other methods the multistatus
response means that for some URL the operation ran into an error
but for other URLs it was successful. The classes defined below
have methods to further analyze the situation (especially good_urls
and bad_urls
).val string_of_call_status : call_status -> string
typeproperty =
Webdav_xml.property
Webdav_xml.property
for more
informationtypeprepost_code =
Webdav_xml.prepost_code
property
.class type propstat_t =object
..end
class type response_t =object
..end
class type webdav_call_t =object
..end
val url_append : string -> string -> string
url_append base path
: Appends the path
to the URL base
, and
returns the new URL. Here, base
must be a properly encoded URL,
with http://server
prefix. path
is a normal slash-separated
path without special escaping. The return value is again an
absolute URL.
The path
must be absolute (begins with "/").
Examples:
url_append "http://server" "/dir/file" = "http://server/dir/file"
url_append "http://server/dir" "/file" = "http://server/dir/file"
url_append "http://server" "/a file" = "http://server/a%20file"
typepropfind_request =
[ `Allprop of property list
| `Prop of property list
| `Propname ]
`Prop l
: Request the properties listed in l
(which must
be non-empty). The nodes in l
are XML elements without children.`Propname
: Request a list of property names`Allprop l
: Request all properties, and include especially
the extension properties l
(which may be empty). In l
one
can request additional properties of the WebDAV namespace that
are not defined in RFC 4918.val propname_creationdate : property
val propname_displayname : property
val propname_getcontentlanguage : property
val propname_getcontentlength : property
val propname_getcontenttype : property
val propname_getetag : property
val propname_getlastmodified : property
val propname_resourcetype : property
`Prop
requests. These properties should be returned anyway
for `Allprop []
.class type propfind_call_t = webdav_call_t
class propfind_call :propfind_call_t
class propfind :?depth:Webdav_http.depth -> ?propfind_request:propfind_request -> ?strip_prefix:string -> string ->
propfind_call_t
new propfind url
: Creates a PROPFIND request.
typelist_request =
[ `Existence | `Standard ]
`Existence
means a list request where only the resourcetype
property is queried - useful for finding out which files exist.
`Standard
includes all standard properties.class type filelist_t = propfind_call_t
response_of_url
, and then call one of the prop_*
methods, e.g.
class filelist :?depth:Webdav_http.depth -> ?strip_prefix:string -> list_request -> string ->
filelist_t
let l = new filelist req url
: Creates a new request object for
retrieving file listings.
typeproppatch_instruction =
[ `Remove of property list
| `Set of property list ]
`Remove props
: Removes the properties props
. The list props
should only contain the property names with empty contents`Set props
: Sets the properties props
. The list props
must include properties that include contents. One can create
such properties with the encode_*
functions in Webdav_xml
.typeproppatch_request =
proppatch_instruction list
class type proppatch_call_t = webdav_call_t
class proppatch_call :propfind_call_t
class proppatch :?strip_prefix:string -> proppatch_request:proppatch_request -> string ->
propfind_call_t
new proppatch ~proppatch_request url
: Creates a PROPPATCH request.
class type mkcol_call_t = webdav_call_t
class mkcol_call :mkcol_call_t
class mkcol :?strip_prefix:string -> string ->
mkcol_call_t
new mkcol uri
: Creates a new collection at uri
.
class type get_call_t = webdav_call_t
class get_call :get_call_t
class get :?strip_prefix:string -> string ->
get_call_t
new get uri
: Gets the document at uri
.
class type delete_call_t = webdav_call_t
class delete_call :delete_call_t
class delete :?strip_prefix:string -> string ->
delete_call_t
new delete uri
: Deletes the document or collection at uri
.
class type put_call_t = webdav_call_t
class put_call :put_call_t
class put :?content_type:string -> ?content_length:int64 -> ?expect_handshake:bool -> ?strip_prefix:string -> string -> Netmime.mime_body ->
put_call_t
new put url body
: Uploads the contents of body
to the server so
it will be visible at url
.
class type copy_call_t = webdav_call_t
class copy_call :copy_call_t
class copy :?depth:Webdav_http.depth -> ?overwrite:bool -> ?strip_prefix:string -> string -> string ->
copy_call_t
new copy src_url dest_url
: Copies the object(s) at src_url
so that they become visible at dest_url
.
class type move_call_t = webdav_call_t
class move_call :copy_call_t
class move :?overwrite:bool -> ?strip_prefix:string -> string -> string ->
move_call_t
new move src_url dest_url
: Moves the object(s) at src_url
so that they become visible at dest_url
.