diff options
author | Lukas Fleischer <lfleischer@calcurse.org> | 2016-12-08 09:37:34 +0100 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2017-08-28 06:42:53 +0200 |
commit | e76b96c9ff162ada42863d4ec2d739bf874af113 (patch) | |
tree | fffafc13f4c5d6663c01df17ffe1311281ab4d3b | |
parent | b36dd2e614f51d7061b8dabd0bb139833ef7bed4 (diff) | |
download | calcurse-e76b96c9ff162ada42863d4ec2d739bf874af113.tar.gz calcurse-e76b96c9ff162ada42863d4ec2d739bf874af113.zip |
calcurse-caldav: Specify depth in the initial request
For the initial calendar-query request, set the Depth header to 1. This
is required because according to RFC 4791, the depth value defaults to 0
if no header is specified.
Fixes GitHub issue #38.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
-rwxr-xr-x | contrib/caldav/calcurse-caldav.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/contrib/caldav/calcurse-caldav.py b/contrib/caldav/calcurse-caldav.py index 5c028bf..1db4740 100755 --- a/contrib/caldav/calcurse-caldav.py +++ b/contrib/caldav/calcurse-caldav.py @@ -138,6 +138,7 @@ def remote_query(conn, cmd, path, additional_headers, body): def get_etags(conn, hrefs=[]): if len(hrefs) > 0: + headers = {} body = ('<?xml version="1.0" encoding="utf-8" ?>' '<C:calendar-multiget xmlns:D="DAV:" ' ' xmlns:C="urn:ietf:params:xml:ns:caldav">' @@ -146,13 +147,14 @@ def get_etags(conn, hrefs=[]): body += '<D:href>{}</D:href>'.format(href) body += '</C:calendar-multiget>' else: + headers = {'Depth': '1'} body = ('<?xml version="1.0" encoding="utf-8" ?>' '<C:calendar-query xmlns:D="DAV:" ' ' xmlns:C="urn:ietf:params:xml:ns:caldav">' '<D:prop><D:getetag /></D:prop>' '<C:filter><C:comp-filter name="VCALENDAR" /></C:filter>' '</C:calendar-query>') - headers, body = remote_query(conn, "REPORT", path, {}, body) + headers, body = remote_query(conn, "REPORT", path, headers, body) if not headers: return {} root = etree.fromstring(body) |