diff options
author | Yuriy Glukhov <yuriy.glukhov@gmail.com> | 2017-03-01 17:11:39 +0200 |
---|---|---|
committer | Yuriy Glukhov <yuriy.glukhov@gmail.com> | 2017-03-01 17:11:39 +0200 |
commit | f842f9d6aa1196debafd86adc2e35330c68309c1 (patch) | |
tree | 5ffb5717bc0bacd15b208f3a6750195f2307b7cd | |
parent | dd4d47c671827148bdaf478c7a37460931cd242c (diff) | |
download | Nim-f842f9d6aa1196debafd86adc2e35330c68309c1.tar.gz |
Dont assert on malformed requests
-rw-r--r-- | lib/pure/asynchttpserver.nim | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/pure/asynchttpserver.nim b/lib/pure/asynchttpserver.nim index 672eb34a0..60eb68bc8 100644 --- a/lib/pure/asynchttpserver.nim +++ b/lib/pure/asynchttpserver.nim @@ -209,7 +209,9 @@ proc processClient(client: AsyncSocket, address: string, continue else: request.body = await client.recv(contentLength) - assert request.body.len == contentLength + if request.body.len != contentLength: + await request.respond(Http400, "Bad Request. Content-Length does not match actual.") + continue elif request.reqMethod == HttpPost: await request.respond(Http400, "Bad Request. No Content-Length.") continue |