Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP server to support request body read timeout #458

Open
kachayev opened this issue Dec 28, 2018 · 0 comments
Open

HTTP server to support request body read timeout #458

kachayev opened this issue Dec 28, 2018 · 0 comments

Comments

@kachayev
Copy link
Collaborator

kachayev commented Dec 28, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant