-
Notifications
You must be signed in to change notification settings - Fork 340
Open
Description
This commit fetches (and discards) the body of the request of redirect responses when custom :pool option is used, to overcome some kind of resource leak.
iex(8)> Mix.install([{:hackney, "== 1.24.0"}])
:ok
iex(9)> {:ok, 302, _, c} = :hackney.request("GET", "https://httpbin.org/redirect/2", [], "", [pool: :example])
{:ok, 302,
[
{"Date", "Wed, 15 Oct 2025 14:27:54 GMT"},
{"Content-Type", "text/html; charset=utf-8"},
{"Content-Length", "247"},
{"Connection", "keep-alive"},
{"Server", "gunicorn/19.9.0"},
{"Location", "/relative-redirect/1"},
{"Access-Control-Allow-Origin", "*"},
{"Access-Control-Allow-Credentials", "true"}
], #Reference<0.2099663243.2053373956.249404>}
iex(10)> :hackney.body(c, 0)
{:error, :req_not_found}
I guess base.ex should be adjusted to also check for these response codes (in presence of the :pool option) in order to circumvent the :req_not_found error and just return the request w/ empty body? If you agree I'll create a PR.
Metadata
Metadata
Assignees
Labels
No labels