summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorArtem Labazin <alabazin@griddynamics.com>2017-07-26 02:02:24 +0300
committerArtem Labazin <alabazin@griddynamics.com>2017-07-26 02:02:24 +0300
commitbcdc5ddd37d241a70ee91f0dac29ff868c989b1a (patch)
tree934dbf4ba2b67447f8f26d8cf48f41f802113af6
parente00953cbc08b0eed3fec6044216e5764c85da076 (diff)
downloadNim-bcdc5ddd37d241a70ee91f0dac29ff868c989b1a.tar.gz
Add more suitable error code and reason phrase for required Content-Length request.
-rw-r--r--lib/pure/asynchttpserver.nim4
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.