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>
This commit is contained in:
parent
2f4ca3c9c8
commit
03e149d4e1
@ -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')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user