diff options
author | Dave Cottlehuber <dch@apache.org> | 2013-04-26 22:08:34 +0000 |
---|---|---|
committer | Dave Cottlehuber <dch@apache.org> | 2013-05-14 23:34:09 +0200 |
commit | 73db8179323c01bdd40eda2d587d52588f30a60f (patch) | |
tree | 8123e2cb434ba8269e4ef85805513349e389fea0 | |
parent | 94b402d94f39fae64580c061386c744a57f45c16 (diff) | |
download | couchdb-73db8179323c01bdd40eda2d587d52588f30a60f.tar.gz |
COUCHDB-1696 really fix R14B04 support
-rw-r--r-- | src/couchdb/couch_app.erl | 2 | ||||
-rw-r--r-- | src/mochiweb/Makefile.am | 1 | ||||
-rw-r--r-- | src/mochiweb/mochiweb.app.in | 33 | ||||
-rw-r--r-- | src/mochiweb/mochiweb.app.src | 9 | ||||
-rw-r--r-- | src/mochiweb/mochiweb_request.erl | 21 |
5 files changed, 26 insertions, 40 deletions
diff --git a/src/couchdb/couch_app.erl b/src/couchdb/couch_app.erl index f109780de..24b2f3a18 100644 --- a/src/couchdb/couch_app.erl +++ b/src/couchdb/couch_app.erl @@ -20,7 +20,7 @@ start(_Type, DefaultIniFiles) -> IniFiles = get_ini_files(DefaultIniFiles), - case start_apps([crypto, public_key, sasl, inets, oauth, ssl, ibrowse, mochiweb, os_mon]) of + case start_apps([crypto, public_key, sasl, inets, oauth, ssl, ibrowse, syntax_tools, compiler, xmerl, mochiweb, os_mon]) of ok -> couch_server_sup:start_link(IniFiles); {error, Reason} -> diff --git a/src/mochiweb/Makefile.am b/src/mochiweb/Makefile.am index d31a6eb9f..90c053315 100644 --- a/src/mochiweb/Makefile.am +++ b/src/mochiweb/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 \ diff --git a/src/mochiweb/mochiweb.app.in b/src/mochiweb/mochiweb.app.in index 6a4a314d8..baced90ef 100644 --- a/src/mochiweb/mochiweb.app.in +++ b/src/mochiweb/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]}]}. diff --git a/src/mochiweb/mochiweb.app.src b/src/mochiweb/mochiweb.app.src deleted file mode 100644 index baced90ef..000000000 --- a/src/mochiweb/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]}]}. diff --git a/src/mochiweb/mochiweb_request.erl b/src/mochiweb/mochiweb_request.erl index 2727fc731..267bcd82a 100644 --- a/src/mochiweb/mochiweb_request.erl +++ b/src/mochiweb/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()}]. |