aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2012-09-29 13:03:45 +0200
committerLoïc Hoguin <[email protected]>2012-09-29 13:03:45 +0200
commitce9aff19f036310dd33d00d14cff35a559b8ccb1 (patch)
treea0f659e95429ef465cfcaf40c28be759f47ef907 /src/cowboy_http.erl
parentc326a195e0b1a8d1b8ea338ae9e98d8606895641 (diff)
downloadcowboy-ce9aff19f036310dd33d00d14cff35a559b8ccb1.tar.gz
cowboy-ce9aff19f036310dd33d00d14cff35a559b8ccb1.tar.bz2
cowboy-ce9aff19f036310dd33d00d14cff35a559b8ccb1.zip
Remove the urldecode cowboy_protocol option
This allows inconsistent behavior and is not used enough to be supported.
Diffstat (limited to 'src/cowboy_http.erl')
-rw-r--r--src/cowboy_http.erl17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/cowboy_http.erl b/src/cowboy_http.erl
index 6ba4834..e0b1632 100644
--- a/src/cowboy_http.erl
+++ b/src/cowboy_http.erl
@@ -47,7 +47,7 @@
-export([urldecode/2]).
-export([urlencode/1]).
-export([urlencode/2]).
--export([x_www_form_urlencoded/2]).
+-export([x_www_form_urlencoded/1]).
-type version() :: {Major::non_neg_integer(), Minor::non_neg_integer()}.
-type headers() :: [{binary(), iodata()}].
@@ -861,15 +861,14 @@ tohexu(C) when C < 17 -> $A + C - 10.
tohexl(C) when C < 10 -> $0 + C;
tohexl(C) when C < 17 -> $a + C - 10.
--spec x_www_form_urlencoded(binary(), fun((binary()) -> binary())) ->
- list({binary(), binary() | true}).
-x_www_form_urlencoded(<<>>, _URLDecode) ->
+-spec x_www_form_urlencoded(binary()) -> list({binary(), binary() | true}).
+x_www_form_urlencoded(<<>>) ->
[];
-x_www_form_urlencoded(Qs, URLDecode) ->
+x_www_form_urlencoded(Qs) ->
Tokens = binary:split(Qs, <<"&">>, [global, trim]),
[case binary:split(Token, <<"=">>) of
- [Token] -> {URLDecode(Token), true};
- [Name, Value] -> {URLDecode(Name), URLDecode(Value)}
+ [Token] -> {urldecode(Token), true};
+ [Name, Value] -> {urldecode(Name), urldecode(Value)}
end || Token <- Tokens].
%% Tests.
@@ -1053,9 +1052,7 @@ x_www_form_urlencoded_test_() ->
{<<"a=b=c=d=e&f=g">>, [{<<"a">>, <<"b=c=d=e">>}, {<<"f">>, <<"g">>}]},
{<<"a+b=c+d">>, [{<<"a b">>, <<"c d">>}]}
],
- URLDecode = fun urldecode/1,
- [{Qs, fun() -> R = x_www_form_urlencoded(
- Qs, URLDecode) end} || {Qs, R} <- Tests].
+ [{Qs, fun() -> R = x_www_form_urlencoded(Qs) end} || {Qs, R} <- Tests].
urldecode_test_() ->
U = fun urldecode/2,