Thomas Müller
948f33c2fc
internal: use application/xml instead of text/xml which is deprecated
2024-04-11 17:16:25 +02:00
Thomas Müller
3ed9a4f052
carddav, caldav: add missing headers on PUT
...
ETag and Last-Modified should be set to the new calendar object or
address object properties.
2024-03-28 11:22:46 +01:00
Conrad Hoffmann
25f1014ef2
internal: no status element in propstat responses
...
Responses that contain propstat elements do not contain their own
top-level status element, only the status elements inside the propstat
element.
See https://datatracker.ietf.org/doc/html/rfc4918#section-14.24 or any
of the examples for PROPFIND/PROPPATCH, starting e.g. here:
https://datatracker.ietf.org/doc/html/rfc4918#section-9.1.3
2024-02-08 23:12:59 +01:00
Simon Ser
f1d56f2437
internal: add IsRequestEmpty
2024-02-07 17:23:17 +01:00
Simon Ser
b043bbd965
internal/server: handle PROPFIND without body
...
See RFC 4918 section 9.1.
2024-01-08 14:58:24 +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
Simon Ser
4e8c5effe3
Replace DAVError with HTTPError + Error
...
That way we can avoid having different ways of representing the
same error value.
2022-05-02 15:43:43 +02: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
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