Permalink
Browse files

Merge pull request #6 from gleber/master

Add support for Request:peer_ip/0 and Request:peer_port/0 for webmachine
  • Loading branch information...
2 parents 5330631 + c6fa039 commit 81a9eec6037b69b3a5babf08694e98800abfb5fb @choptastic choptastic committed Aug 11, 2011
Showing with 5 additions and 4 deletions.
  1. +5 −4 src/webmachine_bridge_modules/webmachine_request_bridge.erl
@@ -36,11 +36,12 @@ uri(Req) ->
{_, QueryString, _} = mochiweb_util:urlsplit_path(RawPath),
QueryString.
-peer_ip(_Req) ->
- throw(unsupported).
+peer_ip(Req) ->
+ {ok, Address} = inet_parse:address(wrq:peer(Req)),
+ Address.
-peer_port(_Req) ->
- throw(unsupported).
+peer_port(Req) ->
+ wrq:port(Req).
headers(Req) ->
F = fun(Header) -> wrq:get_req_header(Header, Req) end,

0 comments on commit 81a9eec

Please sign in to comment.