From f2c1b3be1341e85b17dc4dc5958a42f330285237 Mon Sep 17 00:00:00 2001 From: def Date: Tue, 13 Jan 2015 18:48:49 +0100 Subject: Fix body in httpclient - Never append a newline to the body in a HTTP post. - Pass the entire body to redirections, including multipart data --- lib/pure/httpclient.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pure/httpclient.nim b/lib/pure/httpclient.nim index bfdfed72c..d9f161d49 100644 --- a/lib/pure/httpclient.nim +++ b/lib/pure/httpclient.nim @@ -505,7 +505,7 @@ proc post*(url: string, extraHeaders = "", body = "", else: x - var xb = mpBody.withNewLine() & body.withNewLine() + var xb = mpBody.withNewLine() & body var xh = extraHeaders.withNewLine() & mpHeaders.withNewLine() & withNewLine("Content-Length: " & $len(xb)) @@ -517,7 +517,7 @@ proc post*(url: string, extraHeaders = "", body = "", if result.status.redirection(): let redirectTo = getNewLocation(lastURL, result.headers) var meth = if result.status != "307": httpGet else: httpPost - result = request(redirectTo, meth, xh, body, sslContext, timeout, + result = request(redirectTo, meth, xh, xb, sslContext, timeout, userAgent, proxy) lastUrl = redirectTo -- cgit 1.4.1-2-gfad0