From: Mark Wooding Date: Mon, 25 Sep 2017 09:29:01 +0000 (+0100) Subject: hippotat: Don't set an explicit `Content-Length'. X-Git-Tag: hippotat/1.0.0~55^2~5 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=hippotat.git;a=commitdiff_plain;h=b3e598b5ea54399982e0183a3e59835b0f82f077;ds=sidebyside hippotat: Don't set an explicit `Content-Length'. It turns out (a) that the existing Twisted machinery already sets a `Content-Length' header on `POST' submissions, (b) that it's too stupid to notice that the caller's already set one, and (c) that nginx rejects `POST' requests with duplicate `Content-Length' headers with `400 Bad Request', which turns out to be surprisingly hard to debug. Signed-off-by: Mark Wooding --- diff --git a/hippotat b/hippotat index 7130f91..97d40a7 100755 --- a/hippotat +++ b/hippotat @@ -223,8 +223,7 @@ class Client(): cl.log(DBG.HTTP_FULL, 'requesting: ' + str(mime)) hh = { 'User-Agent': ['hippotat'], - 'Content-Type': ['multipart/form-data; boundary="b"'], - 'Content-Length': [str(len(mime))] } + 'Content-Type': ['multipart/form-data; boundary="b"'] } bytesreader = io.BytesIO(mime) producer = twisted.web.client.FileBodyProducer(bytesreader)