diff --git a/Readme.md b/Readme.md index bd3ae88..91429af 100644 --- a/Readme.md +++ b/Readme.md @@ -1,4 +1,4 @@ -Websocket for Nim +# Websocket for Nim We're working towards an implementation of the [Websocket](https://tools.ietf.org/html/rfc6455) protocol for @@ -14,8 +14,14 @@ Install dependencies: nimble install -d ``` -Run tests: +Starting HTTP server: ```bash -nimble test +nim c -r test/server.nim +``` + +Testing Server Response: + +```bash +curl --location --request GET 'http://localhost:8888' ``` diff --git a/src/ws.nim b/src/ws.nim index a47c065..24e7da1 100644 --- a/src/ws.nim +++ b/src/ws.nim @@ -63,17 +63,7 @@ proc validateRequest(transp: StreamTransport, result = ErrorFailure return - let length = header.contentLength() - if length <= 0: - # request length could not be calculated. - debug "Content-Length is missing or 0", address = transp.remoteAddress() - if await transp.sendHTTPResponse(header.version, Http411): - result = Error - else: - result = ErrorFailure - return - - if length > MaxHttpRequestSize: + if header.contentLength() > MaxHttpRequestSize: # request length is more then `MaxHttpRequestSize`. debug "Maximum size of request body reached", address = transp.remoteAddress()