Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Handle SSL socket in peer_ip/1 and peer_port/1 of inets_request_bridge #10

Merged
merged 1 commit into from

2 participants

@hji

No description provided.

@choptastic choptastic merged commit 9fc7513 into nitrogen:master
@choptastic
Owner

Thanks Jeno!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 16 additions and 2 deletions.
  1. +16 −2 src/inets_bridge_modules/inets_request_bridge.erl
View
18 src/inets_bridge_modules/inets_request_bridge.erl
@@ -31,12 +31,26 @@ uri(Req) ->
peer_ip(Req) ->
Socket = Req#mod.socket,
- {ok, {IP, _Port}} = inet:peername(Socket),
+ {ok, {IP, _Port}} =
+ case Socket of
+ S when is_tuple(S),
+ element(1, S) =:= sslsocket ->
+ ssl:peername(Socket);
+ _ ->
+ inet:peername(Socket)
+ end,
IP.
peer_port(Req) ->
Socket = Req#mod.socket,
- {ok, {_IP, Port}} = inet:peername(Socket),
+ {ok, {_IP, Port}} =
+ case Socket of
+ S when is_tuple(S),
+ element(1, S) =:= sslsocket ->
+ ssl:peername(Socket);
+ _ ->
+ inet:peername(Socket)
+ end,
Port.
headers(Req) ->
Something went wrong with that request. Please try again.