Dont assert on malformed requests
This commit is contained in:
parent
dd4d47c671
commit
f842f9d6aa
1 changed files with 3 additions and 1 deletions
|
|
@ -209,7 +209,9 @@ proc processClient(client: AsyncSocket, address: string,
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
request.body = await client.recv(contentLength)
|
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:
|
elif request.reqMethod == HttpPost:
|
||||||
await request.respond(Http400, "Bad Request. No Content-Length.")
|
await request.respond(Http400, "Bad Request. No Content-Length.")
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue