An example of a minimal query response loop for WebDAV?

Is there a minimal (possibly annotated) example of a typical request-response cycle with both headers and body. As far as I understand, this consists of initial OPTIONS and the subsequent exchange of PROPFIND - after that GET and PUT should be simple, so I do not need a general example.

I am considering placing existing RESTful resources (collections and individual elements inside) through WebDAV. I only need the basic functions to work — directory listings, reading and writing files, which AFAICT means that adding PROPFIND support should be sufficient.

+6
source share
1 answer

The specification includes examples:

Minimum

Inquiry:

OPTIONS /somecollection/ HTTP/1.1 Host: example.org 

Answer:

 HTTP/1.1 200 OK Allow: OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, COPY, MOVE Allow: MKCOL, PROPFIND, PROPPATCH, LOCK, UNLOCK, ORDERPATCH DAV: 1, 2, ordered-collections 

Realistic

Inquiry:

  PROPFIND /somecollection HTTP/1.1 Depth: 0 Content-Type: text/xml; charset="utf-8" Content-Length: xxx <?xml version="1.0" encoding="UTF-8" ?> <propfind xmlns="DAV:"> <prop> <supported-live-property-set/> <supported-method-set/> </prop> </propfind> 

Answer:

 HTTP/1.1 207 Multi-Status Content-Type: text/xml; charset="utf-8" Content-Length: xxx <?xml version="1.0" encoding="utf-8" ?> <multistatus xmlns="DAV:"> <response> <href>http://example.org/somecollection</href> <propstat> <prop> <supported-live-property-set> <supported-live-property> <prop><ordering-type/></prop> </supported-live-property> <!-- ... other live properties omitted for brevity ... --> </supported-live-property-set> <supported-method-set> <supported-method name="COPY" /> <supported-method name="DELETE" /> <supported-method name="GET" /> <supported-method name="HEAD" /> <supported-method name="LOCK" /> <supported-method name="MKCOL" /> <supported-method name="MOVE" /> <supported-method name="OPTIONS" /> <supported-method name="ORDERPATCH" /> <supported-method name="POST" /> <supported-method name="PROPFIND" /> <supported-method name="PROPPATCH" /> <supported-method name="PUT" /> <supported-method name="TRACE" /> <supported-method name="UNLOCK" /> </supported-method-set> </prop> <status>HTTP/1.1 200 OK</status> </propstat> </response> </multistatus> 
+11
source

Source: https://habr.com/ru/post/913142/


All Articles