summaryrefslogtreecommitdiff
path: root/src/couchdb
diff options
context:
space:
mode:
Diffstat (limited to 'src/couchdb')
-rw-r--r--src/couchdb/couch_httpd_proxy.erl10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/couchdb/couch_httpd_proxy.erl b/src/couchdb/couch_httpd_proxy.erl
index ad83f1db..65e3e432 100644
--- a/src/couchdb/couch_httpd_proxy.erl
+++ b/src/couchdb/couch_httpd_proxy.erl
@@ -383,7 +383,7 @@ join_url_path(Src, Dst) ->
Src2 ++ "/" ++ Dst2.
-url_to_url(#url{host=Host, port=Port, path=Path, protocol=Proto}) ->
+url_to_url(#url{host=Host, port=Port, path=Path, protocol=Proto} = Url) ->
LPort = case {Proto, Port} of
{http, 80} -> "";
{https, 443} -> "";
@@ -393,7 +393,13 @@ url_to_url(#url{host=Host, port=Port, path=Path, protocol=Proto}) ->
"/" ++ _RestPath -> Path;
_ -> "/" ++ Path
end,
- atom_to_list(Proto) ++ "://" ++ Host ++ LPort ++ LPath.
+ HostPart = case Url#url.host_type of
+ ipv6_address ->
+ "[" ++ Host ++ "]";
+ _ ->
+ Host
+ end,
+ atom_to_list(Proto) ++ "://" ++ HostPart ++ LPort ++ LPath.
body_length(Headers) ->