clj-commons / clj-commons/aleph
HTTP server to support request body read timeout
- Dominant language
- Clojure
- Stars
- 2.6k
- Forks
- 242
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 1
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
```clojure
(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.
Contributor guide
Research direction
Start by tracing the HTTP server handling around raw-handler, response-executor, and :request-buffer-size. Clarify the timeout behavior and configuration expected for slow or paused request bodies; done means such requests no longer occupy response-executor threads while normal body parsing continues.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100