couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject svn commit: r1091742 - /couchdb/branches/1.1.x/src/couchdb/couch_rep_httpc.erl
Date Wed, 13 Apr 2011 11:06:16 GMT
Author: fdmanana
Date: Wed Apr 13 11:06:16 2011
New Revision: 1091742

URL: http://svn.apache.org/viewvc?rev=1091742&view=rev
Log:
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.

Modified:
    couchdb/branches/1.1.x/src/couchdb/couch_rep_httpc.erl

Modified: couchdb/branches/1.1.x/src/couchdb/couch_rep_httpc.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/1.1.x/src/couchdb/couch_rep_httpc.erl?rev=1091742&r1=1091741&r2=1091742&view=diff
==============================================================================
--- couchdb/branches/1.1.x/src/couchdb/couch_rep_httpc.erl (original)
+++ couchdb/branches/1.1.x/src/couchdb/couch_rep_httpc.erl Wed Apr 13 11:06:16 2011
@@ -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) ->



Mime
View raw message