From c30eb71556cd569fea82de2a1c2a5a17e71650c1 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Tue, 18 Oct 2011 17:47:53 +0200 Subject: [httpc] Wrong Host header in IPv6 HTTP requests. When a URI with a IPv6 host is parsed, the brackets that encapsulates the nnn is removed. This value is then supplied as the host header. This can cause problems with some servers. A workaround for this is to use headers_as_is and provide the host header with the requst call To solve this a new option has been added, ipv6_host_with_brackets. This option specifies if the host value of the host header shall include the branckets or not. By default, it does not (as before). OTP-9628 --- lib/inets/test/httpc_SUITE.erl | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'lib/inets/test') diff --git a/lib/inets/test/httpc_SUITE.erl b/lib/inets/test/httpc_SUITE.erl index f95fb93669..d9432c5127 100644 --- a/lib/inets/test/httpc_SUITE.erl +++ b/lib/inets/test/httpc_SUITE.erl @@ -1878,8 +1878,17 @@ parse_url(suite) -> []; parse_url(Config) when is_list(Config) -> %% ipv6 - {http,[],"2010:836B:4179::836B:4179",80,"/foobar.html",[]} - = http_uri:parse("http://[2010:836B:4179::836B:4179]/foobar.html"), + {http,[],"2010:836B:4179::836B:4179",80,"/foobar.html",[]} = + http_uri:parse("http://[2010:836B:4179::836B:4179]/foobar.html"), + {http,[],"[2010:836B:4179::836B:4179]",80,"/foobar.html",[]} = + http_uri:parse("http://[2010:836B:4179::836B:4179]/foobar.html", + [{ipv6_host_with_brackets, true}]), + {http,[],"2010:836B:4179::836B:4179",80,"/foobar.html",[]} = + http_uri:parse("http://[2010:836B:4179::836B:4179]/foobar.html", + [{ipv6_host_with_brackets, false}]), + {http,[],"2010:836B:4179::836B:4179",80,"/foobar.html",[]} = + http_uri:parse("http://[2010:836B:4179::836B:4179]/foobar.html", + [{foo, false}]), {error, {malformed_url,"http://2010:836B:4179::836B:4179/foobar.html"}} = http_uri:parse("http://2010:836B:4179::836B:4179/foobar.html"), @@ -1914,6 +1923,8 @@ parse_url(Config) when is_list(Config) -> http_uri:parse("http://www.somedomain.com/%25abc"), {http,[],"www.somedomain.com",80,"/%25abc", "?foo=bar"} = http_uri:parse("http://www.somedomain.com/%25abc?foo=bar"), + + ok. -- cgit v1.2.3