diff options
author | Ingela Anderton Andin <[email protected]> | 2016-12-13 18:23:23 +0100 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2016-12-14 18:02:38 +0100 |
commit | 3018e0c0df040524de17cba97314f32e9c63214f (patch) | |
tree | 00b3557b91fea8df8408beafc3382d7ef32ab719 /lib/inets/test | |
parent | 3473ecd83a7bbe7e0bebb865f25dddb93e3bf10f (diff) | |
download | otp-3018e0c0df040524de17cba97314f32e9c63214f.tar.gz otp-3018e0c0df040524de17cba97314f32e9c63214f.tar.bz2 otp-3018e0c0df040524de17cba97314f32e9c63214f.zip |
inets: httpc - Correct redirection host header
RFC2616 Sect 14.23: The Host request-header field specifies the
Internet host AND port number.
Diffstat (limited to 'lib/inets/test')
-rw-r--r-- | lib/inets/test/httpc_SUITE.erl | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/inets/test/httpc_SUITE.erl b/lib/inets/test/httpc_SUITE.erl index a64ae2b87c..b2d0ce7631 100644 --- a/lib/inets/test/httpc_SUITE.erl +++ b/lib/inets/test/httpc_SUITE.erl @@ -125,6 +125,7 @@ only_simulated() -> redirect_see_other, redirect_temporary_redirect, port_in_host_header, + redirect_port_in_host_header, relaxed ]. @@ -1102,6 +1103,12 @@ port_in_host_header(Config) when is_list(Config) -> Request = {url(group_name(Config), "/ensure_host_header_with_port.html", Config), []}, {ok, {{_, 200, _}, _, Body}} = httpc:request(get, Request, [], []), inets_test_lib:check_body(Body). +%%------------------------------------------------------------------------- +redirect_port_in_host_header(Config) when is_list(Config) -> + + Request = {url(group_name(Config), "/redirect_ensure_host_header_with_port.html", Config), []}, + {ok, {{_, 200, _}, _, Body}} = httpc:request(get, Request, [], []), + inets_test_lib:check_body(Body). %%------------------------------------------------------------------------- timeout_memory_leak() -> @@ -1680,6 +1687,12 @@ handle_uri(_,"/ensure_host_header_with_port.html",_,Headers,_,_) -> "HTTP/1.1 500 Internal Server Error\r\n" ++ "Content-Length:" ++ Len ++ "\r\n\r\n" ++ B end; +handle_uri(_,"/redirect_ensure_host_header_with_port.html",Port,_,Socket,_) -> + NewUri = url_start(Socket) ++ + integer_to_list(Port) ++ "/ensure_host_header_with_port.html", + "HTTP/1.1 302 Found \r\n" ++ + "Location:" ++ NewUri ++ "\r\n" ++ + "Content-Length:0\r\n\r\n"; handle_uri(_,"/300.html",Port,_,Socket,_) -> NewUri = url_start(Socket) ++ |