summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_httpd_misc_handlers.erl
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2009-12-10 20:10:29 +0000
committerJohn Christopher Anderson <jchris@apache.org>2009-12-10 20:10:29 +0000
commit908f1a6068f6a055b15790289643d0e0a53f53a2 (patch)
tree771948d2f6658657a7fda41974124daaefcc3038 /src/couchdb/couch_httpd_misc_handlers.erl
parent72de6c7633e56207b8ee4bf10f155ed06fc39ef4 (diff)
cache headers for favicon.ico - thanks Matthew Hooker
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@889402 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_httpd_misc_handlers.erl')
-rw-r--r--src/couchdb/couch_httpd_misc_handlers.erl9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/couchdb/couch_httpd_misc_handlers.erl b/src/couchdb/couch_httpd_misc_handlers.erl
index fb761f5b..2d67b321 100644
--- a/src/couchdb/couch_httpd_misc_handlers.erl
+++ b/src/couchdb/couch_httpd_misc_handlers.erl
@@ -38,7 +38,14 @@ 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);
+ {{Year,Month,Day},Time} = erlang:localtime(),
+ OneYearFromNow = {{Year+1,Month,Day},Time},
+ CachingHeaders = [
+ %favicon should expire a year from now
+ {"Cache-Control", "public, max-age=31536000"},
+ {"Expires", httpd_util:rfc1123_date(OneYearFromNow)}
+ ],
+ couch_httpd:serve_file(Req, "favicon.ico", DocumentRoot, CachingHeaders);
handle_favicon_req(Req, _) ->
send_method_not_allowed(Req, "GET,HEAD").