Allow atom header keys in inform/3#1318
Merged
Merged
Conversation
|
Same error [error] ** (ArgumentError) errors were found at the given arguments:
* 1st argument: not a binary
(stdlib 8.0.1) :binary.match(:upgrade, [":", "\n", "\r", <<0>>])
(plug 1.20.0) lib/plug/conn.ex:1994: Plug.Conn.validate_header_key_value!/2
(plug 1.20.0) lib/plug/conn.ex:1440: anonymous fn/2 in Plug.Conn.adapter_inform/3
(elixir 1.20.2) lib/enum.ex:2622: Enum."-reduce/3-lists^foldl/2-0-"/3
(plug 1.20.0) lib/plug/conn.ex:1439: Plug.Conn.adapter_inform/3
(plug 1.20.0) lib/plug/conn.ex:1393: Plug.Conn.inform/3
(bandit 1.12.0) lib/bandit/websocket/handshake.ex:28: Bandit.WebSocket.Handshake.do_handshake/3
(bandit 1.12.0) lib/bandit/pipeline.ex:150: Bandit.Pipeline.maybe_upgrade!/1
(bandit 1.12.0) lib/bandit/pipeline.ex:43: Bandit.Pipeline.run/5
(bandit 1.12.0) lib/bandit/http1/handler.ex:13: Bandit.HTTP1.Handler.handle_data/3
(bandit 1.12.0) lib/bandit/delegating_handler.ex:18: Bandit.DelegatingHandler.handle_data/3
(bandit 1.12.0) lib/bandit/delegating_handler.ex:8: Bandit.DelegatingHandler.handle_continue/2
(stdlib 8.0.1) gen_server.erl:2424: :gen_server.try_handle_continue/3
(stdlib 8.0.1) gen_server.erl:2291: :gen_server.loop/4
(stdlib 8.0.1) proc_lib.erl:333: :proc_lib.init_p_do_apply/3 |
Member
|
Nowhere in Plug we assume headers can be atoms and I am not sure we should carve an exception here. :( |
Member
|
Ignore me, we document it as a keyword list. |
josevalim
reviewed
Jun 23, 2026
Member
|
💚 💙 💜 💛 ❤️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello plug team!
I've got an issue after upgrading plug, latest plug with latest bandit (1.12.0):
Bandit websocket handshake calls
Plug.Conn.inform(conn, 101, [{:upgrade, "websocket"}, ...]), passing the header key as an atom. Newest plug onvalidate_header_key_value!/2calls:binary.match/2on the key without coercion to binary, so atoms blow up.Thank you!