calcurse-caldav: Handle missing ETag gracefully

This was partly fixed by 475c341 (calcurse-caldav: Fix late retrieval of
ETag, 2016-01-25). However, the case where the server does not return
ETag after creating a new item still wasn't handled properly. This patch
hopefully addresses this and also makes sure that the ETag header is
matched case-insensitively.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
Lukas Fleischer 2016-01-25 21:45:56 +01:00
parent 4fff8ae4fe
commit bfafec3ebf

View File

@ -192,7 +192,10 @@ def push_object(conn, objhash):
if not headers:
return None
etag = [header[1] for header in headers if header[0] == 'ETag'][0]
etag = None
headerdict = dict((key.lower(), value) for key, value in headers)
if 'etag' in headerdict:
etag = headerdict['etag']
while not etag:
hrefmap = get_hrefmap(conn, objhash)
if len(hrefmap.keys()) > 0: