Current section

40 Versions

Jump to

Compare versions

8 files changed
+61 additions
-23 deletions
  @@ -1,5 +1,19 @@
1 1 # Changelog
2 2
3 + ## v0.23.0 (2026-06-17)
4 +
5 + ### Fixed
6 +
7 + - Reject `http` and `https` request and pool URLs without hosts before attempting requests #371, fixes #186
8 + - Drop `:certs_keys`, `:certfile`, and `:keyfile` from TCP transport options for HTTP requests to avoid `:badarg` errors #377
9 + - Fix a race condition when dynamically starting pool supervisors that could return `:pool_not_available` while workers were still registering #379
10 + - Make the HTTP/2 ALPN negotiation failure assertion compatible with OTP 29 TLS alert capitalization #378
11 +
12 + ### Other
13 +
14 + - Update development and test dependencies, including Mint 1.9 #378
15 + - CI: update to Elixir 1.20.1 and Erlang/OTP 29.0.2 and fix Credo issues #378
16 +
3 17 ## v0.22.0 (2026-05-12)
4 18
5 19 ### Added
  @@ -203,7 +203,7 @@ The package can be installed by adding `finch` to your list of dependencies in `
203 203 ```elixir
204 204 def deps do
205 205 [
206 - {:finch, "~> 0.20"}
206 + {:finch, "~> 0.23"}
207 207 ]
208 208 end
209 209 ```
  @@ -2,7 +2,7 @@
2 2 [{<<"Changelog">>,<<"https://hexdocs.pm/finch/changelog.html">>},
3 3 {<<"GitHub">>,<<"https://github.com/sneako/finch">>}]}.
4 4 {<<"name">>,<<"finch">>}.
5 - {<<"version">>,<<"0.22.0">>}.
5 + {<<"version">>,<<"0.23.0">>}.
6 6 {<<"description">>,<<"An HTTP client focused on performance.">>}.
7 7 {<<"elixir">>,<<"~> 1.15">>}.
8 8 {<<"app">>,<<"finch">>}.
  @@ -47,7 +47,7 @@
47 47 <<"lib/finch/pool/manager.ex">>,<<"lib/finch/pool/strategy">>,
48 48 <<"lib/finch/pool/strategy/round_robin.ex">>,
49 49 <<"lib/finch/pool/strategy/random.ex">>,
50 - <<"lib/finch/pool/strategy/hash.ex">>,<<"lib/finch/transport_error.ex">>,
51 - <<".formatter.exs">>,<<"mix.exs">>,<<"README.md">>,<<"LICENSE.md">>,
52 - <<"CHANGELOG.md">>]}.
50 + <<"lib/finch/pool/strategy/hash.ex">>,<<"lib/finch/uri.ex">>,
51 + <<"lib/finch/transport_error.ex">>,<<".formatter.exs">>,<<"mix.exs">>,
52 + <<"README.md">>,<<"LICENSE.md">>,<<"CHANGELOG.md">>]}.
53 53 {<<"build_tools">>,[<<"mix">>]}.
  @@ -99,10 +99,20 @@ defmodule Finch.Pool do
99 99
100 100 case parsed.scheme do
101 101 "https" ->
102 - %__MODULE__{scheme: :https, host: parsed.host, port: parsed.port, tag: tag}
102 + %__MODULE__{
103 + scheme: :https,
104 + host: Finch.URI.fetch_host!(parsed),
105 + port: parsed.port,
106 + tag: tag
107 + }
103 108
104 109 "http" ->
105 - %__MODULE__{scheme: :http, host: parsed.host, port: parsed.port, tag: tag}
110 + %__MODULE__{
111 + scheme: :http,
112 + host: Finch.URI.fetch_host!(parsed),
113 + port: parsed.port,
114 + tag: tag
115 + }
106 116
107 117 "https+unix" ->
108 118 %__MODULE__{scheme: :https, host: {:local, parsed.path}, port: 0, tag: tag}
  @@ -49,10 +49,13 @@ defmodule Finch.Pool.Manager do
49 49 @mint_tls_opts [
50 50 :cacertfile,
51 51 :cacerts,
52 + :certs_keys,
53 + :certfile,
52 54 :ciphers,
53 55 :depth,
54 56 :eccs,
55 57 :hibernate_after,
58 + :keyfile,
56 59 :partial_chain,
57 60 :reuse_sessions,
58 61 :secure_renegotiate,
  @@ -98,18 +101,23 @@ defmodule Finch.Pool.Manager do
98 101 defp do_get_pool(registry_name, pool, start_pool?, opts) do
99 102 pool_name = Finch.Pool.to_name(pool)
100 103
101 - case Registry.lookup(registry_name, pool_name) do
104 + case lookup_pool(registry_name, pool_name, opts) do
102 105 [] when start_pool? ->
103 106 maybe_start_pool(registry_name, pool, pool_name, opts)
104 107
105 108 [] ->
106 109 :not_found
107 110
108 - [single] ->
109 - single
111 + pool ->
112 + pool
113 + end
114 + end
110 115
111 - [_ | _] = entries ->
112 - select_pool(entries, opts[:pool_strategy])
116 + defp lookup_pool(registry_name, pool_name, opts) do
117 + case Registry.lookup(registry_name, pool_name) do
118 + [] -> []
119 + [single] -> single
120 + [_ | _] = entries -> select_pool(entries, opts[:pool_strategy])
113 121 end
114 122 end
115 123
  @@ -122,16 +130,12 @@ defmodule Finch.Pool.Manager do
122 130 @spec maybe_start_pool(atom(), Finch.Pool.t(), term(), Access.t()) ::
123 131 {pid(), module()} | :not_found | :not_ready
124 132 defp maybe_start_pool(registry_name, pool, pool_name, opts) do
125 - case Registry.lookup(supervisor_registry_name(registry_name), pool_name) do
126 - [] ->
127 - # No supervisor — pool not configured yet, create on demand
128 - {:ok, config} = Registry.meta(registry_name, :config)
129 - start_pool(pool, pool_name, config)
130 - do_get_pool(registry_name, pool, false, opts)
133 + {:ok, config} = Registry.meta(registry_name, :config)
134 + start_pool(pool, pool_name, config)
131 135
132 - [_ | _] ->
133 - # Supervisor exists but no ready workers
134 - :not_ready
136 + case lookup_pool(registry_name, pool_name, opts) do
137 + [] -> :not_ready
138 + pool -> pool
135 139 end
136 140 end
Loading more files…