mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-20 16:15:59 +01:00
Add workaround for bug in older erlang version in rest module
This commit is contained in:
parent
b173ec0a78
commit
7897c3d0e1
13
src/rest.erl
13
src/rest.erl
@ -197,7 +197,18 @@ url(Url, Params) ->
|
|||||||
L = [<<"&", (iolist_to_binary(Key))/binary, "=",
|
L = [<<"&", (iolist_to_binary(Key))/binary, "=",
|
||||||
(misc:url_encode(Value))/binary>>
|
(misc:url_encode(Value))/binary>>
|
||||||
|| {Key, Value} <- Params],
|
|| {Key, Value} <- Params],
|
||||||
<<$&, Encoded/binary>> = iolist_to_binary(L),
|
<<$&, Encoded0/binary>> = iolist_to_binary(L),
|
||||||
|
Encoded =
|
||||||
|
case erlang:function_exported(uri_string, normalize, 1) of
|
||||||
|
true ->
|
||||||
|
case uri_string:normalize("%25") of
|
||||||
|
"%" -> % This hack around bug in httpc >21 <23.2
|
||||||
|
binary:replace(Encoded0, <<"%25">>, <<"%2525">>, [global]);
|
||||||
|
_ -> Encoded0
|
||||||
|
end;
|
||||||
|
_ ->
|
||||||
|
Encoded0
|
||||||
|
end,
|
||||||
<<Url/binary, $?, Encoded/binary>>.
|
<<Url/binary, $?, Encoded/binary>>.
|
||||||
url(Server, Path, Params) ->
|
url(Server, Path, Params) ->
|
||||||
case binary:split(base_url(Server, Path), <<"?">>) of
|
case binary:split(base_url(Server, Path), <<"?">>) of
|
||||||
|
Loading…
Reference in New Issue
Block a user