Skip to content

Commit d530fb3

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 42d1393 commit d530fb3

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

deps/rabbit/src/rabbit_reader.erl

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,17 +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-
<<"GET ", _URL/binary>> ->
1144-
%% Looks like an HTTP request.
1145-
detected_unexpected_http_header;
1146-
_ ->
1147-
bad_header
1148-
end,
1149-
refuse_connection(Sock, {Reason, Other});
1139+
refuse_connection(Sock, {bad_header, Other});
11501140
handle_input(Callback, Data, _State) ->
11511141
throw({bad_input, Callback, Data}).
11521142

0 commit comments

Comments
 (0)