Back to Home

Fantasy on WebDAV. Regular Client

webdav

Fantasy on WebDAV. Regular Client

    And who is easy?
    The previous post outlined the idea of ​​an interface based on the WebDAV protocol . A natural requirement in its implementation is the provision of work with regular WebDAV clients of various operating systems. Since the RFC is not a dogma, you should start by figuring out the details of their “behavior." Those. the set and sequence of methods initiated by clients when connecting, performing exchange operations (send, receive) and remote operations (create, copy, move / rename, delete) over objects: file, folder, branch. It is useful to clarify customer support for cookies ; http authentication ; proxy settings for local addresses; interaction with a server port other than 80.

    The review does not claim to be complete, since it is limited by the scope of the task and the available software.

    At your fingertips were:
    - openSUSE 13.2 KDE ( wdfs, cadaver, Konqueror, Dolphin );
    - ubuntu 14.04 LTS Gnome ( davfs, Nautilus );
    - MS Windows 7 SP1 Starter , Windows 10 Home, Windows XP SP3 Professional (net use, Explorer).

    Basic information was obtained using a Class 1 server WebDAV emulator (Server: noname / 0.0.7; DAV: 1; Allow: OPTIONS, GET, HEAD, PUT, DELETE, PROPFIND, PROPPATCH, MKCOL, COPY, MOVE). Server root: / test / dav /. The answers used only the namespace properties D = "DAV:", and in the tags- absolute addressing. Note that according to RFCs, the emulator is "MUST", but not the fact that it matches. Questions arising during testing may be a consequence of this.
    On the client side, operations were initiated by the context menu (copy | cut - paste), and for file systems, by console commands.

    The generalized result:
    - some clients transfer the file in two steps: first, zero length, then the file itself;
    - when copying a file remotely, most clients simulate the COPY method with a GET / PUT pair (for folders: MKCOL, GET / PUT file);
    - not everyone uses the MOVE method to move objects (simulate a set of MKCOL, GET / PUT, DELETE);
    - everyone uses MOVE to rename;
    - none of the clients apply the PROPFIND method (Depth: infinity);
    - not everyone uses DELETE (Depth: infinity);
    - not all conductors check the contents of a folder (PROPFIND Depth: 1) after operations on nested objects; on the contrary, data / actions are cached;
    - No problems with the Cyrillic alphabet in localized OSs.

    MS Windows 7 SP1 Starter (Explorer, net use)
    User-Agent: Microsoft-WebDAV-MiniRedir / 6.1.7601
    Supports cookie; negotiate and digest (by default), basic (after shamanism with the registry ) authentication; proxy IE settings; non-standard http ports. Exchange Features:

    1. Connection: \\ host: port \ path or \\ host @ port \ path. The first time the server is called, the client polls OPTIONS from the root "/" to the first segment of the path. Having not received a positive response, it requests PROPFIND to the first segment. I resolved the misunderstanding by sending the client (301-Moved Permanently) to the server root address for OPTIONS, PROPFIND requests for intermediate segments.
    Client requests contain the translate header : f

    2. PROPFIND client requests do not contain a body.
    Windows Explorer publishes a PROPFIND series on every click. Periodically requests file properties: desktop.ini, folder.gif, folder.jpg, Thumbs.db. The answer of 404 clients is quite satisfied. Because of its verbosity, he switched to the console: COPY, XCOPY, MOVE, DEL, RMDIR, REN ...

    3. File transfer is performed by a sequence of methods:
    - PROPFIND (Depth: 0) of the destination folder;
    - PROPFIND file (check for availability);
    - PUT file of zero length in the absence;
    - LOCK (Timeout: Second-3600) file:
    HOST_NAME\USER_NAME
    The server response is in accordance with the RFC, but the client also accepts 501-Not Implemented.
    - PROPPATCH file properties:
    Mon, 24 Jun 2013 11:16:17 GMTTue, 23 Jun 2015 11:16:23 GMTMon, 24 Jun 2013 11:16:17 GMT00000000
    The PROPPATCH method a class 1 server must support. The RFC allows a 403-Forbidden (cannot-modify-protected-property) response in the multi-status. The client ignores the denial and continues to bend his own.
    - HEAD file;
    - PUT file contents;
    - PROPPATCH file properties:
    Mon, 24 Jun 2013 11:16:17 GMT00000020
    - UNLOCK;
    - PROPFIND file;
    - PROPPATCH file attribute Win32FileAttributes = 00000020.

    4. Get the file:
    - PROPFIND (Depth: 0) of the container folder;
    - PROPFIND file;
    - GET file.

    5. Create a folder:
    - PROPFIND (Depth: 0) of the destination folder;
    - PROPFIND of the created folder;
    - MKCOL;
    - PROPPATCH of the folder properties is similar to file transfer (value Win32FileAttributes = 00000010).

    6. Copying a file is performed in two steps:
    - get the file (p.4);
    - transfer the file (clause 3).

    7. Moving / renaming objects (including branches) is performed using the MOVE method (Overwrite: F; Destination: ....; Depth is absent, which implies Infinity).

    8. Branch copying is performed by sequential creation of folders and copying (item 6) of files. Deleting a branch is done by sequentially deleting attached files and folders.

    Dialogs in Windows 10 (User-Agent: Microsoft-WebDAV-MiniRedir / 10.0.10240) without a hitch do not differ from the above. Windows XP Redirector ( User-Agent: Microsoft-WebDAV-MiniRedir / 5.1.2600 ) DOES NOT SUPPORT cookies; ports other than 80; does not use LOCK / UNLOCK. Windows XP Explorer inserts an extra slash after the first segment of the server root in the PROPFIND requests of the file transfer / move dialog (PROPFIND /test//dav/file.txt HTTP / 1.1).

    ubuntu 14.04 LTS Gnome (Nautilus 3.10.1)
    User-Agent: gvfs / 1.20.3
    Supports cookie, authentication, proxy settings, non-standard ports. Exchange details:

    1. Connection (dav: // host: port / path):
    - OPTIONS to the server root;
    - PROPFIND (Depth: 0) of the server root (a set of properties is used to check for the presence of an object):
    - OPTIONS to the previous root segment, from where it was sent (301) to the destination;
    - PROPFIND ( Apply-To-Redirect-Ref : T) of the server root with the Depth: 0/1 headers and request for properties (basically it uses them):

    2. Transfer the file:
    - PROPFIND (Depth: 0) to the destination folder;
    - PROPFIND of the disk quota of the destination folder according to rfc4331 :
    - HEAD file for availability;
    - PUT file;
    - PROPFIND (Depth: 0) file 5 times (?) ;

    3. Accept the file:
    - PROPFIND (Depth: 0) of the file x5 times (?);
    - GET file.

    4. Create a folder:
    - PROPFIND (Depth: 0) of the destination folder;
    - PROPFIND disk quota destination folders;
    - PROPFIND of the created folder;
    - MKCOL of the created folder;
    - PROPFIND of the created folder x5 times (?);

    5. Copy file:
    - PROPFIND disk quota in the destination folder;
    - PROPFIND source file x5 times;
    - GET file;
    - HEAD file for presence in the destination folder;
    - PUT file to destination folder;
    - PROPFIND of the copied file x5 times.

    6. Rename the file / folder / branch:
    - MOVE (Overwrite: F; Destination: ...; Depth is missing) of the file / folder.
    - PROPFIND (depth: 0) of the object

    7. Delete the file:
    - PROPFIND (Depth: 0) of the file;
    - PROPFIND (Depth: 1) file;
    - DELETE file.

    8. Copying a branch is done by creating a branch structure in the destination folder, followed by copying (p. 5) of the files. Deleting a branch is done by sequentially deleting attached files and folders. Moving a file / folder / branch is done by copying (p.5 / p.8), followed by deleting the source.

    openSUSE 13.2 (wdfs, cadaver ), ubuntu 14.04 LTS ( davfs )
    Customers use the neon /0.30.0 library , compatible with WebDAV RFC2518, from which cookies support was cut in 0.25.0. A quote from the Feature list on the questions posed: 'Modern HTTP authentication support: a complete implementation of the new authentication standard, RFC2617, supporting the Digest, Basic, and Negotiate protocols. ... The system's proxy configuration can be optionally used, on some platforms. '

    wdfs
    User-Agent: wdfs / 1.4.2 neon / 0.30.0
    Testing was carried out by console commands. Current folder: ~ /

    1. Mount fs (http: // host: port / path):
    - OPTIONS on the server root.

    2. ls per mount point:
    - PROPFIND (Depth: 0/1):

    3. Transfer the file:
    - PROPFIND (Depth: 0) to each folder in the destination path;
    - PROPFIND file in destination folder;
    - PUT file of zero length;
    - PROPFIND file;
    - GET file of zero length;
    - PUT file.

    4. Accept the file:
    - PROPFIND (Depth: 0) of each folder of the file path;
    - PROPFIND file;
    - GET file.

    5. Create a folder:
    - PROPFIND (Depth: 0) of each folder in the destination path;
    - PROPFIND of the created folder;
    - MKCOL folders;
    - PROPFIND created folder;

    6. Copy the file:
    - PROPFIND (Depth: 0) of each folder in the destination path and destination file for availability;
    - PROPFIND (Depth: 0) of each folder in the source path and source file;
    - GET source file;
    - PUT file of zero length;
    - PROPFIND file of zero length;
    - GET file of zero length;
    - PUT file.

    7. Move / rename file / folder / branch:
    - PROPFIND destination folders;
    - PROPFIND of the source object;
    - PROPFIND of the source object in destination folder x2? ;
    - MOVE (Overwrite: T; Destination: ...; Depth absent) of the source object to the destination folder.

    8. Deleting a folder / branch is done by one DELETE method (Depth is absent). Branch copying is done by sequentially creating folders and copying files (GET / PUT).

    davfs
    User-Agent: davfs2 / 1.4.7 neon / 0.30.0
    Testing was carried out by console commands. Current folder: ~ /

    1. Mounting fs (http: // host: port / path):
    - OPTIONS on the server root;
    - PROPFIND (Depth: 1; Connection: TE; TE: trailers) root:
    - PROPFIND (Depth: 0) root:

    2. Transfer the file:
    - PROPFIND (Depth: 1) to each folder in the destination path;
    - PUT (If-None-Match: *) file;
    - HEAD file.

    3. Accept the file:
    - PROPFIND (Depth: 1) of each folder in the source path;
    - GET (If-Modified-Since: ...) file.

    4. Create a folder:
    - PROPFIND (Depth: 1) of each folder in the destination path;
    - MKDIR.

    5. Copy the file:
    - PROPFIND (Depth: 1) to the destination folder;
    - GET (If-Modified-Since: ...) of the source file;
    - PUT (If-None-Match: *) file;
    - HEAD file.

    6. Renaming / moving objects is done by one MOVE method.

    7. Copying a folder / branch is done by sequentially creating folders and copying (receiving / transferring) files in the general case.

    8. Deleting a folder / branch is done by sequentially deleting files and folders.

    cadaver
    User-Agent: cadaver / 0.23.3 neon / 0.30.0
    Connection: http: // host: port / path
    The request body PROPFIND cadaver contains:

    WebDAV methods are represented by the corresponding commands. The fundamental feature of cadaver is the ability to manage user properties of objects.

    openSUSE 13.2 KDE (Konqueror 4.14.8, Dolphin 15.04.0)
    User-Agent: Mozilla / 5.0 (X11; Linux x86_64) KHTML / 4.14.9 (like Gecko) Konqueror / 4.14 SUSE
    Like any browser, Konqueror supports cookies; Authentication proxy settings for local addresses; non-standard http ports. Like not everyone - WebDAV.

    1. Connection: webdav: // host: port / path (localhost is accessible via ip). The client does not bother with OPTIONS, immediately requests PROPFIND to the server root:
    However, he is content with what the server will return. And the server from the principle did not return the supportedlock and lockdiscovery properties.

    2. Transfer the file:
    - PROPFIND (Depth: 0) to the destination folder;
    - PROPFIND file properties in the destination folder:
    - PROPFIND properties (item 1) of the file in the destination folder, if one exists;
    - PUT file;
    - PROPFIND (Depth: 1) properties of the destination folder from p1.

    3. Get the file:
    - PROPFIND file in the source folder;
    - GET file.

    4. Create a folder:
    - MKCOL;
    - PROPFIND (Depth: 1) of the parent folder;
    - PROPFIND (Depth: 0) of the created folder.

    5. Copy file:
    - PROPFIND file in the destination folder;
    - COPY file to destination folder;
    - PROPFIND (Depth: 1) destination folders.

    6. Move / rename the file / folder / branch:
    - PROPFIND (Depth: 0) of the destination folder;
    - MOVE (Overwrite: F; Depth: infinity) file;
    - PROPFIND (Depth: 1) destination folders.

    7. When copying a branch / folder, a folder / branch in the destination folder is created first, then the files are copied using the COPY method.

    8. Delete file / folder / branch:
    - DELETE (Depth is absent, which implies Infinity).

    Behind the scenes were Apple clients and Android file managers, I will try to fill this gap later.

    December 11, 2015

    Read Next