Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,24 @@ jobs:
runs-on: ${{matrix.os}}
strategy:
matrix:
otp_vsn: [22, 23, 24]
otp_vsn: [27, 28, 29]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
id: setup-beam
with:
otp-version: ${{matrix.otp_vsn}}
rebar3-version: '3.18'
rebar3-version: '3'
- name: restore _build
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: _build
key: _build-cache-for-os-${{runner.os}}-otp-${{steps.setup-beam.outputs.otp-version}}-rebar3-${{steps.setup-beam.outputs.rebar3-version}}-hash-${{hashFiles('rebar.lock')}}
- name: restore rebar3's cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.cache/rebar3
key: rebar3-cache-for-os-${{runner.os}}-otp-${{steps.setup-beam.outputs.otp-version}}-rebar3-${{steps.setup-beam.outputs.rebar3-version}}-hash-${{hashFiles('rebar.lock')}}
- run: make version
- run: make ex_doc-dry
if: ${{matrix.otp_vsn >= 24}}
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added
- type specs to all functions [Sérgio Almeida]

### Changed
- [dep.] `tls_certificate_check` from 1.21.0 to 1.35.0 [Sérgio Almeida]
- CI to run on OTP 27 to 29 [Sérgio Almeida]
- `elvis.config` to disable `no_receive_without_timeout` and `no_throw` rules [Sérgio Almeida]
- exported type `lhttpc:socket()` from `_` to `inet:socket() | ssl:sslsocket()` [Sérgio Almeida]

### Fixed
- TLS connections rejected with `{verify_ssl_cert, false}` on OTP 26 and later [Sérgio Almeida]
- `elvis.config` to the `elvis_core` 6.x format [Sérgio Almeida]

### Removed
- compatibility with OTP 22 to 26 [Sérgio Almeida]

## [4.3.2] - 2024-03-11

### Changed
Expand Down
32 changes: 14 additions & 18 deletions elvis.config
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
[{elvis, [
{config, [
#{ dirs => ["src/**"],
filter => "*.erl",
[{config, [
#{ files => ["src/**/*.erl"],
ruleset => erl_files,
rules => [{elvis_style, dont_repeat_yourself, disable},
{elvis_style, no_if_expression, disable}] },
#{ dirs => ["test/**"],
filter => "*.erl",
ruleset => erl_files,
rules => [{elvis_style, dont_repeat_yourself, disable},
{elvis_style, invalid_dynamic_call, disable},
{elvis_style, no_if_expression, disable},
{elvis_style, max_function_arity, disable},
{elvis_style, no_throw, disable},
{elvis_style, no_receive_without_timeout, disable}] },
#{ files => ["test/**/*.erl"],
ruleset => erl_files_test,
rules => [{elvis_style, no_invalid_dynamic_calls, disable},
{elvis_style, function_naming_convention, disable},
{elvis_style, no_if_expression, disable},
{elvis_style, atom_naming_convention, disable}] },
#{ dirs => ["."],
filter => "rebar.config",
ruleset => rebar_config },
#{ dirs => ["."],
filter => "elvis.config",
ruleset => elvis_config }
{elvis_style, atom_naming_convention, disable},
{elvis_style, no_receive_without_timeout, disable}] },
#{ files => ["rebar.config"],
ruleset => rebar_config }
]},
{verbose, true}
]}].
].
12 changes: 6 additions & 6 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%% == Erlang Compiler ==

{minimum_otp_vsn, "22"}.
{minimum_otp_vsn, "27"}.

{erl_opts, [
debug_info,
Expand All @@ -13,14 +13,14 @@
%% == Dependencies and plugins ==

{deps, [
{tls_certificate_check, "1.21.0"}
{tls_certificate_check, "1.35.0"}
]}.

{project_plugins, [
rebar3_ex_doc,
rebar3_hank,
rebar3_hex,
rebar3_lint
{rebar3_ex_doc, "0.3.0"},
{rebar3_hank, "2.0.0"},
{rebar3_hex, "7.3.0"},
{rebar3_lint, "6.0.0"}
]}.

%% == Dialyzer ==
Expand Down
6 changes: 3 additions & 3 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{"1.2.0",
[{<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.7">>},1},
{<<"tls_certificate_check">>,
{pkg,<<"tls_certificate_check">>,<<"1.21.0">>},
{pkg,<<"tls_certificate_check">>,<<"1.35.0">>},
0}]}.
[
{pkg_hash,[
{<<"ssl_verify_fun">>, <<"354C321CF377240C7B8716899E182CE4890C5938111A1296ADD3EC74CF1715DF">>},
{<<"tls_certificate_check">>, <<"042AB2C0C860652BC5CF69C94E3A31F96676D14682E22EC7813BD173CEFF1788">>}]},
{<<"tls_certificate_check">>, <<"6237B9CB9632B1F52F00EF852CD04D4AF70319C308D4F65BE1E45DA637578867">>}]},
{pkg_hash_ext,[
{<<"ssl_verify_fun">>, <<"FE4C190E8F37401D30167C8C405EDA19469F34577987C76DDE613E838BBC67F8">>},
{<<"tls_certificate_check">>, <<"6CEE6CFFC35A390840D48D463541D50746A7B0E421ACAADB833CFC7961E490E7">>}]}
{<<"tls_certificate_check">>, <<"36FD91D635761DAFFA12E75B0C784B24510A69AD53348B8276A553D2D665B579">>}]}
].
4 changes: 2 additions & 2 deletions src/lhttpc.app.src
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%%% -*- coding: latin-1 -*-
%%% -*- coding: utf-8 -*-
%%% ----------------------------------------------------------------------------
%%% Copyright (c) 2009, Erlang Training and Consulting Ltd.
%%% All rights reserved.
Expand All @@ -25,7 +25,7 @@
%%% ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
%%% ----------------------------------------------------------------------------

%%% @author Oscar Hellström <oscar@hellstrom.st>
%%% @author Oscar Hellström <oscar@hellstrom.st>
%%% @doc This is the specification for the lhttpc application.
%%% @end
{application, lhttpc, [
Expand Down
29 changes: 17 additions & 12 deletions src/lhttpc.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%%% -*- coding: latin-1 -*-
%%% -*- coding: utf-8 -*-
%%% ----------------------------------------------------------------------------
%%% Copyright (c) 2009, Erlang Training and Consulting Ltd.
%%% All rights reserved.
Expand Down Expand Up @@ -26,7 +26,7 @@
%%% ----------------------------------------------------------------------------

%%------------------------------------------------------------------------------
%%% @author Oscar Hellström <oscar@hellstrom.st>
%%% @author Oscar Hellström <oscar@hellstrom.st>
%%% @doc Main interface to the lightweight http client.
%%% See {@link request/4}, {@link request/5} and {@link request/6} functions.
%%% @end
Expand Down Expand Up @@ -80,7 +80,7 @@
-type bodypart() :: iodata() | 'http_eob'.
-export_type([bodypart/0]).

-type socket() :: _.
-type socket() :: inet:socket() | ssl:sslsocket().
Comment thread
eskiloide marked this conversation as resolved.
Resolved
-export_type([socket/0]).

-type port_num() :: 1..65535.
Expand Down Expand Up @@ -194,7 +194,7 @@ stop() ->
%% @doc Add a new named httpc_manager pool to the supervisor tree
%% @end
%%------------------------------------------------------------------------------
-spec add_pool(atom()) -> {ok, pid()} | {error, already_exists|term()}.
-spec add_pool(atom()) -> {ok, pid()} | {error, already_exists | term()}.
add_pool(Name) when is_atom(Name) ->
{ok, ConnTimeout} = application:get_env(lhttpc, connection_timeout),
{ok, PoolSize} = application:get_env(lhttpc, pool_size),
Expand All @@ -206,7 +206,7 @@ add_pool(Name) when is_atom(Name) ->
%% @doc Add a new httpc_manager to the supervisor tree
%% @end
%%------------------------------------------------------------------------------
-spec add_pool(atom(), pos_integer()) -> {ok, pid()} | {error, already_exists|term()}.
-spec add_pool(atom(), pos_integer()) -> {ok, pid()} | {error, already_exists | term()}.
add_pool(Name, ConnTimeout) when is_atom(Name),
is_integer(ConnTimeout),
ConnTimeout > 0 ->
Expand All @@ -218,7 +218,7 @@ add_pool(Name, ConnTimeout) when is_atom(Name),
%% @end
%%------------------------------------------------------------------------------
-spec add_pool(atom(), non_neg_integer(), poolsize()) ->
{ok, pid()} | {error, already_exists|term()}.
{ok, pid()} | {error, already_exists | term()}.
add_pool(Name, ConnTimeout, PoolSize) ->
ChildSpec = {Name,
{lhttpc_manager, start_link, [[{name, Name},
Expand Down Expand Up @@ -608,15 +608,19 @@ kill_client(Pid) ->
%% @private
%%------------------------------------------------------------------------------
-spec verify_options(options()) -> ok.
verify_options([{send_retry, N} | Options]) when is_integer(N), N >= 0 ->
verify_options([{send_retry, N} | Options])
when is_integer(N) andalso
N >= 0 ->
verify_options(Options);
verify_options([{connect_timeout, infinity} | Options]) ->
verify_options(Options);
verify_options([{connect_timeout, MS} | Options])
when is_integer(MS), MS >= 0 ->
when is_integer(MS) andalso
MS >= 0 ->
verify_options(Options);
verify_options([{partial_upload, WindowSize} | Options])
when is_integer(WindowSize), WindowSize >= 0 ->
when is_integer(WindowSize) andalso
WindowSize >= 0 ->
verify_options(Options);
verify_options([{partial_upload, infinity} | Options]) ->
verify_options(Options);
Expand All @@ -631,7 +635,8 @@ verify_options([{proxy, List} | Options]) when is_list(List) ->
verify_options([{proxy_ssl_options, List} | Options]) when is_list(List) ->
verify_options(Options);
verify_options([{pool, PidOrName} | Options])
when is_pid(PidOrName); is_atom(PidOrName) ->
when is_pid(PidOrName) orelse
is_atom(PidOrName) ->
verify_options(Options);
verify_options([{pool_ensure, Bool} | Options])
when is_boolean(Bool) ->
Expand All @@ -641,7 +646,7 @@ verify_options([{pool_connection_timeout, Size} | Options])
verify_options(Options);
verify_options([{pool_max_size, Size} | Options])
when is_integer(Size) orelse
Size =:= infinity->
Size =:= infinity ->
verify_options(Options);
verify_options([{use_pool, UsePool} | Options])
when is_boolean(UsePool) ->
Expand All @@ -658,7 +663,7 @@ verify_options([]) ->
%% @private
%%------------------------------------------------------------------------------
-spec verify_partial_download([partial_download_option()]) -> ok.
verify_partial_download([{window_size, infinity} | Options])->
verify_partial_download([{window_size, infinity} | Options]) ->
verify_partial_download(Options);
verify_partial_download([{window_size, Size} | Options]) when
is_integer(Size), Size >= 0 ->
Expand Down
Loading
Loading