nitrogen / simple_bridge

A simple, standardized interface library to Erlang HTTP Servers.
MIT License
112 stars 76 forks source link

SSL PeerName YAWs #24

Closed stuartT4 closed 11 years ago

stuartT4 commented 11 years ago

Hi,

Please could the peer_ip/1 function be updated to include support for SSL Sockets.

The Following code is the best way I could think to update for SSL sockets.

peer_ip(Arg) -> Socket = socket(Arg), case catch inet:peername(Socket) of {ok, {IP, Port}} -> IP; -> {ok, {IP, _Port}} = ssl:peername(Socket) end, IP.

stuartT4 commented 11 years ago

I have confirmed this fix works.

choptastic commented 11 years ago

Thanks! I employed a fix applied elsewhere similarly: https://github.com/nitrogen/simple_bridge/commit/006d7a581d1401d271eba7528bc62533a402b47d

Please let me know if there are any issues with it.

stuartT4 commented 11 years ago

Thanks :) that fixes the issue.