couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject git commit: COUCHDB-627 - Support all timezones
Date Tue, 19 Mar 2013 22:26:46 GMT
Updated Branches:
  refs/heads/1696-update-mochiweb-2-4-2 ce495b256 -> 09b034911


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/09b03491
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/09b03491
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/09b03491

Branch: refs/heads/1696-update-mochiweb-2-4-2
Commit: 09b034911aed037839978d7e3f4905a4004fb74e
Parents: ce495b2
Author: Robert Newson <rnewson@apache.org>
Authored: Tue Mar 19 23:16:07 2013 +0100
Committer: Dave Cottlehuber <dch@apache.org>
Committed: Tue Mar 19 23:25:16 2013 +0100

----------------------------------------------------------------------
 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/09b03491/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/09b03491/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