Commit Graph

86 Commits

Author SHA1 Message Date
Conrad Hoffmann
c4206ba616 carddav: pass If-(None-)Match to backend
This simply extends the interfaces to pass on the values if they were
used, relying on the backend to handle things accordingly.
2022-03-22 09:28:24 +01:00
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
Sebastien Binet
6d59672ed4 carddav: add filtering and matching helper functions
Updates emersion/hydroxide#159.

Signed-off-by: Sebastien Binet <binet@cern.ch>
Co-authored-by: Conrad Hoffmann <ch@bitfehler.net>
2022-03-01 10:06:11 +01:00
Conrad Hoffmann
dc57b81662
carddav/server: set ETag and Last-Modified if available
Some clients (e.g. Evolution) will not work properly without this. It is
up to the underlying backend to actually provide this data, the headers
will only be set if it is available.
2022-02-24 12:41:56 +01:00
Conrad Hoffmann
0f6744ede8 Pass request context to storage interface
This way the storage implementation can communicate with any potentially
used middleware (e.g. authentication) or for example abort requests.
2022-02-23 12:01:13 +01:00
Heiko Carrasco
4316bbcd93
caldav: add server handling for well-known URLs 2020-10-09 15:10:33 +02:00
AlmogBaku
9e23289610 sync-collection for client 2020-05-25 18:28:24 +02:00
AlmogBaku
1b725cb0b9 fixes #33, remove missingPropError error 2020-04-02 16:48:13 +02:00
Simon Ser
abadf534f4
carddav: expose supported address data in client 2020-02-27 12:36:14 +01:00
Simon Ser
7d2b6a3902
carddav: make Discover fail when target is empty 2020-02-19 16:32:35 +01:00
Simon Ser
4b24edf624
carddav: fix Discover with default HTTPS port 2020-02-19 16:31:03 +01:00
Simon Ser
ddf2a85958
Introduce HTTPClient, remove Client.SetBasicAuth 2020-02-19 16:02:49 +01:00
Simon Ser
c52097fefb
carddav: add Client.GetAddressObject 2020-02-12 21:38:55 +01:00
Simon Ser
236dc07837
carddav: fix Client.PutAddressObject failing with Radicale
This is workaround for a Radicale issue.

References: https://github.com/Kozea/Radicale/issues/1016
2020-02-12 21:10:52 +01:00
Simon Ser
842acb3647
carddav: add Client.PutAddressObject 2020-02-12 19:47:16 +01:00
Simon Ser
a892cc58df
internal: only handle relative paths in Client.ResolveHref
Don't prepend the endpoint path in front of absolute paths.
2020-02-12 17:13:12 +01:00
Simon Ser
f9d728aaeb
carddav: add Client.HasSupport 2020-02-05 16:08:15 +01:00
Simon Ser
25678476db
internal: add ETag 2020-02-03 21:48:31 +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
6aea0eda2d
caldav: add Client boilerplate 2020-01-30 13:18:05 +01:00
Simon Ser
feea39c898
carddav: fix server appearing as read-only in Evolution 2020-01-30 00:43:23 +01:00
Simon Ser
8937358ac1
Allow servers to return DAV capabilities in OPTIONS 2020-01-29 18:03:47 +01:00
Simon Ser
5f03e421d3
carddav: fix addressbook-home-set>href namespace 2020-01-29 17:41:28 +01:00
Simon Ser
1f509de404
carddav: honor address-data in addressbook-query 2020-01-27 10:30:19 +01:00
Simon Ser
29cccc7ef9
carddav: add query filter support in server
Closes: https://github.com/emersion/go-webdav/issues/18
2020-01-24 16:34:57 +01:00
Simon Ser
73b67b62b1
carddav: add client support for query filter
References: https://github.com/emersion/go-webdav/issues/18
2020-01-24 12:24:35 +01:00
Simon Ser
5ada08f6ab
carddav: add full query AST 2020-01-24 11:25:58 +01:00
Simon Ser
e56ab47c43
carddav: add negateCondition 2020-01-23 19:32:10 +01:00
Simon Ser
30977aac83
carddav: add matchType 2020-01-23 19:27:31 +01:00
Simon Ser
38b729ad9c
carddav: remove filter.MarshalText
This isn't necessary, we can just straight up let encoding/xml use the
string.
2020-01-23 19:21:00 +01:00
Simon Ser
94f47fa001
carddav: add limit support to addressbook-query
References: https://github.com/emersion/go-webdav/issues/18
2020-01-23 10:35:14 +01:00
Simon Ser
70c3bffdf3
carddav: add filter and limit XML definitions 2020-01-22 20:36:35 +01:00
Simon Ser
cd5945aace
carddav: add AddressBook{Query,MultiGet}.AllProp 2020-01-22 19:18:58 +01:00
Simon Ser
7e29f37bd8
carddav: add allprop and propname support to query and multiget in server 2020-01-22 18:59:01 +01:00
Simon Ser
0a251a8dfb
carddav: add AddressObject.{ModTime,ETag} 2020-01-22 15:35:36 +01:00
Simon Ser
2eb6e89979
carddav: add DELETE support to server 2020-01-22 15:16:41 +01:00
Simon Ser
aa750836d4
carddav: add PUT support to server 2020-01-22 15:14:49 +01:00
Simon Ser
bf97060e19
carddav: don't support PROPPATCH
PROPPATCH can't be used to change an address object's data. For now,
let's not support it.
2020-01-22 14:52:14 +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
45774fe572
carddav: simplify variable names 2020-01-21 21:04:19 +01:00
Simon Ser
0469c3d389
all: add basic docs 2020-01-21 21:01:18 +01:00
Simon Ser
d21315e9fc
Fix host trailing dot in Discover 2020-01-20 13:17:19 +01:00
Simon Ser
19140af10d
carddav: add Discover 2020-01-20 11:15:22 +01:00
Simon Ser
3a61646ab4
carddav: add current-user-principal to server 2020-01-20 10:56:25 +01:00