fixes
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 1 Apr 2017 18:09:10 +0000 (19:09 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 1 Apr 2017 18:09:10 +0000 (19:09 +0100)
client

diff --git a/client b/client
index 3e3890f..856c674 100755 (executable)
--- a/client
+++ b/client
@@ -5,6 +5,8 @@ from hippotat import *
 import twisted.web
 import twisted.web.client
 
+import io
+
 client_cs = None
 
 def set_client(ci,cs,pw):
@@ -127,9 +129,14 @@ def check_outbound():
     hh = { 'User-Agent': ['hippotat'],
            'Content-Type': ['multipart/form-data; boundary="b"'],
            'Content-Length': [str(len(mime))] }
+
+    bytesreader = io.BytesIO(mime)
+    producer = twisted.web.client.FileBodyProducer(bytesreader)
+
     req = agent.request(b'POST',
                         c.url,
-                        twisted.web.client.Headers(hh))
+                        twisted.web.client.Headers(hh),
+                        producer)
     req.addTimeout(c.http_timeout, reactor)
     req.addCallbacks(req_ok, req_err)
     outstanding += 1