elixir-plug / plug

Compose web applications with functions
https://hex.pm/packages/plug
Other
2.84k stars 582 forks source link

Allow Plug.SSL.configure/1 to accept all :ssl options #1148

Closed mtrudel closed 1 year ago

mtrudel commented 1 year ago

As originally reported at https://github.com/mtrudel/bandit/issues/130, the implementation of Plug.SSL.configure/1 doesn't actually support all valid :ssl options as the docs state it does. Specifically, bare-atoms such as :inet6, :inet cause Plug.SSL.configure/1 to error out, since it assumes the option list is a well-formed keyword list.

This PR uses the List functions to allow for non-keyword elements to be supported. All non keyword-structured elements are ignored (and preserved).

josevalim commented 1 year ago

Unfortunate but looks good to me! We also need tests with inet/inet6 options. :)

mtrudel commented 1 year ago

Tests added, PR feedback addressed!

mtrudel commented 1 year ago

(Test failure is unrelated - looks like a race)

josevalim commented 1 year ago

:green_heart: :blue_heart: :purple_heart: :yellow_heart: :heart: