parent
781cb35200
commit
7e668c4c85
|
@ -25,6 +25,9 @@ requires "bearssl"
|
|||
requires "https://github.com/status-im/nim-zlib"
|
||||
|
||||
task test, "run tests":
|
||||
# dont't need to run it, only want to test if it is compileable
|
||||
exec "nim c -c --verbosity:0 --hints:off -d:chronicles_log_level=TRACE -d:chronicles_sinks:json ./tests/testcommon"
|
||||
|
||||
exec "nim --hints:off c -r --opt:speed -d:debug --verbosity:0 --hints:off -d:chronicles_log_level=info ./tests/testcommon.nim"
|
||||
rmFile "./tests/testcommon"
|
||||
|
||||
|
|
|
@ -38,13 +38,13 @@ proc validateRequest(
|
|||
##
|
||||
|
||||
if header.meth notin {MethodGet}:
|
||||
trace "GET method is only allowed", address = stream.tsource.remoteAddress()
|
||||
trace "GET method is only allowed", address = $stream.tsource.remoteAddress()
|
||||
await stream.sendError(Http405, version = header.version)
|
||||
return ReqStatus.Error
|
||||
|
||||
var hlen = header.contentLength()
|
||||
if hlen < 0 or hlen > MaxHttpRequestSize:
|
||||
trace "Invalid header length", address = stream.tsource.remoteAddress()
|
||||
trace "Invalid header length", address = $stream.tsource.remoteAddress()
|
||||
await stream.sendError(Http413, version = header.version)
|
||||
return ReqStatus.Error
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ proc handleClose*(
|
|||
raise newException(WSInvalidUTF8,
|
||||
"Invalid UTF8 sequence detected in close reason")
|
||||
|
||||
trace "Handling close message", code, reason
|
||||
trace "Handling close message", code = $code, reason
|
||||
if not isNil(ws.onClose):
|
||||
try:
|
||||
(code, reason) = ws.onClose(code, reason)
|
||||
|
@ -197,7 +197,7 @@ proc handleClose*(
|
|||
# don't respond to a terminated connection
|
||||
if ws.readyState != ReadyState.Closing:
|
||||
ws.readyState = ReadyState.Closing
|
||||
trace "Sending close", code, reason
|
||||
trace "Sending close", code = $code, reason
|
||||
await ws.send(prepareCloseBody(code, reason), Opcode.Close)
|
||||
|
||||
ws.readyState = ReadyState.Closed
|
||||
|
|
Loading…
Reference in New Issue