Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prohibit the 'retry' and 'retry_timeout' opts #34

Merged
merged 2 commits into from
Jul 27, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# ehttpc changes

## 0.3.0

* Changes on top of 0.2.1:

- Prohibit the `retry` and `retry_timeout` options.

## 0.2.1

* Improvements and Bug Fixes

- Add ehttpc:health_check/2
- Add ehttpc:health_check/2.

## 0.2.0

Expand Down
2 changes: 1 addition & 1 deletion src/ehttpc.app.src
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{application, ehttpc,
[{description, "HTTP Client for Erlang/OTP"},
{vsn, "0.2.1"},
{vsn, "0.3.0"},
{registered, []},
{applications, [kernel,
stdlib,
Expand Down
6 changes: 3 additions & 3 deletions src/ehttpc.appup.src
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%% -*-: erlang -*-
{"0.2.1",
{"0.3.0",
[
{"0.2.0", [
{<<"0.2.[0-1]">>, [
{load_module, ehttpc, brutal_purge, soft_purge, []}
]},
{<<"0\\.1\\\.[0-7]">>, [
Expand All @@ -17,7 +17,7 @@
]}
],
[
{"0.2.0", [
{<<"0.2.[0-1]">>, [
{load_module, ehttpc, brutal_purge, soft_purge, []}
]},
{<<"0\\.1\\.0">>, [
Expand Down
11 changes: 5 additions & 6 deletions src/ehttpc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ do_handle_info(
) ->
handle_client_down(State, Reason);
do_handle_info(Info, State) ->
?LOG(warning, "~p unexpected_info: ~p", [?MODULE, Info]),
?LOG(warning, "~p unexpected_info: ~p, client: ~p", [?MODULE, Info, State#state.client]),
State.

terminate(_Reason, #state{pool = Pool, id = Id, client = Client}) ->
Expand Down Expand Up @@ -390,7 +390,6 @@ gun_opts(Opts) ->
GunNoRetry = 0,
gun_opts(Opts, #{
retry => GunNoRetry,
retry_timeout => 1000,
connect_timeout => 5000,
%% The keepalive mechanism of gun will send "\r\n" for keepalive,
%% which may cause misjudgment by some servers, so we disabled it by default
Expand All @@ -400,10 +399,10 @@ gun_opts(Opts) ->

gun_opts([], Acc) ->
Acc;
gun_opts([{retry, Retry} | Opts], Acc) ->
gun_opts(Opts, Acc#{retry => Retry});
gun_opts([{retry_timeout, RetryTimeout} | Opts], Acc) ->
gun_opts(Opts, Acc#{retry_timeout => RetryTimeout});
gun_opts([{retry, _} | _Opts], _Acc) ->
error({not_allowd_opts, retry});
gun_opts([{retry_timeout, _} | _Opts], _Acc) ->
error({not_allowd_opts, retry_timeout});
gun_opts([{connect_timeout, ConnectTimeout} | Opts], Acc) ->
gun_opts(Opts, Acc#{connect_timeout => ConnectTimeout});
gun_opts([{transport, Transport} | Opts], Acc) ->
Expand Down
2 changes: 0 additions & 2 deletions test/ehttpc_google_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ pool_opts(Host, Port, Pipeline, PrioLatest) ->
{pool_size, ?POOL_SIZE},
{pool_type, random},
{connect_timeout, 5000},
{retry, 0},
{retry_timeout, 1000},
{prioritise_latest, PrioLatest}
].

Expand Down
2 changes: 0 additions & 2 deletions test/ehttpc_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,6 @@ pool_opts(Host, Port, Pipeline, PrioLatest) ->
{pool_size, 1},
{pool_type, random},
{connect_timeout, 5000},
{retry, 0},
{retry_timeout, 1000},
{prioritise_latest, PrioLatest}
].

Expand Down