Updated Branches: refs/heads/nice-fauxton-url [created] de20e9951
httpd: add handler for /_utils/fauxton URL Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/de20e995 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/de20e995 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/de20e995 Branch: refs/heads/nice-fauxton-url Commit: de20e99511ffcb34f6f6cda8c51fa3f9b08bf61f Parents: 0f37358 Author: Jan Lehnardt <[email protected]> Authored: Tue Dec 10 17:47:39 2013 +0100 Committer: Jan Lehnardt <[email protected]> Committed: Tue Dec 10 17:47:39 2013 +0100 ---------------------------------------------------------------------- src/couchdb/couch_httpd_misc_handlers.erl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/de20e995/src/couchdb/couch_httpd_misc_handlers.erl ---------------------------------------------------------------------- diff --git a/src/couchdb/couch_httpd_misc_handlers.erl b/src/couchdb/couch_httpd_misc_handlers.erl index 96a05c6..cd7b428 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
