Update the readme instruction to test the server.
This commit is contained in:
parent
d4901f1cba
commit
a1c1c37a41
12
Readme.md
12
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'
|
||||
```
|
||||
|
|
12
src/ws.nim
12
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()
|
||||
|
|
Loading…
Reference in New Issue