couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rand...@apache.org
Subject git commit: fix couch_httpd:host_for_request/1 for ssl
Date Mon, 09 Jan 2012 07:33:04 GMT
Updated Branches:
  refs/heads/master 0ebfd2249 -> 1e284b979


fix couch_httpd:host_for_request/1 for ssl


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

Branch: refs/heads/master
Commit: 1e284b979566a0bc4f5c002365b147c19f0b9efb
Parents: 0ebfd22
Author: Randall Leeds <randall@apache.org>
Authored: Sun Jan 8 23:17:33 2012 -0800
Committer: Randall Leeds <randall@apache.org>
Committed: Sun Jan 8 23:21:21 2012 -0800

----------------------------------------------------------------------
 src/couchdb/couch_httpd.erl |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/1e284b97/src/couchdb/couch_httpd.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl
index be121cb..9b59f71 100644
--- a/src/couchdb/couch_httpd.erl
+++ b/src/couchdb/couch_httpd.erl
@@ -473,7 +473,10 @@ host_for_request(#httpd{mochi_req=MochiReq}) ->
         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


Mime
View raw message