Skip to content

Commit ad478de

Browse files
committed
Always disable unsupported server push responses
Since we don not handle this response type HTTP2-enabled connections to a server sending server push responses always lead to crashes. Fixes: #325
1 parent 33e9633 commit ad478de

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

lib/finch.ex

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,13 @@ defmodule Finch do
262262

263263
conn_opts = valid[:conn_opts] |> List.wrap()
264264

265+
# Only relevant to HTTP2, but just gracefully ignored in HTTP1.
266+
# Since we cannot handle server push responses, we need to disable the feature.
267+
client_settings =
268+
conn_opts
269+
|> Keyword.get(:client_settings, [])
270+
|> Keyword.put(:enable_push, false)
271+
265272
ssl_key_log_file =
266273
Keyword.get(conn_opts, :ssl_key_log_file) || System.get_env("SSLKEYLOGFILE")
267274

@@ -272,6 +279,7 @@ defmodule Finch do
272279
|> Keyword.put(:ssl_key_log_file_device, ssl_key_log_file_device)
273280
|> Keyword.put(:transport_opts, transport_opts)
274281
|> Keyword.put(:protocols, valid[:protocols])
282+
|> Keyword.put(:client_settings, client_settings)
275283

276284
# TODO: Remove :protocol on v0.18
277285
mod =

0 commit comments

Comments
 (0)