summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2013-12-10 17:47:39 +0100
committerJan Lehnardt <jan@apache.org>2013-12-10 17:47:39 +0100
commitde20e99511ffcb34f6f6cda8c51fa3f9b08bf61f (patch)
treef24da1ca35623c407ac60d25519921d04b98fdd3
parent0f3735887b80d6e057abade2703c99f81cd92ca5 (diff)
downloadcouchdb-nice-fauxton-url.tar.gz
httpd: add handler for /_utils/fauxton URLnice-fauxton-url
-rw-r--r--src/couchdb/couch_httpd_misc_handlers.erl11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/couchdb/couch_httpd_misc_handlers.erl b/src/couchdb/couch_httpd_misc_handlers.erl
index 96a05c6d6..cd7b4287c 100644
--- a/src/couchdb/couch_httpd_misc_handlers.erl
+++ b/src/couchdb/couch_httpd_misc_handlers.erl
@@ -66,6 +66,9 @@ handle_file_req(Req, _) ->
handle_utils_dir_req(#httpd{method='GET'}=Req, DocumentRoot) ->
"/" ++ UrlPath = couch_httpd:path(Req),
case couch_httpd:partition(UrlPath) of
+ {_ActionKey, "/", "fauxton"} ->
+ % GET /_utils/fauxton
+ handle_urls_without_slash(Req);
{_ActionKey, "/", RelativePath} ->
% GET /_utils/path or GET /_utils/
CachingHeaders =
@@ -73,8 +76,7 @@ handle_utils_dir_req(#httpd{method='GET'}=Req, DocumentRoot) ->
couch_httpd:serve_file(Req, RelativePath, DocumentRoot, CachingHeaders);
{_ActionKey, "", _RelativePath} ->
% GET /_utils
- RedirectPath = couch_httpd:path(Req) ++ "/",
- couch_httpd:send_redirect(Req, RedirectPath)
+ handle_urls_without_slash(Req)
end;
handle_utils_dir_req(Req, _) ->
send_method_not_allowed(Req, "GET,HEAD").
@@ -86,6 +88,11 @@ handle_all_dbs_req(Req) ->
send_method_not_allowed(Req, "GET,HEAD").
+handle_urls_without_slash(Req) ->
+ RedirectPath = couch_httpd:path(Req) ++ "/",
+ couch_httpd:send_redirect(Req, RedirectPath).
+
+
handle_task_status_req(#httpd{method='GET'}=Req) ->
ok = couch_httpd:verify_is_server_admin(Req),
% convert the list of prop lists to a list of json objects