From 8af0b6f622b3f36cabd548c685971c19fd890ec2 Mon Sep 17 00:00:00 2001 From: Filipe David Borba Manana Date: Mon, 18 Apr 2011 19:40:36 +0000 Subject: Merged revision 1094704 from trunk couch_httpd_proxy: IPv6 addresses must be surrounded by square brackets As dictacted by RFC 2732. IPv6 support was enabled by ibrowse 2.2.0. git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1094706 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_httpd_proxy.erl | 10 ++++++++-- 1 file 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) -> -- cgit v1.2.3