From de20e99511ffcb34f6f6cda8c51fa3f9b08bf61f Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Tue, 10 Dec 2013 17:47:39 +0100 Subject: httpd: add handler for /_utils/fauxton URL --- src/couchdb/couch_httpd_misc_handlers.erl | 11 +++++++++-- 1 file 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 -- cgit v1.2.1