diff options
author | Lukas Fleischer <lfleischer@calcurse.org> | 2016-01-23 16:52:30 +0100 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2016-01-23 16:58:01 +0100 |
commit | 03e149d4e17af37547d40518176ccc0d2da7b51e (patch) | |
tree | a63eec2df30e2bbc4cc8abdfc1f026050f4ac70f /contrib/caldav | |
parent | 2f4ca3c9c8cf632b738ffb36a025acdef2461523 (diff) | |
download | calcurse-03e149d4e17af37547d40518176ccc0d2da7b51e.zip |
calcurse-caldav: Check response status
Bail out if the HTTP status code of any of the replies starts with a
digit other than 2.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'contrib/caldav')
-rwxr-xr-x | contrib/caldav/calcurse-caldav.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/contrib/caldav/calcurse-caldav.py b/contrib/caldav/calcurse-caldav.py index 3c544d6..0feed12 100755 --- a/contrib/caldav/calcurse-caldav.py +++ b/contrib/caldav/calcurse-caldav.py @@ -100,6 +100,11 @@ def remote_query(cmd, path, additional_headers, body): if not resp: return (None, None) + if resp.status - (resp.status % 100) != 200: + die(("The server at %s replied with HTTP status code %d (%s) " + + "while trying to access %s.") % + (hostname, resp.status, resp.reason, path)) + headers = resp.getheaders() body = resp.read().decode('utf-8') |