ledgetech / ledgetech/lua-resty-http
Harden set_keepalive() to pool only when response read
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 2.1k
- Forks
- 630
- PR merge metrics
- No merged PRs in 30d
Description
Right now httpc:set_keepalive will pool any socket if the HTTP response version + Connection response header support it, even if the body wasn't read yet and the socket isn't ready to be pooled (assuming the body wasn't received by OpenResty yet, because then it will return an error).
I suggest we keep an internal state in httpc to track whether the request and response has completed successfully (probably at the end of the body readers + a few more places) and set_keepalive() will only pool if the socket is ready.
This will prevent pooling sockets in strange states.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing httpc:set_keepalive and the body-reader paths described in the issue. Identify where request and response completion can be tracked, then verify that only successfully completed responses with ready sockets are pooled; the issue does not name specific tests or files to run.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, nginx
- Domain
- backend, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100