Commit Graph

32 Commits

Author SHA1 Message Date
Timo Furrer
aba953c3b6 Implement context path discovery for CalDav/CardDav endpoint
This change set implements the "context path" discovery for the
CalDav/CardDav endpoints.

This basically implements the bootstrapping process as defined in
RFC6764 section 6, point 2 and 3.

What's missing in this implementation is the fallback that is described
in point 3, subpoint 3, which says that if the context path discovered
in the TXT RR is not reachable the .well-known URI should be used
instead.

I propose to implement this in a future iteration.
2025-02-21 10:50:48 +01:00
Simon Ser
7e076258d6 caldav: add DiscoverContextURL 2023-12-27 23:16:49 +01:00
Simon Ser
379a418130 Add context for clients 2023-12-19 21:29:37 +01:00
Simon Ser
d7891ce50c internal: fix XML element struct naming
We were sometimes using TitleCase, sometimes Lowercase. Let's align
on the idiomatic Go naming and pick TitleCase everywhere.
2022-05-31 23:04:42 +02:00
Conrad Hoffmann
03633121d9 client: support redirects in PropfindFlat()
One common method for CalDAV or CardDAV clients to find the current user
principal URL is to request the `/.well-known` URL (see [RFC 6764,
section 6][1]), expecting a redirect. Such URL is for example a valid
result of the discovery phase described in that RFC. The expectation is
that a client, given such URL, is able to find the principal URL by
following a redirect when sending a PROPFIND request.

This change makes `PropfindFlat()` (and, by extension,
`FindCurrentUserPrincipal()`) handle such a redirect and correctly
return the requested properties, even if their HREF is different from
the original request path.

[1]: https://datatracker.ietf.org/doc/html/rfc6764#section-6
2022-05-31 16:05:54 +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
4c0dc5d900 internal: parse WebDAV toplevel <error> elements 2020-05-13 15:02:52 +02:00
Simon Ser
ddf2a85958 Introduce HTTPClient, remove Client.SetBasicAuth 2020-02-19 16:02:49 +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
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
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
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
6de76c94b8 internal: check for HTTP errors in Client.Do
Closes: https://github.com/emersion/go-webdav/issues/19
2020-01-22 13:22:45 +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
489be203a1 webdav: add Client.MoveAll 2020-01-22 10:15:44 +01:00
Simon Ser
c0a91b0085 internal: move Depth to internal.go 2020-01-22 10:06:00 +01:00
Simon Ser
3e41eefd12 internal: properly encode path in Client.NewRequest 2020-01-20 13:40:26 +01:00
Simon Ser
3beeb23f7c internal: drop unused field in Client 2020-01-16 18:08:26 +01:00
Simon Ser
cabf33219e Add Client.SetBasicAuth 2020-01-15 23:45:37 +01:00
Simon Ser
ae93da82c1 webdav: add minimal server implementation 2020-01-15 18:21:27 +01:00
Simon Ser
42765234a8 internal: add Depth, Client.Propfind 2020-01-15 12:30:42 +01:00
Simon Ser
9dfabd89c8 carddav: add Client.FindAddressBooks 2020-01-14 23:13:23 +01:00
Simon Ser
931602e55d internal: add Client.PropfindFlat 2020-01-14 21:43:09 +01:00
Simon Ser
94d597c1f5 internal: remove unnecessary call to Encoder.Flush 2020-01-14 21:38:25 +01:00
Simon Ser
5748fec4d0 internal: add helpers to parse multistatus 2020-01-14 21:29:54 +01:00
Simon Ser
87a88d6723 Generate PROPFIND request body
Instead of a hardcoded string, generate it with encoding/xml.
2020-01-14 20:00:54 +01:00
Simon Ser
3beb076950 webdav: add very basic Client 2020-01-14 18:51:17 +01:00