couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject svn commit: r1094706 - /couchdb/branches/1.1.x/src/couchdb/couch_httpd_proxy.erl
Date Mon, 18 Apr 2011 19:40:36 GMT
Author: fdmanana
Date: Mon Apr 18 19:40:36 2011
New Revision: 1094706

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


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

Modified: couchdb/branches/1.1.x/src/couchdb/couch_httpd_proxy.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/1.1.x/src/couchdb/couch_httpd_proxy.erl?rev=1094706&r1=1094705&r2=1094706&view=diff
==============================================================================
--- couchdb/branches/1.1.x/src/couchdb/couch_httpd_proxy.erl (original)
+++ couchdb/branches/1.1.x/src/couchdb/couch_httpd_proxy.erl Mon Apr 18 19:40:36 2011
@@ -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, pa
         "/" ++ _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) ->



Mime
View raw message