couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject [6/8] git commit: updated refs/heads/master to d751a39
Date Wed, 24 Apr 2013 22:18:37 GMT
COUCHDB-627 - Support all timezones

Forward-ported over top of MochiWeb 2.4.2, comprising specific chunks
of b1a049bb, 445e919, 010522e, 317c97f lost during MochiWeb upgrade.

Some timezones are incorrectly handled by OTP's calendar module. The
ironic thing is that we only ever need the time in GMT (for HTTP
response headers and the log file).

This patch duplicates httpd_util:rfc1123_date/0 and /1 but uses
universal time everywhere, avoiding the broken conversion code.

- Support all timezones for R14 series.
- the _dst variant does exist in R14B04.
- Fix local to universal handling.

Also relates to COUCHDB-1513, a duplicate of COUCHDB-627.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/cdf8949d
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/cdf8949d
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/cdf8949d

Branch: refs/heads/master
Commit: cdf8949d341722423828471ca45d71f2fcb3a36d
Parents: b67b03e
Author: Robert Newson <rnewson@apache.org>
Authored: Tue Mar 19 23:16:07 2013 +0100
Committer: Dave Cottlehuber <dch@apache.org>
Committed: Thu Apr 25 00:13:57 2013 +0200

----------------------------------------------------------------------
 src/mochiweb/mochiweb_cookies.erl |    4 ++--
 src/mochiweb/mochiweb_request.erl |    6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/cdf8949d/src/mochiweb/mochiweb_cookies.erl
----------------------------------------------------------------------
diff --git a/src/mochiweb/mochiweb_cookies.erl b/src/mochiweb/mochiweb_cookies.erl
index 1cc4e91..3b71f4e 100644
--- a/src/mochiweb/mochiweb_cookies.erl
+++ b/src/mochiweb/mochiweb_cookies.erl
@@ -50,9 +50,9 @@ cookie(Key, Value, Options) ->
             RawAge ->
                 When = case proplists:get_value(local_time, Options) of
                            undefined ->
-                               calendar:local_time();
+                               calendar:universal_time();
                            LocalTime ->
-                               LocalTime
+                               calendar:local_time_to_universal_time_dst(LocalTime)
                        end,
                 Age = case RawAge < 0 of
                           true ->

http://git-wip-us.apache.org/repos/asf/couchdb/blob/cdf8949d/src/mochiweb/mochiweb_request.erl
----------------------------------------------------------------------
diff --git a/src/mochiweb/mochiweb_request.erl b/src/mochiweb/mochiweb_request.erl
index 1b431d3..2727fc7 100644
--- a/src/mochiweb/mochiweb_request.erl
+++ b/src/mochiweb/mochiweb_request.erl
@@ -621,9 +621,9 @@ maybe_redirect(RelPath, FullPath, ExtraHeaders,
     end.
 
 maybe_serve_file(File, ExtraHeaders, {?MODULE, [_Socket, _Method, _RawPath, _Version, _Headers]}=THIS)
->
-    case file:read_file_info(File) of
+    case file:read_file_info(File, [{time, universal}]) of
         {ok, FileInfo} ->
-            LastModified = httpd_util:rfc1123_date(FileInfo#file_info.mtime),
+            LastModified = couch_util:rfc1123_date(FileInfo#file_info.mtime),
             case get_header_value("if-modified-since", THIS) of
                 LastModified ->
                     respond({304, ExtraHeaders, ""}, THIS);
@@ -647,7 +647,7 @@ maybe_serve_file(File, ExtraHeaders, {?MODULE, [_Socket, _Method, _RawPath,
_Ver
 
 server_headers() ->
     [{"Server", "MochiWeb/1.0 (" ++ ?QUIP ++ ")"},
-     {"Date", httpd_util:rfc1123_date()}].
+     {"Date", couch_util:rfc1123_date()}].
 
 make_code(X) when is_integer(X) ->
     [integer_to_list(X), [" " | httpd_util:reason_phrase(X)]];


Mime
View raw message