summaryrefslogtreecommitdiff
path: root/src/couchdb
diff options
context:
space:
mode:
authorFilipe David Borba Manana <fdmanana@apache.org>2011-04-13 11:06:16 +0000
committerFilipe David Borba Manana <fdmanana@apache.org>2011-04-13 11:06:16 +0000
commit1215e205668431d7a916c945285761280489e638 (patch)
tree1cf7db641ea5a64a60a4107a8cf1e17edfe03770 /src/couchdb
parent01d9ef20f62bac0320ac7dc83192c29889720fa2 (diff)
Backported revision 1091711 from trunk
Add support for replication over IPv6 (part 2) On redirect, enclose the IPv6 address between square brackets (RFC 2732). Closes COUCHDB-665. git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1091742 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb')
-rw-r--r--src/couchdb/couch_rep_httpc.erl10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/couchdb/couch_rep_httpc.erl b/src/couchdb/couch_rep_httpc.erl
index cfd815b4..bbe390a9 100644
--- a/src/couchdb/couch_rep_httpc.erl
+++ b/src/couchdb/couch_rep_httpc.erl
@@ -128,7 +128,7 @@ redirect_url(RespHeaders, OrigUrl) ->
MochiHeaders = mochiweb_headers:make(RespHeaders),
RedUrl = mochiweb_headers:get_value("Location", MochiHeaders),
#url{
- host = Host, port = Port,
+ host = Host, host_type = HostType, port = Port,
path = Path, protocol = Proto
} = ibrowse_lib:parse_url(RedUrl),
#url{username = User, password = Passwd} = ibrowse_lib:parse_url(OrigUrl),
@@ -138,7 +138,13 @@ redirect_url(RespHeaders, OrigUrl) ->
false ->
[]
end,
- atom_to_list(Proto) ++ "://" ++ Creds ++ Host ++ ":" ++
+ HostPart = case HostType of
+ ipv6_address ->
+ "[" ++ Host ++ "]";
+ _ ->
+ Host
+ end,
+ atom_to_list(Proto) ++ "://" ++ Creds ++ HostPart ++ ":" ++
integer_to_list(Port) ++ Path.
full_url(#http_db{url=Url} = Req) when is_binary(Url) ->