diff --git a/config/routes.conf b/config/routes.conf index 9046751..e1c7aa5 100755 --- a/config/routes.conf +++ b/config/routes.conf @@ -1,5 +1,10 @@ +# MeowMeow routing configuration + +# From 1.02-prebeta-r13: +# * All strings with space inside MUST be in quotes + Route * - Set-Header X-Powered-By Pusheen the Cat + Set-Header X-Powered-By "Pusheen the Cat" End Route /generate_204 diff --git a/src/access.erl b/src/access.erl index 80b357d..73addf8 100755 --- a/src/access.erl +++ b/src/access.erl @@ -11,7 +11,8 @@ get_cmd(Cmd) -> if length(L) == 0 -> pass; length(L) == 1 -> {string:trim(lists:nth(1, L)), true}; length(L) > 1 -> [K | V] = L, - {K, V} + Args = lists:nth(1, V), + {K, util:parse_arguments(Args)} end. parse_line(Dev, {ok, Line}) -> @@ -65,7 +66,7 @@ get_rules(Request, Array, Rules) -> case H of {Type, Pattern, List} -> get_rules_checked(Request, {Type, Pattern, List}, Rules, T); - Any-> + _-> get_rules(Request, T, Rules++[H]) end. diff --git a/src/rules.erl b/src/rules.erl index 44cc5b7..e2767e0 100755 --- a/src/rules.erl +++ b/src/rules.erl @@ -53,8 +53,7 @@ rule_no_content(_, Response) -> rule_disallow(_, _) -> {aborted, 403}. -rule_set_header(Arg, Response) -> - [Header|Value] = string:split(Arg, " "), +rule_set_header([Header, Value], Response) -> Response#response{headers = update_headers(Response, #{Header => Value})}. rule_set_code(Arg, Response)-> diff --git a/tests/config/routes.conf b/tests/config/routes.conf index d719bcc..ce1197d 100644 --- a/tests/config/routes.conf +++ b/tests/config/routes.conf @@ -1,5 +1,5 @@ Route * - Set-Header X-Powered-By Pusheen the Cat + Set-Header X-Powered-By "Pusheen the Cat" End Route /generate_204