You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For certain bad input lhttpc will crash with an exception rather than returning {error, Reason} with sensible reason.
While the input might be invalid, I still think it would be nice if it was handled internally i lhttpc, especially since badarg is a pretty vague error. All of these invalid inputs are handled gracefully by httpc on the other hand.
lhttpc:request("", get, [], 1000).
** exception error: no function clause matching
lhttpc_lib:split_scheme([]) (src/lhttpc_lib.erl, line 109)
in function lhttpc_lib:parse_url/1 (src/lhttpc_lib.erl, line 104)
in call from lhttpc:request/6 (src/lhttpc.erl, line 177)
% Omit "http://"
lhttpc:request("www.google.com", get, [], 1000).
** exception error: no function clause matching
lhttpc_lib:split_scheme("www.google.com") (src/lhttpc_lib.erl, line 109)
in function lhttpc_lib:parse_url/1 (src/lhttpc_lib.erl, line 104)
in call from lhttpc:request/6 (src/lhttpc.erl, line 177)
% Non-existing domain name
lhttpc:request("http://www.thisurldoesntexist.com", get, [], 1000).
** exception exit: {nxdomain,
[{lhttpc_client,send_request,1,
[{file,"src/lhttpc_client.erl"},{line,175}]},
{lhttpc_client,execute,9,
[{file,"src/lhttpc_client.erl"},{line,132}]},
{lhttpc_client,request,9,
[{file,"src/lhttpc_client.erl"},{line,79}]}]}
in function lhttpc:request/9 (src/lhttpc.erl, line 323)
The text was updated successfully, but these errors were encountered:
g-andrade
pushed a commit
to g-andrade/lhttpc
that referenced
this issue
Nov 26, 2014
[Pasted from an email I got from a lhttpc user]
For certain bad input lhttpc will crash with an exception rather than returning {error, Reason} with sensible reason.
While the input might be invalid, I still think it would be nice if it was handled internally i lhttpc, especially since badarg is a pretty vague error. All of these invalid inputs are handled gracefully by httpc on the other hand.
Some examples that I have encountered:
Non ascii characters:
% Latin-1 "å"
% Ascii bell
% Bigger than byte()
% Nothing after "http://"
% Emptry string
% Omit "http://"
% Non-existing domain name
The text was updated successfully, but these errors were encountered: