Skip to content

Commit

Permalink
Merge branch 'bmk/httpc_suite_ipfamily_fix/20101109/OTP-8927' of supe…
Browse files Browse the repository at this point in the history
…r:bmk_otp into dev
  • Loading branch information
IngelaAndin committed Nov 29, 2010
2 parents 97a68f5 + ad82371 commit e4890b3
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 38 deletions.
16 changes: 11 additions & 5 deletions lib/inets/src/http_client/httpc_handler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -854,12 +854,18 @@ connect(SocketType, ToAddress,
inet6fb4 ->
Opts3 = [inet6 | Opts2],
case http_transport:connect(SocketType, ToAddress, Opts3, Timeout) of
{error, Reason} when ((Reason =:= nxdomain) orelse
(Reason =:= eafnosupport)) ->
{error, _Reason} = Error ->
Opts4 = [inet | Opts2],
http_transport:connect(SocketType, ToAddress, Opts4, Timeout);
Other ->
Other
case http_transport:connect(SocketType,
ToAddress, Opts4, Timeout) of
{error, _} ->
%% Reply with the "original" error
Error;
OK ->
OK
end;
OK ->
OK
end;
_ ->
Opts3 = [IpFamily | Opts2],
Expand Down
10 changes: 10 additions & 0 deletions lib/inets/src/inets_app/inets.appup.src
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,23 @@

{"%VSN%",
[
{"5.5",
[
{restart_application, inets}
]
},
{"5.4",
[
{restart_application, inets}
]
}
],
[
{"5.4",
[
{restart_application, inets}
]
},
{"5.4",
[
{restart_application, inets}
Expand Down
24 changes: 14 additions & 10 deletions lib/inets/test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -288,16 +288,20 @@ release_spec: opt
$(INSTALL_DATA) $(INETS_FILES) $(RELSYSDIR)/test
@for d in $(DATADIRS); do \
echo "installing data dir $$d"; \
echo $$d/TAR.exclude2 > $$d/TAR.exclude2; \
cat $$d/TAR.exclude >> $$d/TAR.exclude2; \
find $$d -name '*.contrib*' >> $$d/TAR.exclude2; \
find $$d -name '*.keep*' >> $$d/TAR.exclude2; \
find $$d -name '*.mkelem*' >> $$d/TAR.exclude2; \
find $$d -name '*~' >> $$d/TAR.exclude2; \
find $$d -name 'erl_crash.dump' >> $$d/TAR.exclude2; \
find $$d -name 'core' >> $$d/TAR.exclude2; \
find $$d -name '.cmake.state' >> $$d/TAR.exclude2; \
tar cfX - $$d/TAR.exclude2 $$d | (cd $(RELSYSDIR)/test; tar xf -); \
if test -f $$d/TAR.exclude; then \
echo $$d/TAR.exclude2 > $$d/TAR.exclude2; \
cat $$d/TAR.exclude >> $$d/TAR.exclude2; \
find $$d -name '*.contrib*' >> $$d/TAR.exclude2; \
find $$d -name '*.keep*' >> $$d/TAR.exclude2; \
find $$d -name '*.mkelem*' >> $$d/TAR.exclude2; \
find $$d -name '*~' >> $$d/TAR.exclude2; \
find $$d -name 'erl_crash.dump' >> $$d/TAR.exclude2; \
find $$d -name 'core' >> $$d/TAR.exclude2; \
find $$d -name '.cmake.state' >> $$d/TAR.exclude2; \
tar cfX - $$d/TAR.exclude2 $$d | (cd $(RELSYSDIR)/test; tar xf -); \
else \
tar cf - $$d | (cd $(RELSYSDIR)/test; tar xf -); \
fi; \
done

release_tests_spec: opt
Expand Down
45 changes: 25 additions & 20 deletions lib/inets/test/httpc_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,14 @@ init_per_testcase(Case, Timeout, Config) ->
[{watchdog, Dog}, {local_server, Server} | TmpConfig2]
end,

%% httpc:set_options([{proxy, {{?PROXY, ?PROXY_PORT},
%% ["localhost", ?IPV6_LOCAL_HOST]}}]),

httpc:set_options([{proxy, {{?PROXY, ?PROXY_PORT},
["localhost", ?IPV6_LOCAL_HOST]}}]),
%% snmp:set_trace([gen_tcp, inet_tcp, prim_inet]),
["localhost", ?IPV6_LOCAL_HOST]}},
{ipfamily, inet6fb4}]),

%% snmp:set_trace([gen_tcp]),
NewConfig.


Expand Down Expand Up @@ -471,7 +476,7 @@ http_relaxed(Config) when is_list(Config) ->

DummyServerPid ! stop,
ok = httpc:set_options([{ipv6, enabled}]),
%% ok = httpc:set_options([{ipfamily, inet6fb4}]), % ********** ipfamily = inet6 *************
%% ok = httpc:set_options([{ipfamily, inet6fb4}]),
ok.


Expand All @@ -489,7 +494,7 @@ http_dummy_pipe(Config) when is_list(Config) ->
test_pipeline(URL),

DummyServerPid ! stop,
ok = httpc:set_options([{ipfamily, inet6fb4}]), % ********** ipfamily = inet6 *************
ok = httpc:set_options([{ipfamily, inet6fb4}]),
ok.

http_inets_pipe(doc) ->
Expand Down Expand Up @@ -851,7 +856,7 @@ http_headers_dummy(Config) when is_list(Config) ->
], "text/plain", FooBar},
[], []),
DummyServerPid ! stop,
ok = httpc:set_options([{ipfamily, inet6fb4}]), % ********** ipfamily = inet6 *************
ok = httpc:set_options([{ipfamily, inet6fb4}]),
ok.


Expand All @@ -875,7 +880,7 @@ http_bad_response(Config) when is_list(Config) ->
test_server:format("Wrong Statusline: ~p~n", [Reason]),

DummyServerPid ! stop,
ok = httpc:set_options([{ipfamily, inet6fb4}]), % ********** ipfamily = inet6 *************
ok = httpc:set_options([{ipfamily, inet6fb4}]),
ok.


Expand Down Expand Up @@ -1157,7 +1162,7 @@ http_redirect(Config) when is_list(Config) ->
tsp("http_redirect -> stop dummy server"),
DummyServerPid ! stop,
tsp("http_redirect -> reset ipfamily option (to inet6fb4)"),
ok = httpc:set_options([{ipfamily, inet6fb4}]), % ********** ipfamily = inet6 *************
ok = httpc:set_options([{ipfamily, inet6fb4}]),
tsp("http_redirect -> done"),
ok;

Expand All @@ -1181,7 +1186,7 @@ http_redirect_loop(Config) when is_list(Config) ->
{ok, {{_,300,_}, [_ | _], _}}
= httpc:request(get, {URL, []}, [], []),
DummyServerPid ! stop,
ok = httpc:set_options([{ipfamily, inet6fb4}]), % ********** ipfamily = inet6 *************
ok = httpc:set_options([{ipfamily, inet6fb4}]),
ok.

%%-------------------------------------------------------------------------
Expand Down Expand Up @@ -1215,7 +1220,7 @@ http_internal_server_error(Config) when is_list(Config) ->

ets:delete(unavailable),
DummyServerPid ! stop,
ok = httpc:set_options([{ipfamily, inet6fb4}]), % ********** ipfamily = inet6 *************
ok = httpc:set_options([{ipfamily, inet6fb4}]),
ok.


Expand All @@ -1242,7 +1247,7 @@ http_userinfo(Config) when is_list(Config) ->
httpc:request(get, {URLUnAuth, []}, [], []),

DummyServerPid ! stop,
ok = httpc:set_options([{ipfamily, inet6fb4}]), % ********** ipfamily = inet6 *************
ok = httpc:set_options([{ipfamily, inet6fb4}]),
ok.


Expand Down Expand Up @@ -1271,9 +1276,9 @@ http_cookie(Config) when is_list(Config) ->

ets:delete(cookie),

ok = httpc:set_options([{cookies, disabled}, {ipfamily, inet6fb4}]), % ********** ipfamily = inet6 *************
ok = httpc:set_options([{cookies, disabled}]),
DummyServerPid ! stop,
ok = httpc:set_options([{ipfamily, inet6fb4}]), % ********** ipfamily = inet6************
ok = httpc:set_options([{ipfamily, inet6fb4}]),
ok.

%%-------------------------------------------------------------------------
Expand Down Expand Up @@ -1643,7 +1648,7 @@ http_stream_once(Config) when is_list(Config) ->
p("http_stream_once -> stop dummy server", []),
DummyServerPid ! stop,
p("http_stream_once -> set ipfamily to inet6fb4", []),
ok = httpc:set_options([{ipfamily, inet6fb4}]), % ********** ipfamily = inet6 *************
ok = httpc:set_options([{ipfamily, inet6fb4}]),
p("http_stream_once -> done", []),
ok.

Expand Down Expand Up @@ -1847,7 +1852,7 @@ http_invalid_http(Config) when is_list(Config) ->

test_server:format("Parse error: ~p ~n", [Reason]),
DummyServerPid ! stop,
ok = httpc:set_options([{ipfamily, inet6fb4}]), % ********** ipfamily = inet6 *************
ok = httpc:set_options([{ipfamily, inet6fb4}]),
ok.


Expand Down Expand Up @@ -1901,7 +1906,7 @@ transfer_encoding_otp_6807(Config) when is_list(Config) ->
"/capital_transfer_encoding.html",
{ok, {{_,200,_}, [_|_], [_ | _]}} = httpc:request(URL),
DummyServerPid ! stop,
ok = httpc:set_options([{ipfamily, inet6fb4}]), % ********** ipfamily = inet6 *************
ok = httpc:set_options([{ipfamily, inet6fb4}]),
ok.


Expand Down Expand Up @@ -1933,7 +1938,7 @@ empty_response_header_otp_6830(Config) when is_list(Config) ->
URL = ?URL_START ++ integer_to_list(Port) ++ "/no_headers.html",
{ok, {{_,200,_}, [], [_ | _]}} = httpc:request(URL),
DummyServerPid ! stop,
ok = httpc:set_options([{ipfamily, inet6fb4}]), % ********** ipfamily = inet6 *************
ok = httpc:set_options([{ipfamily, inet6fb4}]),
ok.


Expand All @@ -1950,7 +1955,7 @@ no_content_204_otp_6982(Config) when is_list(Config) ->
URL = ?URL_START ++ integer_to_list(Port) ++ "/no_content.html",
{ok, {{_,204,_}, [], []}} = httpc:request(URL),
DummyServerPid ! stop,
ok = httpc:set_options([{ipfamily, inet6fb4}]), % ********** ipfamily = inet6 *************
ok = httpc:set_options([{ipfamily, inet6fb4}]),
ok.


Expand All @@ -1968,7 +1973,7 @@ missing_CR_otp_7304(Config) when is_list(Config) ->
URL = ?URL_START ++ integer_to_list(Port) ++ "/missing_CR.html",
{ok, {{_,200,_}, _, [_ | _]}} = httpc:request(URL),
DummyServerPid ! stop,
ok = httpc:set_options([{ipfamily, inet6fb4}]), % ********** ipfamily = inet6 *************
ok = httpc:set_options([{ipfamily, inet6fb4}]),
ok.


Expand All @@ -1990,7 +1995,7 @@ otp_7883_1(Config) when is_list(Config) ->
{error, socket_closed_remotely} = httpc:request(URL),
DummyServerPid ! stop,

ok = httpc:set_options([{ipfamily, inet6fb4}]), % ********** ipfamily = inet6 *************
ok = httpc:set_options([{ipfamily, inet6fb4}]),
ok.

otp_7883_2(doc) ->
Expand All @@ -2017,7 +2022,7 @@ otp_7883_2(Config) when is_list(Config) ->
end,
DummyServerPid ! stop,

ok = httpc:set_options([{ipfamily, inet6fb4}]), % ********** ipfamily = inet6 *************
ok = httpc:set_options([{ipfamily, inet6fb4}]),
ok.


Expand Down
5 changes: 3 additions & 2 deletions lib/inets/test/inets_appup_test.erl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 2002-2009. All Rights Reserved.
%% Copyright Ericsson AB 2002-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
Expand All @@ -18,11 +18,12 @@
%%
%%
%%----------------------------------------------------------------------
%% Purpose: Verify the application specifics of the Megaco application
%% Purpose: Verify the application specifics of the Inets application
%%----------------------------------------------------------------------
-module(inets_appup_test).

-compile(export_all).
-compile({no_auto_import,[error/1]}).

-include("inets_test_lib.hrl").

Expand Down
21 changes: 20 additions & 1 deletion lib/inets/vsn.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
#-*-makefile-*- ; force emacs to enter makefile-mode

# %CopyrightBegin%
#
# Copyright Ericsson AB 2001-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
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
#
# %CopyrightEnd%

APPLICATION = inets
INETS_VSN = 5.5
INETS_VSN = 5.5.1
PRE_VSN =
APP_VSN = "$(APPLICATION)-$(INETS_VSN)$(PRE_VSN)"

0 comments on commit e4890b3

Please sign in to comment.