aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http_req.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/cowboy_http_req.erl')
-rw-r--r--src/cowboy_http_req.erl3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cowboy_http_req.erl b/src/cowboy_http_req.erl
index 1938bc7..3dcac2f 100644
--- a/src/cowboy_http_req.erl
+++ b/src/cowboy_http_req.erl
@@ -44,6 +44,9 @@ version(Req) ->
-spec peer(Req::#http_req{})
-> {{Address::ip_address(), Port::port_number()}, Req::#http_req{}}.
+peer(Req=#http_req{socket=Socket, transport=Transport, peer=undefined}) ->
+ {ok, Peer} = Transport:peername(Socket),
+ {Peer, Req#http_req{peer=Peer}};
peer(Req) ->
{Req#http_req.peer, Req}.