Conrad Hoffmann
7dafedd290
Add type-safe precondition errors for CalDAV
2022-04-01 16:22:04 +02:00
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
52215c1690
Pass request context to backend interface
...
This aligns the caldav interface with the carddav one (see #53 ).
2022-03-16 20:11:00 +01:00
Simon Ser
106d4e1c88
caldav: add basic server
...
A lot of features a still missing, but basic discovery works.
Co-authored-by: Conrad Hoffmann <ch@bitfehler.net>
2022-03-16 16:47:29 +01:00
Simon Ser
9caa4ff356
caldav: add support for reports
...
Co-authored-by: Conrad Hoffmann <ch@bitfehler.net>
2022-03-16 16:47:29 +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
Simon Ser
2162596af8
readme: update badges
2022-02-02 13:54:40 +01:00
jumo98
6238e10e65
Include ModTime for directories if available
2021-08-11 11:08:03 +02:00
Sebastien Binet
8efde26ef9
internal: use http.TimeFormat to marshal Time values
2021-03-16 18:42:55 +01:00
Apehaenger
ed52608852
Make Response.Path return the path on error
2021-01-12 12:57:28 +01:00
Simon Ser
373663f9ee
readme: add CI badge
2020-10-12 17:35:10 +02:00
Heiko Carrasco
4316bbcd93
caldav: add server handling for well-known URLs
2020-10-09 15:10:33 +02:00
proletarius101
9cd3bb51b9
fix: deprecrated conversion from int64 to string
2020-09-09 16:00:38 +02:00
AlmogBaku
9e23289610
sync-collection for client
2020-05-25 18:28:24 +02: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
a4e0e81003
caldav: add Client.MultiGetCalendar
2020-05-13 16:45:25 +02:00
Simon Ser
5328b4c493
caldav: set Depth to 1 for calendar-query REPORT requests
...
SabreDAV chokes on an unset Depth header field.
2020-05-13 15:06:16 +02:00
Simon Ser
4c0dc5d900
internal: parse WebDAV toplevel <error> elements
2020-05-13 15:02:52 +02:00
Simon Ser
f4e3fe8c0a
internal: add Multistatus.Get test with HTTP error
...
References: https://github.com/emersion/go-webdav/issues/39
2020-04-05 14:37:17 +02:00
Simon Ser
66d5686c9e
ci: add .build.yml
2020-04-02 16:50:41 +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
514296664c
caldav: upgrade to latest go-ical API
2020-02-24 21:16:45 +01:00
Simon Ser
4c419a961d
caldav: add Client.GetCalendarObject
2020-02-24 18:19:39 +01:00
Simon Ser
7bb9b3aa0b
caldav: add Client.PutCalendarObject
2020-02-24 18:13:24 +01:00
Simon Ser
07d4dfae5e
Use new ical library
2020-02-24 17:52:25 +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
a81a7014c6
internal: remove outdated TODO
2020-02-12 20:06:06 +01:00
Simon Ser
7d0d522fa7
internal: prevent empty endpoint path from resulting in "." sub-paths
2020-02-12 20:04:31 +01:00
Simon Ser
842acb3647
carddav: add Client.PutAddressObject
2020-02-12 19:47:16 +01:00
Simon Ser
30eac28d2b
internal: read response body on error
2020-02-12 19:46:05 +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
0b2d0a706c
internal: accomodate for trailign slashes in Multistatus.Get
2020-02-12 17:12:21 +01:00
Simon Ser
7f285fdf83
internal: fix Client.PropfindFlat when endpoint has a non-empty path
2020-02-12 16:40:30 +01:00
Simon Ser
9afa59dc22
internal: fix trailing slash getting removed in Client.ResolveHref
2020-02-12 16:40:03 +01:00
Simon Ser
1d93353e3d
caldav: add prop-filter support to client
2020-02-05 18:38:46 +01:00
Simon Ser
baf63fb1b7
caldav: parse iCal data
2020-02-05 18:05:48 +01:00
Simon Ser
4eb8396edb
caldav: add support for time filters in client
2020-02-05 17:36:18 +01:00
Simon Ser
57df6bf316
caldav: add filter XML definition
2020-02-05 17:07:35 +01:00
Simon Ser
f9d728aaeb
carddav: add Client.HasSupport
2020-02-05 16:08:15 +01:00
Simon Ser
3ea3818dd8
internal: fix Status text marshaling
2020-02-03 21:54:55 +01:00
Simon Ser
69d8cf54ff
internal: fix ETag.String returning unquoted string
2020-02-03 21:52:15 +01:00
Simon Ser
25678476db
internal: add ETag
2020-02-03 21:48:31 +01:00