From 678460933a4cad62e7d96c9327fe70afcfeb5df4 Mon Sep 17 00:00:00 2001 From: Pavel Abalihin Date: Fri, 9 Oct 2015 11:45:14 +0300 Subject: [PATCH] fix handling of question mark in URL --- src/http/hackney_url.erl | 4 ++-- test/hackney_url_tests.erl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/http/hackney_url.erl b/src/http/hackney_url.erl index 10ed070d..387fdfdd 100644 --- a/src/http/hackney_url.erl +++ b/src/http/hackney_url.erl @@ -375,12 +375,12 @@ partial_pathencode(<> = Bin, Acc) -> if C >= $0, C =< $9 -> partial_pathencode(Rest, <>); C >= $A, C =< $Z -> partial_pathencode(Rest, <>); C >= $a, C =< $z -> partial_pathencode(Rest, <>); - C =:= $;; C =:= $=; C =:= $,; C =:= $: -> + C =:= $;; C =:= $=; C =:= $,; C =:= $:; C =:= $? -> partial_pathencode(Rest, <>); C =:= $.; C =:= $-; C =:= $+; C =:= $~; C =:= $_ -> partial_pathencode(Rest, <>); C =:= $ -> - partial_pathencode(Rest, <>); + partial_pathencode(Rest, <>); C =:= $% -> %% special case, when a % is passed to the path, check if %% it's a valid escape sequence. If the sequence is valid we diff --git a/test/hackney_url_tests.erl b/test/hackney_url_tests.erl index c7a296a8..16113c50 100644 --- a/test/hackney_url_tests.erl +++ b/test/hackney_url_tests.erl @@ -272,7 +272,7 @@ pathencode_test_() -> {<<"/path1/path2%2fa">>, <<"/path1/path2%2fa">>}, {<<"/path1/path2%2fa%2fb">>, <<"/path1/path2%2fa%2fb">>}, {<<"/path1/path2%2test">>, <<"/path1/path2%252test">>}, - {<<"/id/name:107/name2;p=1,3">>, <<"/id/name:107/name2;p=1,3">>} + {<<"/id/name:107/name2?name3;p=1,3">>, <<"/id/name:107/name2?name3;p=1,3">>} ], [{V, fun() -> R = hackney_url:pathencode(V) end} || {V, R} <- Tests].