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

ERL-1241: httpc:request crashes on bad port number #4258

Closed
OTP-Maintainer opened this issue May 7, 2020 · 2 comments
Closed

ERL-1241: httpc:request crashes on bad port number #4258

OTP-Maintainer opened this issue May 7, 2020 · 2 comments
Labels
bug Issue is reported as a bug priority:medium
Milestone

Comments

@OTP-Maintainer
Copy link

Original reporter: rjmh
Affected version: OTP-23.0-rc3
Fixed in version: OTP-23
Component: Not Specified
Migrated from: https://bugs.erlang.org/browse/ERL-1241


Calling httpc:request with a malformed URL can result in an exception rather than an error result. Sure, the argument is bad, but the documentation doesn't mention exceptions, and the behaviour was friendlier back in OTP-19.

 

{{Erlang/OTP 23 [RELEASE CANDIDATE 3] [erts-11.0] [source] [64-bit] [smp:36:36] [ds:36:36:10] [async-threads:1] [hipe]}}{{Eshell V11.0 (abort with ^G)}}
{{1> httpc:request("http://:").}}
{{** exception error: bad argument}}
{{ in function integer_to_list/1}}
{{ called as integer_to_list(undefined)}}
{{ in call from http_request:normalize_host/3 (http_request.erl, line 111)}}
{{ in call from httpc:handle_request/9 (httpc.erl, line 549)}}
{{2>}}

{{In OTP-19:}}

{{1}}{{> httpc:request("http://:").}}
{{{error,\{malformed_url,http,"http://:"}}}}
@OTP-Maintainer
Copy link
Author

ingela said:

Alas it is to close to the release now to squeezes a fix for this in. But we will look at improving the error handling for OTP-23.1 

@OTP-Maintainer
Copy link
Author

JIRAUSER13501 said:

This crash happened because httpc did not handle undefined port correctly. It was expecting a number but fed with undefined value. A fix has been merged and probably will be released in OTP23.1 (next release)

@OTP-Maintainer OTP-Maintainer added bug Issue is reported as a bug priority:medium labels Feb 10, 2021
@OTP-Maintainer OTP-Maintainer added this to the OTP-23 milestone Feb 10, 2021
@jhogberg jhogberg modified the milestones: OTP-23, OTP-23.0 Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug priority:medium
Projects
None yet
Development

No branches or pull requests

2 participants