Open
Description
This could be done manually by switching to raw-handler
and tracking time we need to read chunks from the stream, but in most general use case like
(defn handler [{:keys [body]}]
(json/parse-string (bs/to-string body)) true)
(http/start-server handler {:port port})
a client (either malicious or buggy) could easily consume a thread per each connection by sending a request with a body that exceeds :request-buffer-size
slowly enough (or just pausing forever). In such a case we invoke handler
on a response-executor
before the body is read, meaning that call to bs/to-string
effectively blocks a thread allocated.