Skip to content

Commit

Permalink
Merge pull request esl#16 from paulo-ferraz-oliveira/feature/otp_23
Browse files Browse the repository at this point in the history
Adapt to Erlang/OTP 23
  • Loading branch information
g-andrade authored May 22, 2020
2 parents a56e291 + c5889dc commit 76e8896
Show file tree
Hide file tree
Showing 12 changed files with 171 additions and 188 deletions.
26 changes: 14 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
language: erlang
otp_release:
- 17.0-rc1
- R16B03-1
- R16B03
- R16B02
- R16B01
- R15B03
- R15B02
- R15B01
- R14B04
- R14B03
- R14B02
script: "make test"
- 19.3
- 20.0
- 20.1
- 20.3
- 21.0
- 21.1
#- 21.2
- 21.3
- 22.0
- 22.1
- 22.2
- 22.3
- 23.0
script: make check test-travis
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html)
since version `3.0.0`.

## [Unreleased]

### Added
- compatibility with OTP 23

### Changed
- Travis constraints: updated version as per our current reality; added `make check`
- minimum supported version to 19.3

### Fixed
- some broken tests

## [3.2.0] - 2020-04-30

### Changed
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ xref: $(REBAR3)
test: $(REBAR3)
@$(REBAR3) do ct, eunit

test-travis: $(REBAR3)
@$(REBAR3) as travis-ci do ct, eunit

cover: test
@$(REBAR3) cover

Expand Down
127 changes: 83 additions & 44 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -1,49 +1,88 @@
{erl_opts, [debug_info]}.
{cover_enabled, true}.
{eunit_opts, [verbose, {report,{eunit_surefire,[{dir,"."}]}}]}.
{cover_enabled, true}.
{cover_export_enabled, true}.
%% == Erlang Compiler ==

{erl_opts, [{parse_transform, stacktrace_transform}] }.
{minimum_otp_vsn, "19.3"}.
{erl_opts, [
warnings_as_errors,
debug_info,
warn_export_vars,
warn_unused_import,
{parse_transform, stacktrace_transform}
]}.

%% == Dependencies ==

{deps_dir, "deps"}.
{deps, [
{certifi, "2.5.2"},
{ssl_verify_fun, "1.1.5"},
{stacktrace_compat, "1.1.2"}
{tls_certificate_check, "1.0.1"},
{stacktrace_compat, "1.1.2"}
]}.

%% == Dialyzer ==

{dialyzer, [
{warnings, [
error_handling,
unknown
]}
]}.

%% == xref ==

{xref_checks, [
undefined_function_calls,
undefined_functions,
locals_not_used,
exports_not_used,
deprecated_function_calls,
deprecated_functions
]}.

{minimum_otp_vsn, "19.0"}.

{shell,
[{apps, [lhttpc]}
]}.

{dialyzer,
[{plt_include_all_deps, true},
{warnings,
[error_handling,
unknown
]}
]}.

{xref_checks,
[undefined_function_calls,
undefined_functions,
locals_not_used,
exports_not_used,
deprecated_function_calls,
deprecated_functions
]}.

{profiles,
[{test,
[{erl_opts,
[debug_info,
nowarn_export_all,
nowarn_missing_spec,
nowarnings_as_errors,
{d, 'SKIP_BROKEN_TEST_CASES'}
]}
]}
]}.
%% == Profiles ==

{profiles, [
{'test', [
{erl_opts, [
debug_info,
nowarn_missing_spec,
nowarn_missing_spec_all,
{parse_transform, stacktrace_transform},
nowarn_export_all,
{d, 'SKIP_BROKEN_TEST_CASES'}
]},
{eunit_opts, [
verbose,
{report, {eunit_surefire, [{dir, "."}]}}
]},
{cover_enabled, true},
{cover_opts, [verbose]},
{xref_extra_paths, ["./test"]},
{extra_src_dirs, ["./test"]},
{dialyzer, [{warnings, []}]}
]},
{'travis-ci', [
{erl_opts, [
debug_info,
nowarn_missing_spec,
nowarn_missing_spec_all,
{parse_transform, stacktrace_transform},
nowarn_export_all,
{d, 'SKIP_BROKEN_TEST_CASES'},
{d, 'SKIP_IPV6_TEST_CASES'}
]},
{eunit_opts, [
verbose,
{report, {eunit_surefire, [{dir, "."}]}}
]}
]}
]}.

%% == edoc ==

{edoc_opts, [
{preprocess, true}
]}.

%% == shell ==

{shell, [
{apps, [lhttpc]}
]}.
14 changes: 9 additions & 5 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
{"1.1.0",
[{<<"certifi">>,{pkg,<<"certifi">>,<<"2.5.2">>},0},
[{<<"certifi">>,{pkg,<<"certifi">>,<<"2.5.2">>},1},
{<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.0">>},1},
{<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.5">>},0},
{<<"stacktrace_compat">>,{pkg,<<"stacktrace_compat">>,<<"1.1.2">>},0}]}.
{<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.6">>},1},
{<<"stacktrace_compat">>,{pkg,<<"stacktrace_compat">>,<<"1.1.2">>},0},
{<<"tls_certificate_check">>,
{pkg,<<"tls_certificate_check">>,<<"1.0.1">>},
0}]}.
[
{pkg_hash,[
{<<"certifi">>, <<"B7CFEAE9D2ED395695DD8201C57A2D019C0C43ECAF8B8BCB9320B40D6662F340">>},
{<<"parse_trans">>, <<"09765507A3C7590A784615CFD421D101AEC25098D50B89D7AA1D66646BC571C1">>},
{<<"ssl_verify_fun">>, <<"6EAF7AD16CB568BB01753DBBD7A95FF8B91C7979482B95F38443FE2C8852A79B">>},
{<<"stacktrace_compat">>, <<"E1223BFFD037F329E3B9DA8C7836781684C8FF07D26B10F7DF4C32916D33107E">>}]}
{<<"ssl_verify_fun">>, <<"CF344F5692C82D2CD7554F5EC8FD961548D4FD09E7D22F5B62482E5AEAEBD4B0">>},
{<<"stacktrace_compat">>, <<"E1223BFFD037F329E3B9DA8C7836781684C8FF07D26B10F7DF4C32916D33107E">>},
{<<"tls_certificate_check">>, <<"915600D319BFACBEFA89CF368553E5E672301F0A5482C1A5CAE3928CA5FD299C">>}]}
].
5 changes: 2 additions & 3 deletions src/lhttpc.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@
{modules, []},
{registered, [lhttpc_manager]},
{applications, [kernel, stdlib, ssl, crypto,
public_key, inets,
inets,
%% External dependencies
certifi,
parse_trans,
ssl_verify_fun,
tls_certificate_check,
stacktrace_compat
]},
{mod, {lhttpc, nil}},
Expand Down
2 changes: 1 addition & 1 deletion src/lhttpc_client.erl
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ execute(From, Host, Port, Ssl, Path, Method, Hdrs0, Body, Options) ->
ConnectOptions =
case Ssl andalso proplists:get_value(verify_ssl_cert, Options, ?DEFAULT_VERIFY_SSL_CERT) of
true ->
lhttpc_security:secure_ssl_options(Host, BaseConnectOptions);
tls_certificate_check:options(Host);
false ->
BaseConnectOptions
end,
Expand Down
18 changes: 16 additions & 2 deletions src/lhttpc_lib.erl
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,26 @@ split_credentials(CredsHostPortPath) ->
case string:tokens(Creds, ":") of
[User] ->
% RFC1738 says ":password" is optional
{http_uri:decode(User), "", HostPortPath};
{parse_query_string(User), "", HostPortPath};
[User, Passwd] ->
{http_uri:decode(User), http_uri:decode(Passwd), HostPortPath}
{parse_query_string(User), parse_query_string(Passwd), HostPortPath}
end
end.

-ifdef(OTP_RELEASE).
-if(?OTP_RELEASE >= 23).
parse_query_string(User0) ->
[{User, true}] = uri_string:dissect_query(User0),
User.
-else.
parse_query_string(User) ->
http_uri:decode(User).
-endif.
-else.
parse_query_string(User) ->
http_uri:decode(User).
-endif.

%%------------------------------------------------------------------------------
%% @private
%% @doc
Expand Down
87 changes: 0 additions & 87 deletions src/lhttpc_security.erl

This file was deleted.

Loading

0 comments on commit 76e8896

Please sign in to comment.