diff options
author | Artem Labazin <alabazin@griddynamics.com> | 2017-07-26 02:02:24 +0300 |
---|---|---|
committer | Artem Labazin <alabazin@griddynamics.com> | 2017-07-26 02:02:24 +0300 |
commit | bcdc5ddd37d241a70ee91f0dac29ff868c989b1a (patch) | |
tree | 934dbf4ba2b67447f8f26d8cf48f41f802113af6 | |
parent | e00953cbc08b0eed3fec6044216e5764c85da076 (diff) | |
download | Nim-bcdc5ddd37d241a70ee91f0dac29ff868c989b1a.tar.gz |
Add more suitable error code and reason phrase for required Content-Length request.
-rw-r--r-- | lib/pure/asynchttpserver.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/pure/asynchttpserver.nim b/lib/pure/asynchttpserver.nim index a374e80e8..b7b57a82f 100644 --- a/lib/pure/asynchttpserver.nim +++ b/lib/pure/asynchttpserver.nim @@ -127,7 +127,7 @@ proc parseProtocol(protocol: string): tuple[orig: string, major, minor: int] = i.inc protocol.parseInt(result.minor, i) proc sendStatus(client: AsyncSocket, status: string): Future[void] = - client.send("HTTP/1.1 " & status & "\c\L\c\L") + client.send("HTTP/1.1 " & status & "\c\L\c\L") proc processClient(client: AsyncSocket, address: string, callback: proc (request: Request): @@ -233,7 +233,7 @@ proc processClient(client: AsyncSocket, address: string, 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.") + await request.respond(Http411, "Content-Length required.") continue # Call the user's callback. |