From b3e598b5ea54399982e0183a3e59835b0f82f077 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Mon, 25 Sep 2017 10:29:01 +0100 Subject: [PATCH 1/1] 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 --- hippotat | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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) -- 2.30.2