You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ro...@apache.org on 2015/06/29 23:46:55 UTC
[49/50] couch commit: updated refs/heads/COUCHDB-2734-header-date to
f3e022c
revert cdf8949d341722423828471ca45d71f2fcb3a36d
this got fixed in R14B02 as OTP-9087
COUCHDB-627
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/b09aabed
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/b09aabed
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/b09aabed
Branch: refs/heads/COUCHDB-2734-header-date
Commit: b09aabed97b7b1300d70a73c0d19a398a6d744aa
Parents: 7e29740
Author: Robert Kowalski <ro...@kowalski.gd>
Authored: Fri Jun 26 23:41:41 2015 +0200
Committer: Robert Kowalski <ro...@kowalski.gd>
Committed: Fri Jun 26 23:41:41 2015 +0200
----------------------------------------------------------------------
src/mochiweb_cookies.erl | 13 ++++++-------
src/mochiweb_request.erl | 6 +++---
2 files changed, 9 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/b09aabed/src/mochiweb_cookies.erl
----------------------------------------------------------------------
diff --git a/src/mochiweb_cookies.erl b/src/mochiweb_cookies.erl
index 5e474df..f678042 100644
--- a/src/mochiweb_cookies.erl
+++ b/src/mochiweb_cookies.erl
@@ -50,9 +50,9 @@ cookie(Key, Value, Options) ->
RawAge ->
When = case proplists:get_value(local_time, Options) of
undefined ->
- calendar:universal_time();
+ calendar:local_time();
LocalTime ->
- erlang:localtime_to_universaltime(LocalTime)
+ LocalTime
end,
Age = case RawAge < 0 of
true ->
@@ -116,12 +116,11 @@ quote(V0) ->
orelse erlang:error({cookie_quoting_required, V}),
V.
-add_seconds(Secs, UniversalTime) ->
- Greg = calendar:datetime_to_gregorian_seconds(UniversalTime),
- calendar:gregorian_seconds_to_datetime(Greg + Secs).
+add_seconds(Secs, LocalTime) ->
+ Greg = calendar:datetime_to_gregorian_seconds(LocalTime),
-age_to_cookie_date(Age, UniversalTime) ->
- couch_util:rfc1123_date(add_seconds(Age, UniversalTime)).
+age_to_cookie_date(Age, LocalTime) ->
+ httpd_util:rfc1123_date(add_seconds(Age, LocalTime)).
%% @spec parse_cookie(string()) -> [{K::string(), V::string()}]
%% @doc Parse the contents of a Cookie header field, ignoring cookie
http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/b09aabed/src/mochiweb_request.erl
----------------------------------------------------------------------
diff --git a/src/mochiweb_request.erl b/src/mochiweb_request.erl
index d078e59..794e1e9 100644
--- a/src/mochiweb_request.erl
+++ b/src/mochiweb_request.erl
@@ -623,7 +623,7 @@ maybe_redirect(RelPath, FullPath, ExtraHeaders,
maybe_serve_file(File, ExtraHeaders, {?MODULE, [_Socket, _Method, _RawPath, _Version, _Headers]}=THIS) ->
case read_file_info(File) of
{ok, FileInfo} ->
- LastModified = couch_util:rfc1123_date(FileInfo#file_info.mtime),
+ LastModified = httpd_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
read_file_info(File) ->
try
- file:read_file_info(File, [{time, universal}])
+ file:read_file_info(File)
catch error:undef ->
case file:read_file_info(File) of
{ok, FileInfo} ->
@@ -666,7 +666,7 @@ to_universal(LocalTime) ->
server_headers() ->
[{"Server", "MochiWeb/1.0 (" ++ ?QUIP ++ ")"},
- {"Date", couch_util:rfc1123_date()}].
+ {"Date", httpd_util:rfc1123_date()}].
make_code(X) when is_integer(X) ->
[integer_to_list(X), [" " | httpd_util:reason_phrase(X)]];