diff options
author | Micael Karlberg <[email protected]> | 2011-05-12 14:06:12 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2011-05-12 14:06:12 +0200 |
commit | d3d5b4fcf3e07c22e61c2c9a410d365178b12945 (patch) | |
tree | cf516c356a47991f1f7f136e0306c9812e738fff /lib | |
parent | 8a6b5ba7e038decf54e044656ef05ce9eec3c6dd (diff) | |
download | otp-d3d5b4fcf3e07c22e61c2c9a410d365178b12945.tar.gz otp-d3d5b4fcf3e07c22e61c2c9a410d365178b12945.tar.bz2 otp-d3d5b4fcf3e07c22e61c2c9a410d365178b12945.zip |
Calling gen_tcp:connect with option {ip, {127,0,0,1}} results in an exit with
reason badarg. Neither SSL nor INETS catches this, resulting in crashes
with incomprehensible reasons.
OTP-9289
Diffstat (limited to 'lib')
-rw-r--r-- | lib/inets/doc/src/notes.xml | 37 | ||||
-rw-r--r-- | lib/inets/src/http_lib/http_transport.erl | 30 | ||||
-rw-r--r-- | lib/inets/src/inets_app/inets.appup.src | 8 | ||||
-rw-r--r-- | lib/ssl/src/ssl.erl | 4 | ||||
-rw-r--r-- | lib/ssl/vsn.mk | 2 |
5 files changed, 60 insertions, 21 deletions
diff --git a/lib/inets/doc/src/notes.xml b/lib/inets/doc/src/notes.xml index edb994a91b..0926df8581 100644 --- a/lib/inets/doc/src/notes.xml +++ b/lib/inets/doc/src/notes.xml @@ -104,18 +104,6 @@ <p>*** POTENTIAL INCOMPATIBILITY ***</p> </item> - <item> - <p>[httpc] httpc manager crashes. - When a request results in a retry, the request id will be "reused" - in the previous implementation a race condition could occur causing - the manager to crash. </p> - <p>This is now avoided by using proc_lib:init_ack and - gen_server:enter_loop to allow mor advanced initialization of - httpc_handlers without blocking the httpc_manger and eliminating - extra processes that can cause race conditions. </p> - <p>Own Id: OTP-9246</p> - </item> - </list> </section> @@ -147,6 +135,31 @@ <p>Bernard Duggan</p> <p>Own Id: OTP-9158</p> </item> + + <item> + <p>[httpc] httpc manager crashes. + When a request results in a retry, the request id will be "reused" + in the previous implementation a race condition could occur causing + the manager to crash. </p> + <p>This is now avoided by using proc_lib:init_ack and + gen_server:enter_loop to allow mor advanced initialization of + httpc_handlers without blocking the httpc_manger and eliminating + extra processes that can cause race conditions. </p> + <p>Own Id: OTP-9246</p> + </item> + + <item> + <p>[httpc] Issuing a request (<c>httpc:request</c>) to an + host with the ssl option + <c>{ip, {127,0,0,1}}</c> results in an handler crash. + The reason was that the connect call resulted in an exit with + reason <c>badarg</c> + (this was the same for both <c>ssl</c> and <c>gen_tcp</c>). </p> + <p>Exits was not catched. This has now been improved. </p> + <p>Own Id: OTP-9289</p> + <p>Aux Id: seq11845</p> + </item> + </list> </section> diff --git a/lib/inets/src/http_lib/http_transport.erl b/lib/inets/src/http_lib/http_transport.erl index 173911b868..8cabfe3c71 100644 --- a/lib/inets/src/http_lib/http_transport.erl +++ b/lib/inets/src/http_lib/http_transport.erl @@ -110,7 +110,17 @@ connect(ip_comm = _SocketType, {Host, Port}, Opts0, Timeout) Opts = [binary, {packet, 0}, {active, false}, {reuseaddr, true} | Opts0], ?hlrt("connect using gen_tcp", [{host, Host}, {port, Port}, {opts, Opts}, {timeout, Timeout}]), - gen_tcp:connect(Host, Port, Opts, Timeout); + try gen_tcp:connect(Host, Port, Opts, Timeout) of + {ok, _} = OK -> + OK; + {error, _} = ERROR -> + ERROR + catch + exit:{badarg, _} -> + {error, {eoptions, Opts}}; + exit:badarg -> + {error, {eoptions, Opts}} + end; %% Wrapper for backaward compatibillity connect({ssl, SslConfig}, Address, Opts, Timeout) -> @@ -123,7 +133,14 @@ connect({ossl, SslConfig}, {Host, Port}, _, Timeout) -> {port, Port}, {ssl_config, SslConfig}, {timeout, Timeout}]), - ssl:connect(Host, Port, Opts, Timeout); + case (catch ssl:connect(Host, Port, Opts, Timeout)) of + {'EXIT', Reason} -> + {error, {eoptions, Reason}}; + {ok, _} = OK -> + OK; + {error, _} = ERROR -> + ERROR + end; connect({essl, SslConfig}, {Host, Port}, _, Timeout) -> Opts = [binary, {active, false}, {ssl_imp, new}] ++ SslConfig, @@ -132,7 +149,14 @@ connect({essl, SslConfig}, {Host, Port}, _, Timeout) -> {port, Port}, {ssl_config, SslConfig}, {timeout, Timeout}]), - ssl:connect(Host, Port, Opts, Timeout). + case (catch ssl:connect(Host, Port, Opts, Timeout)) of + {'EXIT', Reason} -> + {error, {eoptions, Reason}}; + {ok, _} = OK -> + OK; + {error, _} = ERROR -> + ERROR + end. %%------------------------------------------------------------------------- diff --git a/lib/inets/src/inets_app/inets.appup.src b/lib/inets/src/inets_app/inets.appup.src index 91fb064eec..47f3fbba58 100644 --- a/lib/inets/src/inets_app/inets.appup.src +++ b/lib/inets/src/inets_app/inets.appup.src @@ -20,12 +20,12 @@ [ {"5.5.2", [ - {restart_application, inets} + {restart_application, inets} ] }, {"5.5.1", [ - {restart_application, inets} + {restart_application, inets} ] }, {"5.5", @@ -42,12 +42,12 @@ [ {"5.5.2", [ - {restart_application, inets} + {restart_application, inets} ] }, {"5.5.1", [ - {restart_application, inets} + {restart_application, inets} ] }, {"5.5", diff --git a/lib/ssl/src/ssl.erl b/lib/ssl/src/ssl.erl index 7b1fda4cf9..38877ece7e 100644 --- a/lib/ssl/src/ssl.erl +++ b/lib/ssl/src/ssl.erl @@ -612,8 +612,10 @@ do_new_connect(Address, Port, catch exit:{function_clause, _} -> {error, {eoptions, {cb_info, CbInfo}}}; + exit:badarg -> + {error, {eoptions, {inet_options, UserOpts}}}; exit:{badarg, _} -> - {error,{eoptions, {inet_options, UserOpts}}} + {error, {eoptions, {inet_options, UserOpts}}} end. old_connect(Address, Port, Options, Timeout) -> diff --git a/lib/ssl/vsn.mk b/lib/ssl/vsn.mk index 2f1edfa186..0e80e42637 100644 --- a/lib/ssl/vsn.mk +++ b/lib/ssl/vsn.mk @@ -1 +1 @@ -SSL_VSN = 4.1.4 +SSL_VSN = 4.1.5 |