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:22 UTC
[50/50] [abbrv] mochiweb commit: updated refs/heads/import-master to
3a54dbf
COUCHDB-1696 really fix R14B04 support
Project: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/commit/3a54dbfb
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/tree/3a54dbfb
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/diff/3a54dbfb
Branch: refs/heads/import-master
Commit: 3a54dbfbfbaa9f6ba50a09b3e999e1d865234d2f
Parents: d5ae31b
Author: Dave Cottlehuber <dc...@apache.org>
Authored: Fri Apr 26 22:08:34 2013 +0000
Committer: Dave Cottlehuber <dc...@apache.org>
Committed: Tue May 14 23:34:09 2013 +0200
----------------------------------------------------------------------
Makefile.am | 1 -
mochiweb.app.in | 33 +++++----------------------------
mochiweb.app.src | 9 ---------
mochiweb_request.erl | 21 ++++++++++++++++++++-
4 files changed, 25 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/3a54dbfb/Makefile.am
----------------------------------------------------------------------
diff --git a/Makefile.am b/Makefile.am
index d31a6eb..90c0533 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -30,7 +30,6 @@ mochiweb_file_collection = \
mochitemp.erl \
mochiutf8.erl \
mochiweb.app.in \
- mochiweb.app.src \
mochiweb.erl \
mochiweb_acceptor.erl \
mochiweb_app.erl \
http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/3a54dbfb/mochiweb.app.in
----------------------------------------------------------------------
diff --git a/mochiweb.app.in b/mochiweb.app.in
index 6a4a314..baced90 100644
--- a/mochiweb.app.in
+++ b/mochiweb.app.in
@@ -1,32 +1,9 @@
+%% This is generated from src/mochiweb.app.src
{application, mochiweb,
[{description, "MochiMedia Web Server"},
- {vsn, "1.4.1"},
- {modules, [
- mochihex,
- mochijson,
- mochijson2,
- mochinum,
- mochiweb,
- mochiweb_app,
- mochiweb_charref,
- mochiweb_cookies,
- mochiweb_echo,
- mochiweb_headers,
- mochiweb_html,
- mochiweb_http,
- mochiweb_multipart,
- mochiweb_request,
- mochiweb_response,
- mochiweb_skel,
- mochiweb_socket_server,
- mochiweb_sup,
- mochiweb_util,
- reloader,
- mochifmt,
- mochifmt_std,
- mochifmt_records
- ]},
+ {vsn, "2.4.2"},
+ {modules, []},
{registered, []},
- {mod, {mochiweb_app, []}},
{env, []},
- {applications, [kernel, stdlib]}]}.
+ {applications, [kernel, stdlib, crypto, inets, ssl, xmerl,
+ compiler, syntax_tools]}]}.
http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/3a54dbfb/mochiweb.app.src
----------------------------------------------------------------------
diff --git a/mochiweb.app.src b/mochiweb.app.src
deleted file mode 100644
index baced90..0000000
--- a/mochiweb.app.src
+++ /dev/null
@@ -1,9 +0,0 @@
-%% This is generated from src/mochiweb.app.src
-{application, mochiweb,
- [{description, "MochiMedia Web Server"},
- {vsn, "2.4.2"},
- {modules, []},
- {registered, []},
- {env, []},
- {applications, [kernel, stdlib, crypto, inets, ssl, xmerl,
- compiler, syntax_tools]}]}.
http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/3a54dbfb/mochiweb_request.erl
----------------------------------------------------------------------
diff --git a/mochiweb_request.erl b/mochiweb_request.erl
index 2727fc7..267bcd8 100644
--- a/mochiweb_request.erl
+++ b/mochiweb_request.erl
@@ -621,7 +621,7 @@ maybe_redirect(RelPath, FullPath, ExtraHeaders,
end.
maybe_serve_file(File, ExtraHeaders, {?MODULE, [_Socket, _Method, _RawPath, _Version, _Headers]}=THIS) ->
- case file:read_file_info(File, [{time, universal}]) of
+ case read_file_info(File) of
{ok, FileInfo} ->
LastModified = couch_util:rfc1123_date(FileInfo#file_info.mtime),
case get_header_value("if-modified-since", THIS) of
@@ -645,6 +645,25 @@ maybe_serve_file(File, ExtraHeaders, {?MODULE, [_Socket, _Method, _RawPath, _Ver
not_found(ExtraHeaders, THIS)
end.
+read_file_info(File) ->
+ try
+ file:read_file_info(File, [{time, universal}])
+ catch error:undef ->
+ case file:read_file_info(File) of
+ {ok, FileInfo} ->
+ {ok, FileInfo#file_info{
+ atime=to_universal(FileInfo#file_info.atime),
+ mtime=to_universal(FileInfo#file_info.mtime),
+ ctime=to_universal(FileInfo#file_info.ctime)
+ }};
+ Else ->
+ Else
+ end
+ end.
+
+to_universal(LocalTime) ->
+ calendar:local_time_to_universal_time(LocalTime).
+
server_headers() ->
[{"Server", "MochiWeb/1.0 (" ++ ?QUIP ++ ")"},
{"Date", couch_util:rfc1123_date()}].