From 1a9625f9fb0fb369246188e047a3919b8f69c845 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Fri, 13 Nov 2015 16:27:24 +0100 Subject: No need to strip "/" from path really. --- src/catlfish_web.erl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/catlfish_web.erl b/src/catlfish_web.erl index ea34928..f44745d 100644 --- a/src/catlfish_web.erl +++ b/src/catlfish_web.erl @@ -27,7 +27,7 @@ split_path(Parts) -> {Fun, App}. loop(Req, Module) -> - "/" ++ Path = Req:get(path), % FIXME no need to strip "/" + Path = Req:get(path), {Fun, App} = split_path(string:tokens(Path, "/")), lager:debug("Fun=~s; App=~s;", [Fun, App]), try @@ -38,13 +38,13 @@ loop(Req, Module) -> Query = Req:parse_qs(), {_, RawQuery, _} = mochiweb_util:urlsplit_path(Req:get(raw_path)), Result = case http_auth:verify_auth(AuthHeader, "GET", - "/" ++ Path, RawQuery) of + Path, RawQuery) of failure -> {403, [{"Content-Type", "text/plain"}], "Invalid credentials"}; success -> lager:debug("GET ~p ~p", [Path, Query]), - add_auth("/" ++ Path, + add_auth(Path, Module:request(get, App, Fun, Query)); noauth -> lager:debug("GET ~p ~p", [Path, Query]), @@ -62,13 +62,13 @@ loop(Req, Module) -> 'POST' -> Body = Req:recv_body(), Result = case http_auth:verify_auth(AuthHeader, "POST", - "/" ++ Path, Body) of + Path, Body) of failure -> {403, [{"Content-Type", "text/plain"}], "Invalid credentials"}; success -> lager:debug("POST ~p ~p", [Path, Body]), - add_auth("/" ++ Path, + add_auth(Path, Module:request(post, App, Fun, Body)); noauth -> lager:debug("POST ~p ~p", [Path, Body]), -- cgit v1.1