aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/test
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2010-12-01 10:24:51 +0100
committerIngela Anderton Andin <[email protected]>2010-12-01 10:24:51 +0100
commit7369151bc24d9d3b0b1ebed19a1a7d0df9101a81 (patch)
treeb34ce11c1aa8ee57d363983d1f8d382ea3a7b64a /lib/inets/test
parentd9a508b6ca18ce3bf76563c89bf452e74fa65d45 (diff)
parentf05d42599f3c8fa3632ca04c21a5f91100275feb (diff)
downloadotp-7369151bc24d9d3b0b1ebed19a1a7d0df9101a81.tar.gz
otp-7369151bc24d9d3b0b1ebed19a1a7d0df9101a81.tar.bz2
otp-7369151bc24d9d3b0b1ebed19a1a7d0df9101a81.zip
Merge branch 'ia/inets/url-encoding/OTP-8940' into dev
* ia/inets/url-encoding/OTP-8940: Changed file error handling to be consistent URL-encoding - add support in client and more usage in server. Also added missing include directory.
Diffstat (limited to 'lib/inets/test')
-rw-r--r--lib/inets/test/httpd_basic_SUITE.erl36
1 files changed, 32 insertions, 4 deletions
diff --git a/lib/inets/test/httpd_basic_SUITE.erl b/lib/inets/test/httpd_basic_SUITE.erl
index f86c1fcb49..9ba2e73942 100644
--- a/lib/inets/test/httpd_basic_SUITE.erl
+++ b/lib/inets/test/httpd_basic_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2007-2009. All Rights Reserved.
+%% Copyright Ericsson AB 2007-2010. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -25,13 +25,16 @@
%% Note: This directive should only be used in test suites.
-compile(export_all).
+-define(URL_START, "http://localhost:").
+
all(doc) ->
["Basic test of httpd."];
all(suite) ->
[
uri_too_long_414,
- header_too_long_413
+ header_too_long_413,
+ escaped_url_in_error_body
].
%%--------------------------------------------------------------------
@@ -131,6 +134,31 @@ header_too_long_413(Config) when is_list(Config) ->
{version, "HTTP/1.1"}]),
inets:stop(httpd, Pid).
+escaped_url_in_error_body(doc) ->
+ ["Test Url-encoding see OTP-8940"];
+escaped_url_in_error_body(suite) ->
+ [];
+escaped_url_in_error_body(Config) when is_list(Config) ->
+ HttpdConf = ?config(httpd_conf, Config),
+ {ok, Pid} = inets:start(httpd, [{port, 0} | HttpdConf]),
+ Info = httpd:info(Pid),
+ Port = proplists:get_value(port, Info),
+ Address = proplists:get_value(bind_address, Info),
+ Path = "/<b>this_is_bold<b>",
+ URL = ?URL_START ++ integer_to_list(Port) ++ Path,
+ EscapedPath = http_uri:encode(Path),
+ {ok, {404, Body}} = httpc:request(get, {URL, []},
+ [{url_encode, true}],
+ [{version, "HTTP/1.0"}, {full_result, false}]),
+ EscapedPath = find_URL_path(string:tokens(Body, " ")),
+ {ok, {404, Body1}} = httpc:request(get, {URL, []}, [],
+ [{version, "HTTP/1.0"}, {full_result, false}]),
+ EscapedPath = find_URL_path(string:tokens(Body1, " ")),
+ inets:stop(httpd, Pid).
-
-
+find_URL_path([]) ->
+ "";
+find_URL_path(["URL", URL | _]) ->
+ URL;
+find_URL_path([_ | Rest]) ->
+ find_URL_path(Rest).