diff options
author | Dominik Picheta <dominikpicheta@googlemail.com> | 2014-12-21 22:41:13 +0000 |
---|---|---|
committer | Dominik Picheta <dominikpicheta@googlemail.com> | 2014-12-21 22:41:13 +0000 |
commit | e6245674f24616ab940dee79883c6b18ac182d2e (patch) | |
tree | ddd98c0af61e667dcae1cf2c328df05fe20ba3a3 /lib/pure/httpclient.nim | |
parent | 2990a9224bcaaec2d79f0ee7b0cc233543f3d67d (diff) | |
download | Nim-e6245674f24616ab940dee79883c6b18ac182d2e.tar.gz |
Fixes #1759.
Caused by not skipping the \c\l with Chunked encoding after the body is parsed.
Diffstat (limited to 'lib/pure/httpclient.nim')
-rw-r--r-- | lib/pure/httpclient.nim | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/pure/httpclient.nim b/lib/pure/httpclient.nim index a7e1aeab2..3afb625ee 100644 --- a/lib/pure/httpclient.nim +++ b/lib/pure/httpclient.nim @@ -156,7 +156,9 @@ proc parseChunks(s: Socket, timeout: int): string = else: httpError("Invalid chunk size: " & chunkSizeStr) inc(i) - if chunkSize <= 0: break + if chunkSize <= 0: + s.skip(2, timeout) # Skip \c\L + break result.setLen(ri+chunkSize) var bytesRead = 0 while bytesRead != chunkSize: @@ -521,7 +523,9 @@ proc parseChunks(client: AsyncHttpClient): Future[string] {.async.} = else: httpError("Invalid chunk size: " & chunkSizeStr) inc(i) - if chunkSize <= 0: break + if chunkSize <= 0: + discard await recvFull(client.socket, 2) # Skip \c\L + break result.add await recvFull(client.socket, chunkSize) discard await recvFull(client.socket, 2) # Skip \c\L # Trailer headers will only be sent if the request specifies that we want |