diff options
-rw-r--r-- | lib/pure/cgi.nim | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/pure/cgi.nim b/lib/pure/cgi.nim index ec3562c35..4f8bbe3d0 100644 --- a/lib/pure/cgi.nim +++ b/lib/pure/cgi.nim @@ -77,6 +77,8 @@ proc getEncodedData(allowedMethods: set[RequestMethod]): string = if methodPost notin allowedMethods: cgiError("'REQUEST_METHOD' 'POST' is not supported") var L = parseInt(getEnv("CONTENT_LENGTH").string) + if L == 0: + return "" result = newString(L) if readBuffer(stdin, addr(result[0]), L) != L: cgiError("cannot read from stdin") |