summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2008-10-31 21:46:34 +0000
committerJohn Christopher Anderson <jchris@apache.org>2008-10-31 21:46:34 +0000
commit7f1247040c5348f6a3f6e2d999cc5dec9fec6a6f (patch)
tree2c5a8fe23822b63d10e04de139cb22a62935f985
parent5ec6ff7fc12b8092e42829d790a20a90b3ab225d (diff)
couchdb once again serves favicon.ico
git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@709578 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--etc/couchdb/default.ini.tpl.in2
-rw-r--r--src/couchdb/couch_httpd_misc_handlers.erl8
2 files changed, 8 insertions, 2 deletions
diff --git a/etc/couchdb/default.ini.tpl.in b/etc/couchdb/default.ini.tpl.in
index a2c445d3..4b44c0fc 100644
--- a/etc/couchdb/default.ini.tpl.in
+++ b/etc/couchdb/default.ini.tpl.in
@@ -29,6 +29,8 @@ httpd={couch_httpd, start_link, []}
[httpd_global_handlers]
/ = {couch_httpd_misc_handlers, handle_welcome_req, <<"Welcome">>}
+favicon.ico = {couch_httpd_misc_handlers, handle_favicon_req, "%localdatadir%/www"}
+
_utils = {couch_httpd_misc_handlers, handle_utils_dir_req, "%localdatadir%/www"}
_all_dbs = {couch_httpd_misc_handlers, handle_all_dbs_req}
_config = {couch_httpd_misc_handlers, handle_config_req}
diff --git a/src/couchdb/couch_httpd_misc_handlers.erl b/src/couchdb/couch_httpd_misc_handlers.erl
index 2d2434e1..bcfe17c4 100644
--- a/src/couchdb/couch_httpd_misc_handlers.erl
+++ b/src/couchdb/couch_httpd_misc_handlers.erl
@@ -12,7 +12,7 @@
-module(couch_httpd_misc_handlers).
--export([handle_welcome_req/2,handle_utils_dir_req/2,handle_all_dbs_req/1,
+-export([handle_welcome_req/2,handle_favicon_req/2,handle_utils_dir_req/2,handle_all_dbs_req/1,
handle_replicate_req/1,handle_restart_req/1,handle_uuids_req/1,
handle_config_req/1]).
@@ -36,7 +36,11 @@ handle_welcome_req(#httpd{method='GET'}=Req, WelcomeMessage) ->
handle_welcome_req(Req, _) ->
send_method_not_allowed(Req, "GET,HEAD").
-
+handle_favicon_req(#httpd{method='GET'}=Req, DocumentRoot) ->
+ couch_httpd:serve_file(Req, "favicon.ico", DocumentRoot);
+handle_favicon_req(Req, _) ->
+ send_method_not_allowed(Req, "GET,HEAD").
+
handle_utils_dir_req(#httpd{method='GET'}=Req, DocumentRoot) ->
"/" ++ UrlPath = couch_httpd:path(Req),
case couch_httpd:partition(UrlPath) of