-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[OTP-19158][OTP-19221] whaileee/maint-25/inets/httpc_improvements #8788
base: maint-25
Are you sure you want to change the base?
[OTP-19158][OTP-19221] whaileee/maint-25/inets/httpc_improvements #8788
Conversation
This pr closes #8538 |
lib/inets/src/http_client/httpc.erl
Outdated
unalias(ClientAlias), | ||
receive | ||
{http, {RequestId, {ok, saved_to_file}}} -> | ||
{ok, saved_to_file}; | ||
{http, {RequestId, {error, Reason}}} -> | ||
{error, Reason}; | ||
{http, {RequestId, {ok, {StatusLine,Headers,BinBody}}}} -> | ||
Body = maybe_format_body(BinBody, Options), | ||
{ok, {StatusLine, Headers, Body}}; | ||
{http, {RequestId, {ok, {StatusCode,BinBody}}}} -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unalias(ClientAlias), | |
receive | |
{http, {RequestId, {ok, saved_to_file}}} -> | |
{ok, saved_to_file}; | |
{http, {RequestId, {error, Reason}}} -> | |
{error, Reason}; | |
{http, {RequestId, {ok, {StatusLine,Headers,BinBody}}}} -> | |
Body = maybe_format_body(BinBody, Options), | |
{ok, {StatusLine, Headers, Body}}; | |
{http, {RequestId, {ok, {StatusCode,BinBody}}}} -> | |
true = unalias(ClientAlias), | |
receive | |
{http, {RequestId, {ok, saved_to_file}}} -> | |
{ok, saved_to_file}; | |
{http, {RequestId, {error, Reason}}} -> | |
{error, Reason}; | |
{http, {RequestId, {ok, {StatusLine, Headers, BinBody}}}} -> | |
Body = maybe_format_body(BinBody, Options), | |
{ok, {StatusLine, Headers, Body}}; | |
{http, {RequestId, {ok, {StatusCode, BinBody}}}} -> |
CT Test Results 2 files 21 suites 12m 17s ⏱️ For more details on these failures, see this check. Results for commit abf2130. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts// Erlang/OTP Github Action Bot |
0ea1b80
to
abf2130
Compare
@@ -379,6 +379,12 @@ | |||
ReplyInfo}</c>.</p> | |||
</item> | |||
|
|||
<tag><c>alias()</c></tag> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is alias() used in parallel to pid() now? or should alias replace pid?
if both are used, maye we should give some hint which one is used when ... or why and when alias is better ?
@@ -1144,6 +1163,7 @@ request_options([{Key, DefaultVal, Verify} | Defaults], Options, Acc) -> | |||
BodyFormat :: string() | binary() | atom(), | |||
SocketOpt :: term(), | |||
Receiver :: pid() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Receiver type is repeated several times in this module. Should it always include alias type (i.e. reference())?
cancel_request(RequestId), | ||
unalias(ClientAlias), | ||
receive | ||
{http, {RequestId, {ok, saved_to_file}}} -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
write a code comment explaining why 2nd almost the same receive block is repeated in after Timeout
?
is it supposed to handle some race condition? did you observe it in test runs?
why not give up and return error instantly?
case httpc_manager:request(Request, profile_name(Profile)) of | ||
{ok, RequestId} -> | ||
handle_answer(RequestId, Sync, Options); | ||
handle_answer(RequestId, Receiver, Sync, Options, | ||
element(#http_options.timeout, HTTPOptions)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation
(Value) when is_reference(Value) -> | ||
ok; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation
cancel_request(RequestId), | ||
unalias(ClientAlias), | ||
receive | ||
{http, {RequestId, {ok, saved_to_file}}} -> | ||
{ok, saved_to_file}; | ||
{http, {RequestId, {error, Reason}}} -> | ||
{error, Reason}; | ||
{http, {RequestId, {ok, {StatusLine, Headers, BinBody}}}} -> | ||
Body = maybe_format_body(BinBody, Options), | ||
{ok, {StatusLine, Headers, Body}}; | ||
{http, {RequestId, {ok, {StatusCode, BinBody}}}} -> | ||
Body = maybe_format_body(BinBody, Options), | ||
{ok, {StatusCode, Body}} | ||
after 0 -> | ||
{error, timeout} | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation (whole after block)
Reference when is_reference(Reference) -> | ||
ok; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation
PR title could be adjusted to be more meaningful |
No description provided.