Skip to content

Commit

Permalink
Merge pull request #4753 from apache/revert-peer-change
Browse files Browse the repository at this point in the history
Revert "print peer port in http log"
  • Loading branch information
rnewson authored Sep 8, 2023
2 parents 83e39b6 + 3b601f2 commit f73e68d
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions src/chttpd/src/chttpd.erl
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ handle_request_int(MochiReq) ->
P
end,

Peer = peer(MochiReq),
Peer = MochiReq:get(peer),

Method1 =
case MochiReq:get(method) of
Expand Down Expand Up @@ -1478,23 +1478,6 @@ get_user(#httpd{user_ctx = #user_ctx{name = User}}) ->
get_user(#httpd{user_ctx = undefined}) ->
"undefined".

peer(MochiReq) ->
Socket = MochiReq:get(socket),
case mochiweb_socket:peername(Socket) of
{ok, {{O1, O2, O3, O4}, Port}} ->
io_lib:format(
"~B.~B.~B.~B:~B",
[O1, O2, O3, O4, Port]
);
{ok, {{O1, O2, O3, O4, O5, O6, O7, O8}, Port}} ->
io_lib:format(
"~B.~B.~B.~B.~B.~B.~B.~B:~B",
[O1, O2, O3, O4, O5, O6, O7, O8, Port]
);
{error, _Reason} ->
MochiReq:get(peer)
end.

-ifdef(TEST).

-include_lib("eunit/include/eunit.hrl").
Expand Down

0 comments on commit f73e68d

Please sign in to comment.