chiark / gitweb /
fixes
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 1 Apr 2017 13:52:26 +0000 (14:52 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 1 Apr 2017 13:52:26 +0000 (14:52 +0100)
client
server

diff --git a/client b/client
index eb28ae0..922242d 100755 (executable)
--- a/client
+++ b/client
@@ -105,8 +105,8 @@ def check_outbound():
     lf   =   b'\n'
     mime = (b'--b'                                      + crlf +
             b'Content-Disposition: form-data; name="m"' + crlf + crlf +
-            password                                    + crlf +
             str(c.client)             .encode('ascii')  + crlf +
+            password                                    + crlf +
             str(c.target_outstanding) .encode('ascii')  + crlf +
           ((
             b'--b'                                      + crlf +
diff --git a/server b/server
index 0d75e0b..b9aa6f2 100755 (executable)
--- a/server
+++ b/server
@@ -138,10 +138,13 @@ class Client():
 
 def process_request(request, desca):
   # find client, update config, etc.
-  metadata = request.args['m']
+  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]
+  ci_s = ci_s.decode('utf-8')
+  tro = int(tro)
+  desca['tro']= tro
   ci = ipaddr(ci_s)
   desca['ci'] = ci
   cl = clients[ci]
@@ -152,7 +155,7 @@ def process_request(request, desca):
     raise ValueError('tro must be %d' % cl.target_requests_outstanding)
 
   try:
-    d = request.args['d']
+    d = request.args[b'd']
     desca['d'] = d
   except KeyError: d = ''
 
@@ -180,7 +183,7 @@ class IphttpResource(twisted.web.resource.Resource):
       log_http(desca, 'EXCEPTION ' + emsg)
       request.setHeader('Content-Type','text/plain; charset="utf-8"')
       request.setResponseCode(400)
-      return emsg.encode('utf-8')
+      return (emsg + ' # ' + repr(desca) + '\r\n').encode('utf-8')
     log_http(desca, '... [%s]' % id(request))
     return NOT_DONE_YET