summaryrefslogtreecommitdiff
path: root/src/couchdb
diff options
context:
space:
mode:
authorFilipe David Borba Manana <fdmanana@apache.org>2011-04-18 19:40:36 +0000
committerFilipe David Borba Manana <fdmanana@apache.org>2011-04-18 19:40:36 +0000
commit8af0b6f622b3f36cabd548c685971c19fd890ec2 (patch)
treeefcb5973d7e3bb148c0e6f692bf96991e651d48d /src/couchdb
parent928e6e1522fadb08cb38329143ad84bf548c5172 (diff)
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
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) ->