chiark / gitweb /
wip
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 1 Apr 2017 20:24:02 +0000 (21:24 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 1 Apr 2017 20:24:02 +0000 (21:24 +0100)
client
server

diff --git a/client b/client
index c08b5fc..ec28fd0 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):
-  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)
diff --git a/server b/server
index 79bd15b..6a71bfd 100755 (executable)
--- a/server
+++ b/server
@@ -139,7 +139,7 @@ class Client():
 
 def process_request(request, desca):
   # find client, update config, etc.
-  metadata = request.args[b'mX'][0]
+  metadata = request.args[b'm'][0]
   metadata = metadata.split(b'\r\n')
   (ci_s, pw, tro) = metadata[0:3]
   desca['m[0,2]'] = [ci_s, tro]