chiark / gitweb /
wip
[hippotat.git] / client
diff --git a/client b/client
index c08b5fc9a63bcd80d382fcf82abfeb112b2d2c1f..ec28fd07de6c0f84cc5d960721ddd6dfb7f794ef 100755 (executable)
--- a/client
+++ b/client
@@ -93,7 +93,17 @@ class ResponseConsumer(twisted.internet.protocol.Protocol):
     req_err(self._req, reason)
 
 def req_ok(req, resp):
     req_err(self._req, reason)
 
 def req_ok(req, resp):
-  log_debug(DBG.HTTP_CTRL, 'req_ok ' + str(resp), idof=req)
+  log_debug(DBG.HTTP_CTRL,
+            'req_ok %d %s %s' % (resp.code, repr(resp.phrase), str(resp)),
+            idof=req)
+  if resp.code != 200:
+    try:
+      phrase = resp.phrase.decode('utf-8')
+    except UnicodeDecodeError:
+      phrase = repr(resp.phrase)
+    req_err(req, "FAILED %d %s" % (resp.code, phrase))
+    return
+
   rc = ResponseConsumer(req)
   resp.deliverBody(rc)
   req_fin(req)
   rc = ResponseConsumer(req)
   resp.deliverBody(rc)
   req_fin(req)