Skip to content

Commit

Permalink
handle path parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitc committed Mar 20, 2015
1 parent 243a4a8 commit 5f3d08f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/hackney_lib/hackney_url.erl
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,9 @@ partial_pathencode(<<C, Rest/binary>> = Bin, Acc) ->
if C >= $0, C =< $9 -> partial_pathencode(Rest, <<Acc/binary, C>>);
C >= $A, C =< $Z -> partial_pathencode(Rest, <<Acc/binary, C>>);
C >= $a, C =< $z -> partial_pathencode(Rest, <<Acc/binary, C>>);
C =:= $.; C =:= $-; C =:= $~; C =:= $_ ->
C =:= $;; C =:= $=; C =:= $,; C =:= $: ->
partial_pathencode(Rest, <<Acc/binary, C>>);
C =:= $.; C =:= $-; C =:= $+; C =:= $~; C =:= $_ ->
partial_pathencode(Rest, <<Acc/binary, C>>);
C =:= $ ->
partial_pathencode(Rest, <<Acc/binary, $+>>);
Expand Down
3 changes: 2 additions & 1 deletion test/hackney_url_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ pathencode_test_() ->
{<<"/path1/path2">>, <<"/path1/path2">>},
{<<"/path1/path2%2fa">>, <<"/path1/path2%2fa">>},
{<<"/path1/path2%2fa%2fb">>, <<"/path1/path2%2fa%2fb">>},
{<<"/path1/path2%2test">>, <<"/path1/path2%252test">>}
{<<"/path1/path2%2test">>, <<"/path1/path2%252test">>},
{<<"/id/name:107/name2;p=1,3">>, <<"/id/name:107/name2;p=1,3">>}
],
[{V, fun() -> R = hackney_url:pathencode(V) end} || {V, R} <- Tests].

Expand Down

0 comments on commit 5f3d08f

Please sign in to comment.