You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2014/02/12 07:22:21 UTC

[49/50] [abbrv] mochiweb commit: updated refs/heads/import-master to 3a54dbf

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-mochiweb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/commit/d5ae31bb
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/tree/d5ae31bb
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/diff/d5ae31bb

Branch: refs/heads/import-master
Commit: d5ae31bbc8757826681daf9926a15d9062e29534
Parents: f82a693
Author: Robert Newson <rn...@apache.org>
Authored: Tue Mar 19 23:16:07 2013 +0100
Committer: Dave Cottlehuber <dc...@apache.org>
Committed: Thu Apr 25 00:13:57 2013 +0200

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


http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/d5ae31bb/mochiweb_cookies.erl
----------------------------------------------------------------------
diff --git a/mochiweb_cookies.erl b/mochiweb_cookies.erl
index 1cc4e91..3b71f4e 100644
--- a/mochiweb_cookies.erl
+++ b/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-mochiweb/blob/d5ae31bb/mochiweb_request.erl
----------------------------------------------------------------------
diff --git a/mochiweb_request.erl b/mochiweb_request.erl
index 1b431d3..2727fc7 100644
--- a/mochiweb_request.erl
+++ b/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)]];