summaryrefslogtreecommitdiff
path: root/src/chttpd.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/chttpd.erl')
-rw-r--r--src/chttpd.erl17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/chttpd.erl b/src/chttpd.erl
index 9851c97b..9df127dd 100644
--- a/src/chttpd.erl
+++ b/src/chttpd.erl
@@ -64,7 +64,8 @@ handle_request(MochiReq) ->
% removed, but URL quoting left intact
RawUri = MochiReq:get(raw_path),
Customer = cloudant_util:customer_name(#httpd{mochi_req=MochiReq}),
- Path = ?COUCH:db_path(RawUri, Customer),
+ {Path, _, _} = mochiweb_util:urlsplit_path(generate_customer_path(RawUri,
+ Customer)),
{HandlerKey, _, _} = mochiweb_util:partition(Path, "/"),
LogForClosedSocket = io_lib:format("mochiweb_recv_error for ~s - ~p ~s", [
@@ -154,6 +155,20 @@ handle_request(MochiReq) ->
couch_stats_collector:increment({httpd, requests}),
{ok, Resp}.
+generate_customer_path("/", _Customer) ->
+ "";
+generate_customer_path("/favicon.ico", _Customer) ->
+ "favicon.ico";
+generate_customer_path([$/,$_|Rest], _Customer) ->
+ lists:flatten([$_|Rest]);
+generate_customer_path([$/|RawPath], Customer) ->
+ case Customer of
+ "" ->
+ RawPath;
+ Else ->
+ lists:flatten([Else, "%2F", RawPath])
+ end.
+
% Try authentication handlers in order until one returns a result
authenticate_request(#httpd{user_ctx=#user_ctx{}} = Req, _AuthFuns) ->
Req;