diff options
author | Pouriya <pouriya.jahanbakhsh@gmail.com> | 2022-01-21 03:14:28 +0330 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-21 03:14:28 +0330 |
commit | 03485f5e940326a9fdbcf2ecd1918b2772003a6a (patch) | |
tree | 5ce253cdd24e11f0f2bd90babbbf0bc38e38c575 /src/rest.erl | |
parent | Merge branch 'processone:master' into master (diff) | |
parent | mod_pubsub: Allow for limiting item_expire value (diff) |
Merge branch 'processone:master' into master
Diffstat (limited to 'src/rest.erl')
-rw-r--r-- | src/rest.erl | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/rest.erl b/src/rest.erl index d724352f2..1bb5c5ef7 100644 --- a/src/rest.erl +++ b/src/rest.erl @@ -191,13 +191,26 @@ base_url(Server, Path) -> _ -> Url end. +-ifdef(HAVE_URI_STRING). +uri_hack(Str) -> + case uri_string:normalize("%25") of + "%" -> % This hack around bug in httpc >21 <23.2 + binary:replace(Str, <<"%25">>, <<"%2525">>, [global]); + _ -> Str + end. +-else. +uri_hack(Str) -> + Str. +-endif. + url(Url, []) -> Url; url(Url, Params) -> L = [<<"&", (iolist_to_binary(Key))/binary, "=", (misc:url_encode(Value))/binary>> || {Key, Value} <- Params], - <<$&, Encoded/binary>> = iolist_to_binary(L), + <<$&, Encoded0/binary>> = iolist_to_binary(L), + Encoded = uri_hack(Encoded0), <<Url/binary, $?, Encoded/binary>>. url(Server, Path, Params) -> case binary:split(base_url(Server, Path), <<"?">>) of |