Skip to content

Commit

Permalink
Update WebDavService.md
Browse files Browse the repository at this point in the history
  • Loading branch information
luc-github committed Oct 25, 2023
1 parent b54dffb commit 33ec01e
Showing 1 changed file with 100 additions and 44 deletions.
144 changes: 100 additions & 44 deletions docs/WebDavService.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
## Introduction
The protocol is based on HTTP and is designed to allow clients to perform remote Web content authoring operations. The protocol provides facilities to copy, move, delete resources, to query and set properties on resources. The protocol has several features but many are useless for the purpose of this project. The protocol will be followed but using only the features that are needed.
The authentication is not implemented yet.
No namespace is used for xml tags because there is no possible conflict in webdav requests/responses.
If no namespace is supposed ok for xml tags because there is no possible conflict in webdav requests/responses, windows seems request them so they have been added.
As it is embedded system on local network, the header `Date` is not supported because it make no sense to give 1970 based year date if system date is not initialized.
Date format for last modified and creation date is the GMT time with name of day and month in english, even if the rfc says if can be in this format `1997-12-01T17:42:21-08:00`.

## WebDav version
The version of WebDav that will be used is 1 because we do not need PROPATCH, LOCK and UNLOCK methods.
Expand Down Expand Up @@ -121,53 +122,57 @@ The necessary headers in response are:
- DAV
- Allow
- Content-Type is text/xml
- Connection: close
- Content-Length is the size of the response body but because it is not possible to know the size of the response body before generating it because we do not know the number of resources in the directory, we will use chunked transfer encoding. so this header will not be present in the response.
- depth=1 will only be added in case of a request of depth=infinity

The response body is an xml document containing the properties of the resource.
```xml
<? xml version = "1.0" encoding = "utf-8" ?>
<multistatus xmlns = "DAV:" depth="1">
<response>
<href>/sd/monrep/</href>
<propstat>
<prop>
<getlastmodified>2023-10-23T00:00:00Z</getlastmodified>
<resourcetype>
<collection />
</resourcetype>]
<quota-available-bytes>3221225472</quota-available-bytes>
<quota-used-bytes>100000000</quota-used-bytes>
<fs-total-space>4 GB</fs-total-space>
<fs-free-space>3 GB</fs-free-space>
</prop>
<status>HTTP/1.1 200 OK</ status>
</propstat>
</response>

<response>
<href>/sd/monrep/monsubrep/</ href>
<propstat>
<prop>
<getlastmodified>2023-10-23T00:00:00Z</getlastmodified>
<resourcetype>
<collection />
</resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/sd/monrep/monfichier.txt</href>
<propstat>
<prop>
<getlastmodified>2023-10-23T00:00:00+08:00</getlastmodified>
<getcontentlength>3000000</getcontentlength>
<resourcetype />
</prop>
<status> HTTP / 1.1 200 OK</status>
</propstat>
</response>
</multistatus>
<?xml version="1.0" encoding="utf-8"?>
<D:multistatus xmlns:D="DAV:">
<D:response xmlns:esp3d="DAV:">
<D:href>/webdav</D:href>
<D:propstat>
<D:status>HTTP/1.1 200 OK</D:status>
<D:prop>
<esp3d:getlastmodified>Wed, 25 Oct 2023 04:44:55 GMT</esp3d:getlastmodified>
<esp3d:creationdate>Wed, 25 Oct 2023 04:44:55 GMT</esp3d:creationdate>
<D:resourcetype>
<D:collection/>
</D:resourcetype>
<esp3d:displayname>/</esp3d:displayname>
</D:prop>
</D:propstat>
</D:response>
<D:response xmlns:esp3d="DAV:">
<D:href>/webdav/fs</D:href>
<D:propstat>
<D:status>HTTP/1.1 200 OK</D:status>
<D:prop>
<esp3d:getlastmodified>Wed, 31 Dec 1969 23:59:59 GMT</esp3d:getlastmodified>
<esp3d:creationdate>Thu, 01 Jan 1970 00:00:00 GMT</esp3d:creationdate>
<D:resourcetype>
<D:collection/>
</D:resourcetype>
<esp3d:displayname>fs</esp3d:displayname>
</D:prop>
</D:propstat>
</D:response>
<D:response xmlns:esp3d="DAV:">
<D:href>/webdav/sd</D:href>
<D:propstat>
<D:status>HTTP/1.1 200 OK</D:status>
<D:prop>
<esp3d:getlastmodified>Thu, 01 Jan 1970 00:00:00 GMT</esp3d:getlastmodified>
<esp3d:creationdate>Thu, 01 Jan 1970 00:00:00 GMT</esp3d:creationdate>
<D:resourcetype>
<D:collection/>
</D:resourcetype>
<esp3d:displayname>sd</esp3d:displayname>
</D:prop>
</D:propstat>
</D:response>
</D:multistatus>

```

Expand All @@ -176,6 +181,57 @@ The response code is:
- 404 if the resource does not exist
- 503 if any error accessing the local file system (e.g. access denied)

## COPY method
The COPY method is used to copy the resource identified by the Request-URI to the destination URI.
The copy is allowed only for a file and not for a directory.

The request has the following headers:
- Destination is the path of the resource to create. to be used instead of the Request-URI if present.
- Overwrite is a boolean that indicates if the destination resource should be overwritten if it already exists. If the header is not present, the default value is false.

The necessary headers in response are:
- DAV
- Allow
- Last-Modified

No content

The response code is:
- 201 if success and file is created
- 204 if success and file is overwritten
- 404 if the resource does not exist
- 413 if the resource is a directory
- 412 if the destination resource already exists and overwrite is false
- 503 if any error accessing the local file system (e.g. access denied)
- 500 if any error during the file creation
- 507 if the file is too big for the targeted file system

## MOVE method
The MOVE method is used to move the resource identified by the Request-URI to the destination URI.
There is no merge of the destination resource and the source resource but the destination resource is overwritten/replaced if it already exists.

The request has the following headers:
- Destination is the path of the resource to create. to be used instead of the Request-URI if present.
- Overwrite is a boolean that indicates if the destination resource should be overwritten if it already exists. If the header is not present, the default value is false.

The necessary headers in response are:
- DAV
- Allow
- Last-Modified

No content

The response code is:
- 201 if success and file is created
- 204 if success and file is overwritten
- 404 if the resource does not exist
- 412 if the destination resource already exists and overwrite is false
- 503 if any error accessing the local file system (e.g. access denied)
- 500 if any error during the file creation







Expand Down

0 comments on commit 33ec01e

Please sign in to comment.