diff options
author | def <dennis@felsin9.de> | 2015-01-13 18:48:49 +0100 |
---|---|---|
committer | def <dennis@felsin9.de> | 2015-01-13 18:48:49 +0100 |
commit | f2c1b3be1341e85b17dc4dc5958a42f330285237 (patch) | |
tree | 1f79bab5c065616f651827a73bad301ffbe6768b /lib/pure | |
parent | 4754d2dcbde4be1e9d0de8f9b3c3502e66c4ca24 (diff) | |
download | Nim-f2c1b3be1341e85b17dc4dc5958a42f330285237.tar.gz |
Fix body in httpclient
- Never append a newline to the body in a HTTP post. - Pass the entire body to redirections, including multipart data
Diffstat (limited to 'lib/pure')
-rw-r--r-- | lib/pure/httpclient.nim | 4 |
1 files 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 |