Skip to content
Open
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: 10 additions & 1 deletion src/hackney_url.erl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ parse_url(URL) ->
parse_url(URL, #hackney_url{transport=hackney_tcp, scheme=http}).

parse_url(URL, S) ->
{URL1, Fragment} = parse_fragment(URL),
URL0 = parse_protocol(URL),
{URL1, Fragment} = parse_fragment(URL0),
case binary:split(URL1, <<"/">>) of
[URL1] ->
parse_addr1(URL1, S#hackney_url{raw_path = raw_fragment(Fragment),
Expand Down Expand Up @@ -277,6 +278,14 @@ parse_fragment(S) ->
{S1, F}
end.

parse_protocol(S) ->
case binary:split(S, <<"://">>) of
[Url] ->
Url;
[_InvalidProtocol, Url] ->
Url
end.


%% @doc Decode an URL encoded binary.
%% @equiv urldecode(Bin, crash)
Expand Down