Skip to content

HTTP server to support request body read timeout #458

Open
@kachayev

Description

@kachayev

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions