You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2016/07/07 15:48:44 UTC

[2/2] chttpd commit: updated refs/heads/master to 0627357

Handle ssl socket case

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/0627357b
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/0627357b
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/0627357b

Branch: refs/heads/master
Commit: 0627357bfee793dea28f3822e952ddd31601fd92
Parents: 22e9032
Author: Jay Doane <ja...@gmail.com>
Authored: Thu Jul 7 08:40:23 2016 -0700
Committer: Jay Doane <ja...@gmail.com>
Committed: Thu Jul 7 08:40:23 2016 -0700

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


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/0627357b/src/chttpd.erl
----------------------------------------------------------------------
diff --git a/src/chttpd.erl b/src/chttpd.erl
index be4f9db..a6a4671 100644
--- a/src/chttpd.erl
+++ b/src/chttpd.erl
@@ -546,7 +546,10 @@ 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}} = case MochiReq:get(socket) of
+                        {ssl, SslSocket} -> ssl:sockname(SslSocket);
+                        Socket -> inet:sockname(Socket)
+                    end,
                     inet_parse:ntoa(Address) ++ ":" ++ integer_to_list(Port);
                 Value1 ->
                     Value1