You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by kx...@apache.org on 2016/03/14 05:27:23 UTC
couchdb commit: updated refs/heads/1.x.x to 051cdc3
Repository: couchdb
Updated Branches:
refs/heads/1.x.x 921006fa4 -> 051cdc36c
Fix favicon caching on leap year
COUCHDB-2956
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/051cdc36
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/051cdc36
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/051cdc36
Branch: refs/heads/1.x.x
Commit: 051cdc36cb0b7c9104204ea54abd02115b3d848f
Parents: 921006f
Author: Alexander Shorin <kx...@apache.org>
Authored: Sun Mar 6 17:24:56 2016 +0300
Committer: Alexander Shorin <kx...@apache.org>
Committed: Sun Mar 6 21:46:36 2016 +0300
----------------------------------------------------------------------
src/couchdb/couch_httpd_misc_handlers.erl | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/051cdc36/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 20a1bf3..dbf698c 100644
--- a/src/couchdb/couch_httpd_misc_handlers.erl
+++ b/src/couchdb/couch_httpd_misc_handlers.erl
@@ -45,12 +45,14 @@ handle_welcome_req(Req, _) ->
send_method_not_allowed(Req, "GET,HEAD").
handle_favicon_req(#httpd{method='GET'}=Req, DocumentRoot) ->
- {{Year,Month,Day},Time} = erlang:universaltime(),
- OneYearFromNow = {{Year+1,Month,Day},Time},
+ {DateNow, TimeNow} = calendar:universal_time(),
+ DaysNow = calendar:date_to_gregorian_days(DateNow),
+ DaysWhenExpires = DaysNow + 365,
+ DateWhenExpires = calendar:gregorian_days_to_date(DaysWhenExpires),
CachingHeaders = [
%favicon should expire a year from now
{"Cache-Control", "public, max-age=31536000"},
- {"Expires", couch_util:rfc1123_date(OneYearFromNow)}
+ {"Expires", couch_util:rfc1123_date({DateWhenExpires, TimeNow})}
],
couch_httpd:serve_file(Req, "favicon.ico", DocumentRoot, CachingHeaders);