mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-13 06:43:52 +00:00
Fixes #1759.
Caused by not skipping the \c\l with Chunked encoding after the body is parsed.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user