couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject chttpd commit: updated refs/heads/master to 59bb3f2
Date Wed, 29 Jun 2016 06:58:36 GMT
Repository: couchdb-chttpd
Updated Branches:
  refs/heads/master 21be89816 -> 59bb3f239


Call appropriate sockname function for socket type

COUCHDB: 3049


Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/59bb3f23
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/59bb3f23
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/59bb3f23

Branch: refs/heads/master
Commit: 59bb3f239aa61e5cf4441e870dda25543d3b3720
Parents: 21be898
Author: Jay Doane <jay.s.doane@gmail.com>
Authored: Tue Jun 28 12:39:19 2016 -0700
Committer: Jay Doane <jay.s.doane@gmail.com>
Committed: Tue Jun 28 12:39:19 2016 -0700

----------------------------------------------------------------------
 src/chttpd.erl | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/59bb3f23/src/chttpd.erl
----------------------------------------------------------------------
diff --git a/src/chttpd.erl b/src/chttpd.erl
index e41829e..8a42e62 100644
--- a/src/chttpd.erl
+++ b/src/chttpd.erl
@@ -546,7 +546,7 @@ absolute_uri(#httpd{mochi_req=MochiReq, absolute_uri = undefined}, Path)
->
         undefined ->
             case MochiReq:get_header_value("Host") of
                 undefined ->
-                    {ok, {Address, Port}} = inet:sockname(MochiReq:get(socket)),
+                    {ok, {Address, Port}} = sockname(MochiReq:get(socket)),
                     inet_parse:ntoa(Address) ++ ":" ++ integer_to_list(Port);
                 Value1 ->
                     Value1
@@ -575,6 +575,11 @@ absolute_uri(#httpd{mochi_req=MochiReq, absolute_uri = undefined}, Path)
->
 absolute_uri(#httpd{absolute_uri = URI}, Path) ->
     URI ++ Path.
 
+sockname(Socket) when is_pid(Socket) ->
+    inet:sockname(Socket);
+sockname(Socket) when is_tuple(Socket) -> % is_tuple since ssl_api.hrl is not exposed
+    ssl:sockname(Socket).
+
 unquote(UrlEncodedString) ->
     mochiweb_util:unquote(UrlEncodedString).
 


Mime
View raw message