Skip to content

Commit 259260f

Browse files
ansdikavgo
authored andcommitted
Improve log message for non-AMQP clients on AMQP port
This is a follow up to #13559 addressing the feedback in #13559 (comment) The improved logs look as follows: ``` openssl s_client -connect localhost:5672 -tls1_3 [info] <0.946.0> accepting AMQP connection [::1]:49321 -> [::1]:5672 [error] <0.946.0> closing AMQP connection [::1]:49321 -> [::1]:5672 (duration: '0ms'): [error] <0.946.0> TLS client detected on non-TLS AMQP port. Ensure the client is connecting to the correct port. ``` ``` curl http://localhost:5672 [info] <0.954.0> accepting AMQP connection [::1]:49402 -> [::1]:5672 [error] <0.954.0> closing AMQP connection [::1]:49402 -> [::1]:5672 (duration: '0ms'): [error] <0.954.0> HTTP GET request detected on AMQP port. Ensure the client is connecting to the correct port ``` ``` telnet localhost 5672 Trying ::1... Connected to localhost. Escape character is '^]'. hello [info] <0.946.0> accepting AMQP connection [::1]:49664 -> [::1]:5672 [error] <0.946.0> closing AMQP connection [::1]:49664 -> [::1]:5672 (duration: '2s'): [error] <0.946.0> client did not start with AMQP protocol header: <<"hello\r\n\r">> ```
1 parent 06e58b5 commit 259260f

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

deps/rabbit/src/rabbit_reader.erl

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,14 +1136,7 @@ handle_input(handshake,
11361136
%% Looks like a TLS client hello.
11371137
refuse_connection(Sock, {bad_header, detected_tls});
11381138
handle_input(handshake, <<Other:8/binary, _/binary>>, #v1{sock = Sock}) ->
1139-
Reason = case Other of
1140-
<<16#16, 16#03, _Ver2, _Len1, _Len2, 16#01, _, _>> ->
1141-
%% Looks like a TLS client hello.
1142-
detected_unexpected_tls_header;
1143-
_ ->
1144-
bad_header
1145-
end,
1146-
refuse_connection(Sock, {Reason, Other});
1139+
refuse_connection(Sock, {bad_header, Other});
11471140
handle_input(Callback, Data, _State) ->
11481141
throw({bad_input, Callback, Data}).
11491142

0 commit comments

Comments
 (0)