Skip to content

Commit 81b76ed

Browse files
committed
Use get_peer_data function
1 parent 8f0a483 commit 81b76ed

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

lib/sentry/plug.ex

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ if Code.ensure_loaded?(Plug) do
171171
headers: handle_data(conn, header_scrubber),
172172
env: %{
173173
"REMOTE_ADDR" => remote_address(conn.remote_ip),
174-
"REMOTE_PORT" => remote_port(conn.peer),
174+
"REMOTE_PORT" => Plug.Conn.get_peer_data(conn).port,
175175
"SERVER_NAME" => conn.host,
176176
"SERVER_PORT" => conn.port,
177177
"REQUEST_ID" => Plug.Conn.get_resp_header(conn, request_id) |> List.first()
@@ -185,8 +185,6 @@ if Code.ensure_loaded?(Plug) do
185185
|> to_string()
186186
end
187187

188-
defp remote_port({_, port}), do: port
189-
190188
defp handle_data(_conn, nil), do: %{}
191189

192190
defp handle_data(conn, {module, fun}) do

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ defmodule Sentry.Mixfile do
2727
{:hackney, "~> 1.8 or 1.6.5"},
2828
{:uuid, "~> 1.0"},
2929
{:poison, "~> 1.5 or ~> 2.0 or ~> 3.0"},
30-
{:plug, "~> 1.0", optional: true},
30+
{:plug, "~> 1.6", optional: true},
3131
{:phoenix, "~> 1.3", optional: true},
3232
{:dialyxir, "> 0.0.0", only: [:dev], runtime: false},
3333
{:ex_doc, "~> 0.18.0", only: :dev},

0 commit comments

Comments
 (0)