Author: fdmanana
Date: Mon Apr 18 19:39:35 2011
New Revision: 1094704
URL: http://svn.apache.org/viewvc?rev=1094704&view=rev
Log:
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/trunk/src/couchdb/couch_httpd_proxy.erl
Modified: couchdb/trunk/src/couchdb/couch_httpd_proxy.erl
URL:
http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_proxy.erl?rev=1094704&r1=1094703&r2=1094704&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_proxy.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_proxy.erl Mon Apr 18 19:39:35 2011
@@ -378,7 +378,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} -> "";
@@ -388,7 +388,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) ->