diff options
Diffstat (limited to 'lib/inets/test/httpc_proxy_SUITE.erl')
-rw-r--r-- | lib/inets/test/httpc_proxy_SUITE.erl | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/lib/inets/test/httpc_proxy_SUITE.erl b/lib/inets/test/httpc_proxy_SUITE.erl index 02751dfdf4..f7a97c09a9 100644 --- a/lib/inets/test/httpc_proxy_SUITE.erl +++ b/lib/inets/test/httpc_proxy_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2012-2022. All Rights Reserved. +%% Copyright Ericsson AB 2012-2023. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -42,6 +42,8 @@ [self(),?MODULE] ++ begin A end) end). +-define(SSL_NO_VERIFY, {ssl, [{verify, verify_none}]}). + %%-------------------------------------------------------------------- %% Common Test interface functions ----------------------------------- %%-------------------------------------------------------------------- @@ -159,7 +161,7 @@ http_head(Config) when is_list(Config) -> Method = head, URL = url("/index.html", Config), Request = {URL,[]}, - HttpOpts = [], + HttpOpts = [?SSL_NO_VERIFY], Opts = [], {ok,{{_,200,_},[_|_],[]}} = httpc:request(Method, Request, HttpOpts, Opts), @@ -176,13 +178,13 @@ http_get(Config) when is_list(Config) -> Timeout = timer:seconds(1), ConnTimeout = Timeout + timer:seconds(1), - HttpOpts1 = [{timeout,Timeout},{connect_timeout,ConnTimeout}], + HttpOpts1 = [{timeout,Timeout},{connect_timeout,ConnTimeout},?SSL_NO_VERIFY], Opts1 = [], {ok,{{_,200,_},[_|_],[_|_]=B1}} = httpc:request(Method, Request, HttpOpts1, Opts1), inets_test_lib:check_body(B1), - HttpOpts2 = [], + HttpOpts2 = [?SSL_NO_VERIFY], Opts2 = [{body_format,binary}], {ok,{{_,200,_},[_|_],B2}} = httpc:request(Method, Request, HttpOpts2, Opts2), @@ -196,7 +198,7 @@ http_options(Config) when is_list(Config) -> Method = options, URL = url("/index.html", Config), Request = {URL,[]}, - HttpOpts = [], + HttpOpts = [?SSL_NO_VERIFY], Opts = [], {ok,{{_,200,_},Headers,_}} = httpc:request(Method, Request, HttpOpts, Opts), @@ -211,7 +213,7 @@ http_trace(Config) when is_list(Config) -> Method = trace, URL = url("/index.html", Config), Request = {URL,[]}, - HttpOpts = [], + HttpOpts = [?SSL_NO_VERIFY], Opts = [], {ok,{{_,200,_},[_|_],"TRACE "++_}} = httpc:request(Method, Request, HttpOpts, Opts), @@ -227,7 +229,7 @@ http_post(Config) when is_list(Config) -> Method = post, URL = url("/index.html", Config), Request = {URL,[],"text/plain","foobar"}, - HttpOpts = [], + HttpOpts = [?SSL_NO_VERIFY], Opts = [], {ok,{{_,200,_},[_|_],[_|_]}} = httpc:request(Method, Request, HttpOpts, Opts), @@ -244,7 +246,7 @@ http_put(Config) when is_list(Config) -> Content = "<html><body> <h1>foo</h1> <p>bar</p> </body></html>", Request = {URL,[],"html",Content}, - HttpOpts = [], + HttpOpts = [?SSL_NO_VERIFY], Opts = [], {ok,{{_,405,_},[_|_],[_|_]}} = httpc:request(Method, Request, HttpOpts, Opts), @@ -260,7 +262,7 @@ http_delete(Config) when is_list(Config) -> Method = delete, URL = url("/delete.html", Config), Request = {URL,[]}, - HttpOpts = [], + HttpOpts = [?SSL_NO_VERIFY], Opts = [], {ok,{{_,405,_},[_|_],[_|_]}} = httpc:request(Method, Request, HttpOpts, Opts), @@ -276,7 +278,7 @@ http_delete_body(Config) when is_list(Config) -> URL = url("/delete.html", Config), Content = "foo=bar", Request = {URL,[],"application/x-www-form-urlencoded",Content}, - HttpOpts = [], + HttpOpts = [?SSL_NO_VERIFY], Opts = [], {ok,{{_,405,_},[_|_],[_|_]}} = httpc:request(Method, Request, HttpOpts, Opts), @@ -302,7 +304,7 @@ http_headers(Config) when is_list(Config) -> {"Referer", "http://otp.ericsson.se:8000/product/internal"}], Request = {URL,Headers}, - HttpOpts = [], + HttpOpts = [?SSL_NO_VERIFY], Opts = [], {ok,{{_,200,_},[_|_],[_|_]}} = httpc:request(Method, Request, HttpOpts, Opts), @@ -319,7 +321,7 @@ http_proxy_auth(Config) when is_list(Config) -> Method = get, URL = url("/index.html", Config), Request = {URL,[]}, - HttpOpts = [{proxy_auth,{"foo","bar"}}], + HttpOpts = [{proxy_auth,{"foo","bar"}}, ?SSL_NO_VERIFY], Opts = [], {ok,{{_,200,_},[_|_],[_|_]}} = httpc:request(Method, Request, HttpOpts, Opts), @@ -333,7 +335,7 @@ http_doesnotexist(Config) when is_list(Config) -> Method = get, URL = url("/doesnotexist.html", Config), Request = {URL,[]}, - HttpOpts = [{proxy_auth,{"foo","bar"}}], + HttpOpts = [{proxy_auth,{"foo","bar"}}, ?SSL_NO_VERIFY], Opts = [], {ok,{{_,404,_},[_|_],[_|_]}} = httpc:request(Method, Request, HttpOpts, Opts), @@ -347,7 +349,7 @@ http_stream(Config) when is_list(Config) -> Method = get, URL = url("/index.html", Config), Request = {URL,[]}, - HttpOpts = [], + HttpOpts = [?SSL_NO_VERIFY], Opts1 = [{body_format,binary}], {ok,{{_,200,_},[_|_],Body}} = @@ -385,12 +387,12 @@ http_emulate_lower_versions(Config) when is_list(Config) -> Request = {URL,[]}, Opts = [], - HttpOpts1 = [{version,"HTTP/1.0"}], + HttpOpts1 = [{version,"HTTP/1.0"},?SSL_NO_VERIFY], {ok,{{_,200,_},[_|_],[_|_]=B2}} = httpc:request(Method, Request, HttpOpts1, Opts), inets_test_lib:check_body(B2), - HttpOpts2 = [{version,"HTTP/1.1"}], + HttpOpts2 = [{version,"HTTP/1.1"},?SSL_NO_VERIFY], {ok,{{_,200,_},[_|_],[_|_]=B3}} = httpc:request(Method, Request, HttpOpts2, Opts), inets_test_lib:check_body(B3), @@ -406,7 +408,7 @@ http_not_modified_otp_6821(Config) when is_list(Config) -> Opts = [], Request1 = {URL,[]}, - HttpOpts1 = [], + HttpOpts1 = [?SSL_NO_VERIFY], {ok,{{_,200,_},ReplyHeaders,[_|_]}} = httpc:request(Method, Request1, HttpOpts1, Opts), ETag = header_value("etag", ReplyHeaders), @@ -416,7 +418,7 @@ http_not_modified_otp_6821(Config) when is_list(Config) -> {URL, [{"If-None-Match",ETag}, {"If-Modified-Since",LastModified}]}, - HttpOpts2 = [{timeout,15000}], % Limit wait for bug result + HttpOpts2 = [{timeout,15000}, ?SSL_NO_VERIFY], % Limit wait for bug result {ok,{{_,304,_},_,[]}} = % Page Unchanged httpc:request(Method, Request2, HttpOpts2, Opts), @@ -440,7 +442,7 @@ https_connect_error(Config) when is_list(Config) -> URL = "https://" ++ HttpServer ++ ":" ++ integer_to_list(HttpPort) ++ "/index.html", Opts = [], - HttpOpts = [], + HttpOpts = [?SSL_NO_VERIFY], Request = {URL,[]}, {error,{failed_connect,[_,{tls,_,_}]}} = httpc:request(Method, Request, HttpOpts, Opts). @@ -453,7 +455,7 @@ http_timeout(Config) when is_list(Config) -> URL = url("/index.html", Config), Request = {URL,[]}, Timeout = timer:seconds(1), - HttpOpts1 = [{timeout, Timeout}, {connect_timeout, 0}], + HttpOpts1 = [{timeout, Timeout}, {connect_timeout, 0}, ?SSL_NO_VERIFY], {error, {failed_connect, [{to_address,{"localhost",8000}}, @@ -510,14 +512,14 @@ make_cert_files(Config) -> ServerFileBase = filename:join([proplists:get_value(priv_dir, Config), "server"]), GenCertData = public_key:pkix_test_data(#{server_chain => - #{root => [{key, inets_test_lib:hardcode_rsa_key(1)}], - intermediates => [[{key, inets_test_lib:hardcode_rsa_key(2)}]], - peer => [{key, inets_test_lib:hardcode_rsa_key(3)} + #{root => [{key, inets_test_lib:hardcode_rsa_key(1)}, {digest, sha256}], + intermediates => [[{key, inets_test_lib:hardcode_rsa_key(2)}, {digest, sha256}]], + peer => [{key, inets_test_lib:hardcode_rsa_key(3)}, {digest, sha256} ]}, client_chain => - #{root => [{key, inets_test_lib:hardcode_rsa_key(4)}], - intermediates => [[{key, inets_test_lib:hardcode_rsa_key(5)}]], - peer => [{key, inets_test_lib:hardcode_rsa_key(6)}]}}), + #{root => [{key, inets_test_lib:hardcode_rsa_key(4)},{digest, sha256}], + intermediates => [[{key, inets_test_lib:hardcode_rsa_key(5)}, {digest, sha256}]], + peer => [{key, inets_test_lib:hardcode_rsa_key(6)}, {digest, sha256}]}}), inets_test_lib:gen_pem_config_files(GenCertData, ClientFileBase, ServerFileBase), ok. |