Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
4652-ssl-Make-sure-to-get-all-data-from-the-por...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 4652-ssl-Make-sure-to-get-all-data-from-the-port.patch of Package erlang
From 17e79a469759cbf0363427c22459536c9895c9d5 Mon Sep 17 00:00:00 2001 From: Ingela Anderton Andin <ingela@erlang.org> Date: Fri, 14 Jan 2022 09:20:38 +0100 Subject: [PATCH 2/2] ssl: Make sure to get all data from the port --- lib/ssl/test/ssl_test_lib.erl | 40 ++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/lib/ssl/test/ssl_test_lib.erl b/lib/ssl/test/ssl_test_lib.erl index 628e7119ba..2c4fa77b33 100644 --- a/lib/ssl/test/ssl_test_lib.erl +++ b/lib/ssl/test/ssl_test_lib.erl @@ -719,6 +719,7 @@ start_openssl_server(Mode, Args0, Config) -> init_openssl_server(openssl, _, Options) -> DefaultVersions = default_tls_version(Options), [Version | _] = proplists:get_value(versions, Options, DefaultVersions), + DOpenssl = proplists:get_value(debug_openssl, Options, false), Port = inet_port(node()), Pid = proplists:get_value(from, Options), @@ -730,7 +731,7 @@ init_openssl_server(openssl, _, Options) -> CertArgs = openssl_cert_options(Options, server), AlpnArgs = openssl_alpn_options(proplists:get_value(alpn, Options, undefined)), NpnArgs = openssl_npn_options(proplists:get_value(np, Options, undefined)), - Debug = openssl_debug_options(PrivDir), + Debug = openssl_debug_options(PrivDir, DOpenssl), Args0 = case Groups0 of undefined -> @@ -775,7 +776,7 @@ init_openssl_server(Mode, ResponderPort, Options) when Mode == openssl_ocsp orel "-status_verbose", "-status_url", "http://127.0.0.1:" ++ erlang:integer_to_list(ResponderPort), - version_flag(Version)] ++ CertArgs ++ ["-msg", "-debug"] + version_flag(Version)] ++ CertArgs ++ openssl_dtls_opt(GroupName), SslPort = portable_open_port(Exe, Args), @@ -2160,6 +2161,7 @@ ecc_test_error(COpts, SOpts, CECCOpts, SECCOpts, Config) -> start_client(openssl, Port, ClientOpts, Config) -> Version = protocol_version(Config), Exe = "openssl", + DOpenssl = proplists:get_value(debug_openssl, ClientOpts, false), Ciphers = proplists:get_value(ciphers, ClientOpts, ssl:cipher_suites(default,Version)), Groups0 = proplists:get_value(groups, ClientOpts), CertArgs = openssl_cert_options(ClientOpts, client), @@ -2171,7 +2173,7 @@ start_client(openssl, Port, ClientOpts, Config) -> SessionArgs = proplists:get_value(session_args, ClientOpts, []), HostName = proplists:get_value(hostname, ClientOpts, net_adm:localhost()), SNI = openssl_sni(proplists:get_value(server_name_indication, ClientOpts, undefined)), - Debug = openssl_debug_options(), + Debug = openssl_debug_options(DOpenssl), Exe = "openssl", Args0 = case Groups0 of @@ -2265,7 +2267,8 @@ start_server(openssl, ClientOpts, ServerOpts, Config) -> Groups0 = proplists:get_value(groups, ServerOpts), SigAlgs = proplists:get_value(openssl_sigalgs, Config, undefined), SessionArgs = proplists:get_value(session_args, Config, []), - Debug = openssl_debug_options(), + DOpenssl = proplists:get_value(debug_openssl, ServerOpts, false), + Debug = openssl_debug_options(DOpenssl), Args = case Groups0 of undefined -> @@ -2345,16 +2348,20 @@ openssl_sni(disable) -> openssl_sni(ServerName) -> ["-servername", ServerName]. -openssl_debug_options() -> - ["-msg", "-debug"]. +openssl_debug_options(true) -> + ["-msg", "-debug"]; +openssl_debug_options(false) -> + []. %% -openssl_debug_options(PrivDir) -> +openssl_debug_options(PrivDir, true) -> case is_keylogfile_supported() of true -> ["-msg", "-debug","-keylogfile", PrivDir ++ "keylog"]; false -> ["-msg", "-debug"] - end. + end; +openssl_debug_options(_, false) -> + []. is_keylogfile_supported() -> [{_,_, Bin}] = crypto:info_lib(), @@ -3345,10 +3352,23 @@ portable_open_port(Exe, Args) -> portable_cmd(Exe, Args) -> Port = portable_open_port(Exe, Args), + collect_port_data(Port). + +collect_port_data(Port) -> + collect_port_data(Port, []). + +collect_port_data(Port, Acc) -> receive {Port, {data, Data}} -> - catch erlang:port_close(Port), - Data + maybe_collect_more_port_data(Port, Acc ++ Data) + end. + +maybe_collect_more_port_data(Port, Acc) -> + receive + {Port, {data, Data}} -> + maybe_collect_more_port_data(Port, Acc ++ Data) + after 500 -> + Acc end. supports_ssl_tls_version(Version) when Version == sslv2; -- 2.31.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor