Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Fix xff cn username" #2252

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions apps/vmq_server/src/vmq_websocket.erl
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,8 @@ init(Req, Opts) ->
xff_cn_header, Opts, <<"x-ssl-client-cn">>
),
HN = ensure_binary(CNHeaderName),
case cowboy_req:header(HN, Req0) of
undefined ->
{vmq_cowboy_websocket, Req0,
{error, no_xff_cn_username}};
<<>> ->
{vmq_cowboy_websocket, Req0,
{error, no_xff_cn_username}};
XFFCN ->
FsmMod:init(Peer, [{preauth, XFFCN} | Opts])
end
XFFCN = cowboy_req:header(HN, Req),
FsmMod:init(Peer, [{preauth, XFFCN} | Opts])
end;
true ->
case ProxyInfo0 of
Expand Down Expand Up @@ -150,8 +142,7 @@ init(Req, Opts) ->
{vmq_cowboy_websocket, Req, {error, unsupported_protocol}}
end.

websocket_init({error, E}) ->
?LOG_DEBUG("websocket init error ~p~n", [E]),
websocket_init({error, unsupported_protocol}) ->
_ = vmq_metrics:incr_socket_open(),
{stop, #state{fsm_state = terminated}};
websocket_init(State) ->
Expand Down
1 change: 0 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
- Protect against empty XFF CN/Username
- Add simple options to HTTP health listener (health/ping)
- Remove deprecated allow_multiple_sessions
- Improve systemd support: Add support of systemd-notify
Expand Down
Loading