Commit Graph

20 Commits

Author SHA1 Message Date
Conrad Hoffmann
85d2b222bb Add error type representing DAV/XML errors
Backends will need some way to signal that a precondition error occurred
(and specifying which one) without causing the server to return a 500.
This commit adds an exported function to create a specific error for
this. The existing error handling routine is slightly adapted to handle
this error in such a way that it returns the desired result.

Usage would be something like:

```
return "", carddav.NewPreconditionError(carddav.PreconditionNoUIDConflict)
```

which triggers the following HTTP response:

```
HTTP/1.1 409 Conflict.
Content-Type: text/xml; charset=utf-8.
Date: Thu, 10 Mar 2022 10:28:56 GMT.
Content-Length: 141.
Connection: close.

<?xml version="1.0" encoding="UTF-8"?>
<error xmlns="DAV:"><no-uid-conflict
xmlns="urn:ietf:params:xml:ns:carddav"></no-uid-conflict></error>
```

This response gets correctly recognized by e.g. Evolution (though it's
handling is not great).

The added error type is generic enough to be used for other stuff also.
As it is not exported (internal package), new functions for creating
such errors would have to be added.
2022-03-10 16:48:11 +01:00
Simon Ser
25df841e2b
internal: move HTTPError to common file
This is used by both clients and servers now.
2020-05-13 18:24:29 +02:00
Simon Ser
ca51e9427a
caldav: add Client.QueryCalendar 2020-02-03 17:26:55 +01:00
Simon Ser
dd1527b97e
carddav: allow created address book objects to have a different path
Closes: https://github.com/emersion/go-webdav/issues/32
2020-01-30 15:20:10 +01:00
Simon Ser
8937358ac1
Allow servers to return DAV capabilities in OPTIONS 2020-01-29 18:03:47 +01:00
Simon Ser
6d229f4e8a
webdav: add COPY support to server 2020-01-22 13:00:42 +01:00
Simon Ser
3268102d5a
webdav: add MOVE support to server 2020-01-22 11:43:36 +01:00
Simon Ser
6eeeccb96e
all: encode hrefs, replace hrefs with path in public API
Closes: https://github.com/emersion/go-webdav/issues/14
Closes: https://github.com/emersion/go-webdav/issues/16
2020-01-22 11:07:30 +01:00
Simon Ser
90fe8dedf7
internal: add PROPPATCH support to server 2020-01-21 23:18:27 +01:00
Simon Ser
e9e1f102de
webdav: add MKCOL support to server 2020-01-21 22:05:59 +01:00
Simon Ser
41b68829e8
webdav: add DELETE support to server 2020-01-21 21:46:01 +01:00
Simon Ser
7d6de88179
webdav: add support for PUT to server 2020-01-21 21:19:44 +01:00
Simon Ser
6e0ea58de1
carddav: populate AddressBook.{Name,MaxResourceSize} in client 2020-01-19 15:29:51 +01:00
Simon Ser
f3f1c8b58a
internal: introduce DecodeXMLRequest, ServeXML and ServeMultistatus 2020-01-19 11:12:45 +01:00
Simon Ser
60e5d57cda
carddav: implement REPORT addressbook-multiget 2020-01-19 11:05:56 +01:00
Simon Ser
bf666bb2fb
Ensure resourcetype is always defined 2020-01-17 17:09:44 +01:00
Simon Ser
883dafaf41
internal: fix Error element definition 2020-01-17 14:47:10 +01:00
Simon Ser
7cb302246b
internal: add NewPropfindResponse helper 2020-01-17 14:40:29 +01:00
Simon Ser
e2da5769f5
Improve OPTIONS handling 2020-01-17 11:41:44 +01:00
Simon Ser
326c4b9b6f
internal: add Handler 2020-01-17 11:30:42 +01:00