aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile5
-rw-r--r--rebar.config4
-rw-r--r--src/cowboy_http_req.erl7
4 files changed, 13 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index 64a028f..7750b23 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
.cowboy_dialyzer.plt
.eunit
+deps
doc/*.css
doc/*.html
doc/*.png
diff --git a/Makefile b/Makefile
index e96d5de..2a3a8c0 100644
--- a/Makefile
+++ b/Makefile
@@ -5,9 +5,12 @@ REBAR = rebar
all: app
-app:
+app: deps
@$(REBAR) compile
+deps:
+ @$(REBAR) get-deps
+
clean:
@$(REBAR) clean
rm -f test/*.beam
diff --git a/rebar.config b/rebar.config
index 9a17367..476ddd6 100644
--- a/rebar.config
+++ b/rebar.config
@@ -1,4 +1,8 @@
{cover_enabled, true}.
+{deps, [
+ {quoted, "1.0.0",
+ {git, "git://github.com/klaar/quoted.erl.git", {tag, "1.0.1"}}}
+]}.
{erl_opts, [
%% bin_opt_info,
%% warn_missing_spec,
diff --git a/src/cowboy_http_req.erl b/src/cowboy_http_req.erl
index 7fb69b6..60cdbc3 100644
--- a/src/cowboy_http_req.erl
+++ b/src/cowboy_http_req.erl
@@ -282,8 +282,8 @@ parse_qs(<<>>) ->
parse_qs(Qs) ->
Tokens = binary:split(Qs, <<"&">>, [global, trim]),
[case binary:split(Token, <<"=">>) of
- [Token] -> {Token, true};
- [Name, Value] -> {Name, Value}
+ [Token] -> {quoted:from_url(Token), true};
+ [Name, Value] -> {quoted:from_url(Name), quoted:from_url(Value)}
end || Token <- Tokens].
-spec response_head(http_status(), http_headers(), http_headers()) -> iolist().
@@ -427,7 +427,8 @@ parse_qs_test_() ->
{<<"a&b">>, [{<<"a">>, true}, {<<"b">>, true}]},
{<<"a=b&c&d=e">>, [{<<"a">>, <<"b">>},
{<<"c">>, true}, {<<"d">>, <<"e">>}]},
- {<<"a=b=c=d=e&f=g">>, [{<<"a">>, <<"b=c=d=e">>}, {<<"f">>, <<"g">>}]}
+ {<<"a=b=c=d=e&f=g">>, [{<<"a">>, <<"b=c=d=e">>}, {<<"f">>, <<"g">>}]},
+ {<<"a+b=c+d">>, [{<<"a b">>, <<"c d">>}]}
],
[{Qs, fun() -> R = parse_qs(Qs) end} || {Qs, R} <- Tests].