added: setting a correct mime type for static files - using magic library

added: std::wstring file_mime_type to ItemContent - a mime type for static file
added: Header (core/header.h) - there will be header names defined, at the moment only content_type
added: FuncionsBase::Finish() - it is called at the end when the winix finishes
master
Tomasz Sowa 1 year ago
parent 26ed7b80be
commit 9c5c74ba84

@ -70,7 +70,7 @@ winix.so: $(winix.src.files)
@cd $(GLOBAL_WORKING_DIR)/tito/src ; $(MAKE) -e
@cd $(GLOBAL_WORKING_DIR)/pikotools ; $(MAKE) -e
@cd $(GLOBAL_WORKING_DIR)/morm/src ; $(MAKE) -e
$(CXX) -shared -rdynamic -Wl,-whole-archive -o winix.so $(CXXFLAGS) $(winix_include_paths) core/*.o db/*.o models/*.o functions/*.o templates/*.o notify/*.o $(GLOBAL_WORKING_DIR)/ezc/src/ezc.a $(GLOBAL_WORKING_DIR)/tito/src/tito.a $(GLOBAL_WORKING_DIR)/pikotools/src/pikotools.a $(GLOBAL_WORKING_DIR)/morm/src/morm.a $(LDFLAGS) -lfcgi -lpq -lz -lpthread -lcurl -Wl,-no-whole-archive
$(CXX) -shared -rdynamic -Wl,-whole-archive -o winix.so $(CXXFLAGS) $(winix_include_paths) core/*.o db/*.o models/*.o functions/*.o templates/*.o notify/*.o $(GLOBAL_WORKING_DIR)/ezc/src/ezc.a $(GLOBAL_WORKING_DIR)/tito/src/tito.a $(GLOBAL_WORKING_DIR)/pikotools/src/pikotools.a $(GLOBAL_WORKING_DIR)/morm/src/morm.a $(LDFLAGS) -lfcgi -lpq -lz -lpthread -lcurl -lmagic -Wl,-no-whole-archive
winix: winix.so $(winix.src.files)

File diff suppressed because one or more lines are too long

@ -116,7 +116,7 @@ app.o: rebus.h winixbase.h textstream.h ipban.h cur.h request.h
app.o: ../../../winix/winixd/models/item.h
app.o: ../../../winix/winixd/models/itemcontent.h
app.o: ../../../winix/winixd/templates/htmltextstream.h config.h
app.o: ../../../winix/winixd/models/winixmodel.h mount.h
app.o: ../../../winix/winixd/models/winixmodel.h header.h mount.h
app.o: winixmodeldeprecated.h plugin.h pluginmsg.h ipbancontainer.h
app.o: lastcontainer.h system.h job.h basethread.h dirs.h dircontainer.h
app.o: ../../../winix/winixd/db/db.h ../../../winix/winixd/db/dbbase.h
@ -537,7 +537,7 @@ dirs.o: ../../../winix/winixd/models/user.h
dirs.o: ../../../winix/winixd/models/group.h
dirs.o: ../../../winix/winixd/core/dircontainer.h
dirs.o: ../../../winix/winixd/core/ugcontainer.h request.h error.h config.h
dirs.o: textstream.h ../../../winix/winixd/models/winixmodel.h
dirs.o: textstream.h ../../../winix/winixd/models/winixmodel.h header.h
dirs.o: winixmodeldeprecated.h plugin.h pluginmsg.h plugindata.h
dirs.o: ../../../winix/winixd/notify/notify.h
dirs.o: ../../../winix/winixd/core/winixmodeldeprecated.h
@ -786,7 +786,7 @@ image.o: ../../../winix/winixd/models/item.h
image.o: ../../../winix/winixd/models/itemcontent.h
image.o: ../../../winix/winixd/templates/htmltextstream.h system.h job.h
image.o: dirs.h dircontainer.h request.h error.h config.h
image.o: ../../../winix/winixd/models/winixmodel.h mounts.h mount.h
image.o: ../../../winix/winixd/models/winixmodel.h header.h mounts.h mount.h
image.o: mountparser.h crypt.h run.h users.h ugcontainer.h lastcontainer.h
image.o: cur.h session.h rebus.h ipban.h groups.h loadavg.h threadmanager.h
image.o: ../../../winix/winixd/models/winixmodelconnector.h
@ -996,7 +996,7 @@ loadavg.o: ../../../ezc/src/objects.h ../../../ezc/src/pattern.h
loadavg.o: ../../../ezc/src/outstreams.h ../../../ezc/src/expressionparser.h
loadavg.o: ../../../ezc/src/models.h ../../../ezc/src/patternparser.h
loadavg.o: ../../../winix/winixd/templates/htmltextstream.h error.h config.h
loadavg.o: textstream.h ../../../winix/winixd/models/winixmodel.h
loadavg.o: textstream.h ../../../winix/winixd/models/winixmodel.h header.h
lock.o: lock.h synchro.h
log.o: log.h logmanipulators.h ../../../pikotools/src/log/log.h
log.o: ../../../pikotools/src/textstream/textstream.h
@ -1108,8 +1108,8 @@ misc.o: ../../../winix/winixd/core/winixrequest.h
misc.o: ../../../winix/winixd/core/winixsystem.h winixmodeldeprecated.h
misc.o: plugin.h pluginmsg.h plugindata.h ../../../winix/winixd/core/slog.h
misc.o: cur.h request.h error.h config.h textstream.h
misc.o: ../../../winix/winixd/models/winixmodel.h session.h rebus.h ipban.h
misc.o: mount.h ../../../winix/winixd/templates/locale.h
misc.o: ../../../winix/winixd/models/winixmodel.h header.h session.h rebus.h
misc.o: ipban.h mount.h ../../../winix/winixd/templates/locale.h
mount.o: mount.h misc.h requesttypes.h
mount.o: ../../../pikotools/src/textstream/textstream.h
mount.o: ../../../pikotools/src/textstream/stream.h
@ -1205,7 +1205,7 @@ mountparser.o: ../../../winix/winixd/models/group.h
mountparser.o: ../../../winix/winixd/core/dircontainer.h
mountparser.o: ../../../winix/winixd/core/ugcontainer.h request.h error.h
mountparser.o: config.h textstream.h
mountparser.o: ../../../winix/winixd/models/winixmodel.h
mountparser.o: ../../../winix/winixd/models/winixmodel.h header.h
mountparser.o: winixmodeldeprecated.h plugin.h pluginmsg.h plugindata.h
mounts.o: mounts.h mount.h error.h dirs.h dircontainer.h winixbase.h
mounts.o: ../../../winix/winixd/core/config.h
@ -1278,7 +1278,7 @@ mounts.o: ../../../winix/winixd/models/user.h
mounts.o: ../../../winix/winixd/models/group.h
mounts.o: ../../../winix/winixd/core/dircontainer.h
mounts.o: ../../../winix/winixd/core/ugcontainer.h request.h config.h
mounts.o: textstream.h ../../../winix/winixd/models/winixmodel.h
mounts.o: textstream.h ../../../winix/winixd/models/winixmodel.h header.h
mounts.o: winixmodeldeprecated.h plugin.h pluginmsg.h plugindata.h
mounts.o: mountparser.h cur.h session.h rebus.h ipban.h
plugin.o: plugin.h pluginmsg.h plugindata.h winixbase.h
@ -1354,8 +1354,8 @@ plugin.o: ../../../winix/winixd/models/user.h
plugin.o: ../../../winix/winixd/models/group.h
plugin.o: ../../../winix/winixd/core/dircontainer.h
plugin.o: ../../../winix/winixd/core/ugcontainer.h request.h error.h config.h
plugin.o: textstream.h ../../../winix/winixd/models/winixmodel.h mounts.h
plugin.o: mount.h mountparser.h crypt.h run.h users.h ugcontainer.h
plugin.o: textstream.h ../../../winix/winixd/models/winixmodel.h header.h
plugin.o: mounts.h mount.h mountparser.h crypt.h run.h users.h ugcontainer.h
plugin.o: lastcontainer.h cur.h session.h rebus.h ipban.h groups.h loadavg.h
plugin.o: image.h threadmanager.h
plugin.o: ../../../winix/winixd/models/winixmodelconnector.h
@ -1584,8 +1584,9 @@ rebus.o: ../../../ezc/src/pattern.h ../../../ezc/src/outstreams.h
rebus.o: ../../../ezc/src/expressionparser.h ../../../ezc/src/models.h
rebus.o: ../../../ezc/src/patternparser.h
rebus.o: ../../../winix/winixd/templates/htmltextstream.h error.h config.h
rebus.o: textstream.h ../../../winix/winixd/models/winixmodel.h session.h
rebus.o: ../../../winix/winixd/models/user.h plugindata.h ipban.h mount.h
rebus.o: textstream.h ../../../winix/winixd/models/winixmodel.h header.h
rebus.o: session.h ../../../winix/winixd/models/user.h plugindata.h ipban.h
rebus.o: mount.h
request.o: request.h requesttypes.h
request.o: ../../../pikotools/src/textstream/textstream.h
request.o: ../../../pikotools/src/textstream/stream.h
@ -1649,8 +1650,8 @@ request.o: ../../../ezc/src/objects.h ../../../ezc/src/pattern.h
request.o: ../../../ezc/src/outstreams.h ../../../ezc/src/expressionparser.h
request.o: ../../../ezc/src/models.h ../../../ezc/src/patternparser.h
request.o: ../../../winix/winixd/templates/htmltextstream.h error.h config.h
request.o: textstream.h ../../../winix/winixd/models/winixmodel.h plugin.h
request.o: pluginmsg.h plugindata.h winixbase.h
request.o: textstream.h ../../../winix/winixd/models/winixmodel.h header.h
request.o: plugin.h pluginmsg.h plugindata.h winixbase.h
request.o: ../../../winix/winixd/functions/functionbase.h
request.o: ../../../winix/winixd/db/db.h ../../../winix/winixd/db/dbbase.h
request.o: ../../../winix/winixd/db/dbconn.h
@ -1852,8 +1853,8 @@ sessioncontainer.o: plugindata.h rebus.h winixbase.h textstream.h ipban.h
sessioncontainer.o: cur.h request.h ../../../winix/winixd/models/item.h
sessioncontainer.o: ../../../winix/winixd/models/itemcontent.h
sessioncontainer.o: ../../../winix/winixd/templates/htmltextstream.h config.h
sessioncontainer.o: ../../../winix/winixd/models/winixmodel.h mount.h
sessioncontainer.o: winixmodeldeprecated.h plugin.h pluginmsg.h
sessioncontainer.o: ../../../winix/winixd/models/winixmodel.h header.h
sessioncontainer.o: mount.h winixmodeldeprecated.h plugin.h pluginmsg.h
sessionidmanager.o: sessionidmanager.h ../../../tito/src/base64.h
sessionidmanager.o: ../../../pikotools/src/space/space.h
sessionidmanager.o: ../../../tito/src/aes.h winixbase.h
@ -1981,7 +1982,7 @@ sessionmanager.o: plugindata.h rebus.h winixbase.h textstream.h ipban.h cur.h
sessionmanager.o: request.h ../../../winix/winixd/models/item.h
sessionmanager.o: ../../../winix/winixd/models/itemcontent.h
sessionmanager.o: ../../../winix/winixd/templates/htmltextstream.h config.h
sessionmanager.o: ../../../winix/winixd/models/winixmodel.h mount.h
sessionmanager.o: ../../../winix/winixd/models/winixmodel.h header.h mount.h
sessionmanager.o: winixmodeldeprecated.h plugin.h pluginmsg.h
sessionmanager.o: ipbancontainer.h lastcontainer.h system.h job.h
sessionmanager.o: basethread.h dirs.h dircontainer.h
@ -2088,7 +2089,7 @@ sessionparser.o: sessioncontainer.h cur.h request.h
sessionparser.o: ../../../winix/winixd/models/item.h
sessionparser.o: ../../../winix/winixd/models/itemcontent.h
sessionparser.o: ../../../winix/winixd/templates/htmltextstream.h config.h
sessionparser.o: ../../../winix/winixd/models/winixmodel.h mount.h
sessionparser.o: ../../../winix/winixd/models/winixmodel.h header.h mount.h
sessionparser.o: winixmodeldeprecated.h plugin.h pluginmsg.h users.h
sessionparser.o: ugcontainer.h lastcontainer.h ../../../winix/winixd/db/db.h
sessionparser.o: ../../../winix/winixd/db/dbbase.h
@ -2160,9 +2161,9 @@ slog.o: ../../../ezc/src/objects.h ../../../ezc/src/pattern.h
slog.o: ../../../ezc/src/outstreams.h ../../../ezc/src/expressionparser.h
slog.o: ../../../ezc/src/models.h ../../../ezc/src/patternparser.h
slog.o: ../../../winix/winixd/templates/htmltextstream.h error.h config.h
slog.o: textstream.h ../../../winix/winixd/models/winixmodel.h session.h
slog.o: ../../../winix/winixd/models/user.h plugindata.h rebus.h winixbase.h
slog.o: ipban.h mount.h ../../../winix/winixd/templates/locale.h
slog.o: textstream.h ../../../winix/winixd/models/winixmodel.h header.h
slog.o: session.h ../../../winix/winixd/models/user.h plugindata.h rebus.h
slog.o: winixbase.h ipban.h mount.h ../../../winix/winixd/templates/locale.h
synchro.o: synchro.h
system.o: system.h job.h basethread.h synchro.h winixmodeldeprecated.h
system.o: ../../../winix/winixd/core/winixbase.h
@ -2236,8 +2237,8 @@ system.o: ../../../winix/winixd/models/user.h
system.o: ../../../winix/winixd/models/group.h
system.o: ../../../winix/winixd/core/dircontainer.h
system.o: ../../../winix/winixd/core/ugcontainer.h request.h error.h config.h
system.o: textstream.h ../../../winix/winixd/models/winixmodel.h mounts.h
system.o: mount.h mountparser.h crypt.h run.h users.h ugcontainer.h
system.o: textstream.h ../../../winix/winixd/models/winixmodel.h header.h
system.o: mounts.h mount.h mountparser.h crypt.h run.h users.h ugcontainer.h
system.o: lastcontainer.h cur.h session.h rebus.h ipban.h groups.h loadavg.h
system.o: image.h threadmanager.h
system.o: ../../../winix/winixd/models/winixmodelconnector.h
@ -2483,9 +2484,10 @@ users.o: lastcontainer.h winixbase.h cur.h request.h
users.o: ../../../winix/winixd/models/item.h
users.o: ../../../winix/winixd/models/itemcontent.h
users.o: ../../../winix/winixd/templates/htmltextstream.h error.h config.h
users.o: textstream.h ../../../winix/winixd/models/winixmodel.h session.h
users.o: plugindata.h rebus.h ipban.h mount.h ../../../winix/winixd/db/db.h
users.o: ../../../winix/winixd/db/dbbase.h ../../../winix/winixd/db/dbconn.h
users.o: textstream.h ../../../winix/winixd/models/winixmodel.h header.h
users.o: session.h plugindata.h rebus.h ipban.h mount.h
users.o: ../../../winix/winixd/db/db.h ../../../winix/winixd/db/dbbase.h
users.o: ../../../winix/winixd/db/dbconn.h
users.o: ../../../winix/winixd/db/dbtextstream.h
users.o: ../../../winix/winixd/core/textstream.h
users.o: ../../../winix/winixd/core/error.h

@ -405,6 +405,7 @@ void App::Close()
session_manager.DeleteSessions();
cur.request->Clear();
session_manager.UninitTmpSession();
functions.Finish();
// now all sessions are cleared
}
@ -1492,29 +1493,29 @@ void App::PrepareHeadersStatic()
void App::PrepareHeaderContentType()
{
if( !cur.request->out_headers.has_key(L"Content-Type") )
if( !cur.request->out_headers.has_key(Winix::Header::content_type) )
{
if( !cur.request->send_bin_stream )
{
if( cur.request->return_json )
{
cur.request->out_headers.add(L"Content-Type", L"application/json; charset=UTF-8");
cur.request->out_headers.add(Winix::Header::content_type, L"application/json; charset=UTF-8");
}
else
{
switch( config.content_type_header )
{
case 1:
cur.request->out_headers.add(L"Content-Type", L"application/xhtml+xml; charset=UTF-8");
cur.request->out_headers.add(Winix::Header::content_type, L"application/xhtml+xml; charset=UTF-8");
break;
case 2:
cur.request->out_headers.add(L"Content-Type", L"application/xml; charset=UTF-8");
cur.request->out_headers.add(Winix::Header::content_type, L"application/xml; charset=UTF-8");
break;
case 0:
default:
cur.request->out_headers.add(L"Content-Type", L"text/html; charset=UTF-8");
cur.request->out_headers.add(Winix::Header::content_type, L"text/html; charset=UTF-8");
}
}
}

@ -0,0 +1,56 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2021, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef headerfile_winix_core_header
#define headerfile_winix_core_header
namespace Winix
{
class Header
{
public:
static constexpr const wchar_t * content_type = L"Content-Type";
};
}
#endif

@ -49,8 +49,8 @@
#include "textstream/textstream.h"
#include "outstreams.h"
#include "models.h"
#include "models/winixmodel.h"
#include "header.h"
namespace Winix

@ -83,6 +83,7 @@ account.o: ../../../winix/winixd/core/config.h
account.o: ../../../winix/winixd/core/textstream.h
account.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
account.o: ../../../winix/winixd/models/winixmodel.h
account.o: ../../../winix/winixd/core/header.h
account.o: ../../../winix/winixd/core/session.h
account.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
account.o: ../../../winix/winixd/core/system.h
@ -222,6 +223,7 @@ adduser.o: ../../../winix/winixd/core/config.h
adduser.o: ../../../winix/winixd/core/textstream.h
adduser.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
adduser.o: ../../../winix/winixd/models/winixmodel.h
adduser.o: ../../../winix/winixd/core/header.h
adduser.o: ../../../winix/winixd/core/session.h
adduser.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
adduser.o: ../../../winix/winixd/core/system.h
@ -353,6 +355,7 @@ cat.o: ../../../ezc/src/funinfo.h ../../../winix/winixd/core/error.h
cat.o: ../../../winix/winixd/core/config.h
cat.o: ../../../winix/winixd/core/textstream.h ../../../ezc/src/outstreams.h
cat.o: ../../../ezc/src/models.h ../../../winix/winixd/models/winixmodel.h
cat.o: ../../../winix/winixd/core/header.h
cat.o: ../../../winix/winixd/core/session.h
cat.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
cat.o: ../../../winix/winixd/core/system.h ../../../winix/winixd/core/job.h
@ -485,6 +488,7 @@ chmod.o: ../../../winix/winixd/core/config.h
chmod.o: ../../../winix/winixd/core/textstream.h
chmod.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
chmod.o: ../../../winix/winixd/models/winixmodel.h
chmod.o: ../../../winix/winixd/core/header.h
chmod.o: ../../../winix/winixd/core/session.h
chmod.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
chmod.o: ../../../winix/winixd/core/system.h ../../../winix/winixd/core/job.h
@ -617,6 +621,7 @@ chown.o: ../../../winix/winixd/core/config.h
chown.o: ../../../winix/winixd/core/textstream.h
chown.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
chown.o: ../../../winix/winixd/models/winixmodel.h
chown.o: ../../../winix/winixd/core/header.h
chown.o: ../../../winix/winixd/core/session.h
chown.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
chown.o: ../../../winix/winixd/core/system.h ../../../winix/winixd/core/job.h
@ -751,6 +756,7 @@ ckeditor.o: ../../../winix/winixd/core/config.h
ckeditor.o: ../../../winix/winixd/core/textstream.h
ckeditor.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
ckeditor.o: ../../../winix/winixd/models/winixmodel.h
ckeditor.o: ../../../winix/winixd/core/header.h
ckeditor.o: ../../../winix/winixd/core/session.h
ckeditor.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
ckeditor.o: ../../../winix/winixd/core/system.h
@ -881,6 +887,7 @@ cp.o: ../../../ezc/src/funinfo.h ../../../winix/winixd/core/error.h
cp.o: ../../../winix/winixd/core/config.h
cp.o: ../../../winix/winixd/core/textstream.h ../../../ezc/src/outstreams.h
cp.o: ../../../ezc/src/models.h ../../../winix/winixd/models/winixmodel.h
cp.o: ../../../winix/winixd/core/header.h
cp.o: ../../../winix/winixd/core/session.h ../../../winix/winixd/core/rebus.h
cp.o: ipban.h mount.h ../../../winix/winixd/core/system.h
cp.o: ../../../winix/winixd/core/job.h
@ -1015,6 +1022,7 @@ default.o: ../../../winix/winixd/core/config.h
default.o: ../../../winix/winixd/core/textstream.h
default.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
default.o: ../../../winix/winixd/models/winixmodel.h
default.o: ../../../winix/winixd/core/header.h
default.o: ../../../winix/winixd/core/session.h
default.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
default.o: ../../../winix/winixd/core/system.h
@ -1153,6 +1161,7 @@ download.o: ../../../winix/winixd/core/config.h
download.o: ../../../winix/winixd/core/textstream.h
download.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
download.o: ../../../winix/winixd/models/winixmodel.h
download.o: ../../../winix/winixd/core/header.h
download.o: ../../../winix/winixd/core/session.h
download.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
download.o: ../../../winix/winixd/core/system.h
@ -1289,6 +1298,7 @@ emacs.o: ../../../winix/winixd/core/config.h
emacs.o: ../../../winix/winixd/core/textstream.h
emacs.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
emacs.o: ../../../winix/winixd/models/winixmodel.h
emacs.o: ../../../winix/winixd/core/header.h
emacs.o: ../../../winix/winixd/core/session.h
emacs.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
emacs.o: ../../../winix/winixd/core/system.h ../../../winix/winixd/core/job.h
@ -1423,6 +1433,7 @@ env.o: ../../../ezc/src/funinfo.h ../../../winix/winixd/core/error.h
env.o: ../../../winix/winixd/core/config.h
env.o: ../../../winix/winixd/core/textstream.h ../../../ezc/src/outstreams.h
env.o: ../../../ezc/src/models.h ../../../winix/winixd/models/winixmodel.h
env.o: ../../../winix/winixd/core/header.h
env.o: ../../../winix/winixd/core/session.h
env.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
env.o: ../../../winix/winixd/core/system.h ../../../winix/winixd/core/job.h
@ -1557,6 +1568,7 @@ functionbase.o: ../../../winix/winixd/core/config.h
functionbase.o: ../../../winix/winixd/core/textstream.h
functionbase.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
functionbase.o: ../../../winix/winixd/models/winixmodel.h
functionbase.o: ../../../winix/winixd/core/header.h
functionbase.o: ../../../winix/winixd/core/session.h
functionbase.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
functionbase.o: ../../../winix/winixd/core/system.h
@ -1711,6 +1723,7 @@ functionparser.o: ../../../winix/winixd/core/config.h
functionparser.o: ../../../winix/winixd/core/textstream.h
functionparser.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
functionparser.o: ../../../winix/winixd/models/winixmodel.h
functionparser.o: ../../../winix/winixd/core/header.h
functionparser.o: ../../../winix/winixd/core/mounts.h mount.h
functionparser.o: ../../../winix/winixd/core/mountparser.h
functionparser.o: ../../../winix/winixd/core/crypt.h run.h
@ -1854,6 +1867,7 @@ functions.o: ../../../winix/winixd/core/error.h
functions.o: ../../../winix/winixd/core/config.h
functions.o: ../../../winix/winixd/core/textstream.h
functions.o: ../../../winix/winixd/models/winixmodel.h
functions.o: ../../../winix/winixd/core/header.h
functions.o: ../../../winix/winixd/core/mounts.h mount.h
functions.o: ../../../winix/winixd/core/mountparser.h
functions.o: ../../../winix/winixd/core/crypt.h run.h
@ -1990,6 +2004,7 @@ imgcrop.o: ../../../winix/winixd/core/config.h
imgcrop.o: ../../../winix/winixd/core/textstream.h
imgcrop.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
imgcrop.o: ../../../winix/winixd/models/winixmodel.h
imgcrop.o: ../../../winix/winixd/core/header.h
imgcrop.o: ../../../winix/winixd/core/session.h
imgcrop.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
imgcrop.o: ../../../winix/winixd/core/system.h
@ -2125,6 +2140,7 @@ ipban.o: ../../../winix/winixd/core/config.h
ipban.o: ../../../winix/winixd/core/textstream.h
ipban.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
ipban.o: ../../../winix/winixd/models/winixmodel.h
ipban.o: ../../../winix/winixd/core/header.h
ipban.o: ../../../winix/winixd/core/session.h
ipban.o: ../../../winix/winixd/core/rebus.h mount.h
ipban.o: ../../../winix/winixd/core/system.h ../../../winix/winixd/core/job.h
@ -2254,6 +2270,7 @@ last.o: ../../../ezc/src/funinfo.h ../../../winix/winixd/core/error.h
last.o: ../../../winix/winixd/core/config.h
last.o: ../../../winix/winixd/core/textstream.h ../../../ezc/src/outstreams.h
last.o: ../../../ezc/src/models.h ../../../winix/winixd/models/winixmodel.h
last.o: ../../../winix/winixd/core/header.h
last.o: ../../../winix/winixd/core/session.h
last.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
last.o: ../../../winix/winixd/core/system.h ../../../winix/winixd/core/job.h
@ -2380,6 +2397,7 @@ ln.o: ../../../ezc/src/funinfo.h ../../../winix/winixd/core/error.h
ln.o: ../../../winix/winixd/core/config.h
ln.o: ../../../winix/winixd/core/textstream.h ../../../ezc/src/outstreams.h
ln.o: ../../../ezc/src/models.h ../../../winix/winixd/models/winixmodel.h
ln.o: ../../../winix/winixd/core/header.h
ln.o: ../../../winix/winixd/core/session.h ../../../winix/winixd/core/rebus.h
ln.o: ipban.h mount.h ../../../winix/winixd/core/system.h
ln.o: ../../../winix/winixd/core/job.h
@ -2513,6 +2531,7 @@ locale.o: ../../../winix/winixd/core/config.h
locale.o: ../../../winix/winixd/core/textstream.h
locale.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
locale.o: ../../../winix/winixd/models/winixmodel.h
locale.o: ../../../winix/winixd/core/header.h
locale.o: ../../../winix/winixd/core/session.h
locale.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
locale.o: ../../../winix/winixd/core/system.h
@ -2658,6 +2677,7 @@ login.o: ../../../winix/winixd/core/config.h
login.o: ../../../winix/winixd/core/textstream.h
login.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
login.o: ../../../winix/winixd/models/winixmodel.h
login.o: ../../../winix/winixd/core/header.h
login.o: ../../../winix/winixd/core/mounts.h mount.h
login.o: ../../../winix/winixd/core/mountparser.h
login.o: ../../../winix/winixd/core/crypt.h run.h
@ -2786,6 +2806,7 @@ logout.o: ../../../winix/winixd/core/config.h
logout.o: ../../../winix/winixd/core/textstream.h
logout.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
logout.o: ../../../winix/winixd/models/winixmodel.h
logout.o: ../../../winix/winixd/core/header.h
logout.o: ../../../winix/winixd/core/session.h
logout.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
logout.o: ../../../winix/winixd/core/system.h
@ -2915,6 +2936,7 @@ ls.o: ../../../ezc/src/funinfo.h ../../../winix/winixd/core/error.h
ls.o: ../../../winix/winixd/core/config.h
ls.o: ../../../winix/winixd/core/textstream.h ../../../ezc/src/outstreams.h
ls.o: ../../../ezc/src/models.h ../../../winix/winixd/models/winixmodel.h
ls.o: ../../../winix/winixd/core/header.h
ls.o: ../../../winix/winixd/core/session.h ../../../winix/winixd/core/rebus.h
ls.o: ipban.h mount.h ../../../winix/winixd/core/system.h
ls.o: ../../../winix/winixd/core/job.h
@ -3040,6 +3062,7 @@ man.o: ../../../ezc/src/funinfo.h ../../../winix/winixd/core/error.h
man.o: ../../../winix/winixd/core/config.h
man.o: ../../../winix/winixd/core/textstream.h ../../../ezc/src/outstreams.h
man.o: ../../../ezc/src/models.h ../../../winix/winixd/models/winixmodel.h
man.o: ../../../winix/winixd/core/header.h
man.o: ../../../winix/winixd/core/session.h
man.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
man.o: ../../../winix/winixd/core/system.h ../../../winix/winixd/core/job.h
@ -3168,6 +3191,7 @@ meta.o: ../../../ezc/src/funinfo.h ../../../winix/winixd/core/error.h
meta.o: ../../../winix/winixd/core/config.h
meta.o: ../../../winix/winixd/core/textstream.h ../../../ezc/src/outstreams.h
meta.o: ../../../ezc/src/models.h ../../../winix/winixd/models/winixmodel.h
meta.o: ../../../winix/winixd/core/header.h
meta.o: ../../../winix/winixd/core/session.h
meta.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
meta.o: ../../../winix/winixd/core/system.h ../../../winix/winixd/core/job.h
@ -3300,6 +3324,7 @@ mkdir.o: ../../../winix/winixd/core/config.h
mkdir.o: ../../../winix/winixd/core/textstream.h
mkdir.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
mkdir.o: ../../../winix/winixd/models/winixmodel.h
mkdir.o: ../../../winix/winixd/core/header.h
mkdir.o: ../../../winix/winixd/core/session.h
mkdir.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
mkdir.o: ../../../winix/winixd/core/system.h ../../../winix/winixd/core/job.h
@ -3433,6 +3458,7 @@ mount.o: ../../../winix/winixd/core/config.h
mount.o: ../../../winix/winixd/core/textstream.h
mount.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
mount.o: ../../../winix/winixd/models/winixmodel.h
mount.o: ../../../winix/winixd/core/header.h
mount.o: ../../../winix/winixd/core/session.h
mount.o: ../../../winix/winixd/core/rebus.h ipban.h
mount.o: ../../../winix/winixd/core/system.h ../../../winix/winixd/core/job.h
@ -3560,6 +3586,7 @@ mv.o: ../../../ezc/src/funinfo.h ../../../winix/winixd/core/error.h
mv.o: ../../../winix/winixd/core/config.h
mv.o: ../../../winix/winixd/core/textstream.h ../../../ezc/src/outstreams.h
mv.o: ../../../ezc/src/models.h ../../../winix/winixd/models/winixmodel.h
mv.o: ../../../winix/winixd/core/header.h
mv.o: ../../../winix/winixd/core/session.h ../../../winix/winixd/core/rebus.h
mv.o: ipban.h mount.h ../../../winix/winixd/core/system.h
mv.o: ../../../winix/winixd/core/job.h
@ -3693,6 +3720,7 @@ nicedit.o: ../../../winix/winixd/core/config.h
nicedit.o: ../../../winix/winixd/core/textstream.h
nicedit.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
nicedit.o: ../../../winix/winixd/models/winixmodel.h
nicedit.o: ../../../winix/winixd/core/header.h
nicedit.o: ../../../winix/winixd/core/session.h
nicedit.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
nicedit.o: ../../../winix/winixd/core/system.h
@ -3824,6 +3852,7 @@ node.o: ../../../ezc/src/funinfo.h ../../../winix/winixd/core/error.h
node.o: ../../../winix/winixd/core/config.h
node.o: ../../../winix/winixd/core/textstream.h ../../../ezc/src/outstreams.h
node.o: ../../../ezc/src/models.h ../../../winix/winixd/models/winixmodel.h
node.o: ../../../winix/winixd/core/header.h
node.o: ../../../winix/winixd/core/session.h
node.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
node.o: ../../../winix/winixd/core/system.h ../../../winix/winixd/core/job.h
@ -3956,6 +3985,7 @@ passwd.o: ../../../winix/winixd/core/config.h
passwd.o: ../../../winix/winixd/core/textstream.h
passwd.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
passwd.o: ../../../winix/winixd/models/winixmodel.h
passwd.o: ../../../winix/winixd/core/header.h
passwd.o: ../../../winix/winixd/core/session.h
passwd.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
passwd.o: ../../../winix/winixd/core/system.h
@ -4088,6 +4118,7 @@ priv.o: ../../../ezc/src/funinfo.h ../../../winix/winixd/core/error.h
priv.o: ../../../winix/winixd/core/config.h
priv.o: ../../../winix/winixd/core/textstream.h ../../../ezc/src/outstreams.h
priv.o: ../../../ezc/src/models.h ../../../winix/winixd/models/winixmodel.h
priv.o: ../../../winix/winixd/core/header.h
priv.o: ../../../winix/winixd/core/session.h
priv.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
priv.o: ../../../winix/winixd/core/system.h ../../../winix/winixd/core/job.h
@ -4243,6 +4274,7 @@ privchanger.o: ../../../winix/winixd/core/config.h
privchanger.o: ../../../winix/winixd/core/textstream.h
privchanger.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
privchanger.o: ../../../winix/winixd/models/winixmodel.h
privchanger.o: ../../../winix/winixd/core/header.h
privchanger.o: ../../../winix/winixd/core/session.h
privchanger.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h account.h
privchanger.o: adduser.h cat.h chmod.h chown.h ckeditor.h cp.h default.h
@ -4355,6 +4387,7 @@ pw.o: ../../../ezc/src/funinfo.h ../../../winix/winixd/core/error.h
pw.o: ../../../winix/winixd/core/config.h
pw.o: ../../../winix/winixd/core/textstream.h ../../../ezc/src/outstreams.h
pw.o: ../../../ezc/src/models.h ../../../winix/winixd/models/winixmodel.h
pw.o: ../../../winix/winixd/core/header.h
pw.o: ../../../winix/winixd/core/session.h ../../../winix/winixd/core/rebus.h
pw.o: ipban.h mount.h ../../../winix/winixd/core/system.h
pw.o: ../../../winix/winixd/core/job.h
@ -4487,6 +4520,7 @@ reload.o: ../../../winix/winixd/core/config.h
reload.o: ../../../winix/winixd/core/textstream.h
reload.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
reload.o: ../../../winix/winixd/models/winixmodel.h
reload.o: ../../../winix/winixd/core/header.h
reload.o: ../../../winix/winixd/core/session.h
reload.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
reload.o: ../../../winix/winixd/core/system.h
@ -4621,6 +4655,7 @@ rm.o: ../../../ezc/src/funinfo.h ../../../winix/winixd/core/error.h
rm.o: ../../../winix/winixd/core/config.h
rm.o: ../../../winix/winixd/core/textstream.h ../../../ezc/src/outstreams.h
rm.o: ../../../ezc/src/models.h ../../../winix/winixd/models/winixmodel.h
rm.o: ../../../winix/winixd/core/header.h
rm.o: ../../../winix/winixd/core/session.h ../../../winix/winixd/core/rebus.h
rm.o: ipban.h mount.h ../../../winix/winixd/core/system.h
rm.o: ../../../winix/winixd/core/job.h
@ -4758,6 +4793,7 @@ rmuser.o: ../../../winix/winixd/core/config.h
rmuser.o: ../../../winix/winixd/core/textstream.h
rmuser.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
rmuser.o: ../../../winix/winixd/models/winixmodel.h
rmuser.o: ../../../winix/winixd/core/header.h
rmuser.o: ../../../winix/winixd/core/session.h
rmuser.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
rmuser.o: ../../../winix/winixd/core/system.h
@ -4890,6 +4926,7 @@ run.o: ../../../ezc/src/funinfo.h ../../../winix/winixd/core/error.h
run.o: ../../../winix/winixd/core/config.h
run.o: ../../../winix/winixd/core/textstream.h ../../../ezc/src/outstreams.h
run.o: ../../../ezc/src/models.h ../../../winix/winixd/models/winixmodel.h
run.o: ../../../winix/winixd/core/header.h
run.o: ../../../winix/winixd/core/session.h
run.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
run.o: ../../../winix/winixd/core/system.h ../../../winix/winixd/core/job.h
@ -5017,6 +5054,7 @@ sort.o: ../../../ezc/src/funinfo.h ../../../winix/winixd/core/error.h
sort.o: ../../../winix/winixd/core/config.h
sort.o: ../../../winix/winixd/core/textstream.h ../../../ezc/src/outstreams.h
sort.o: ../../../ezc/src/models.h ../../../winix/winixd/models/winixmodel.h
sort.o: ../../../winix/winixd/core/header.h
sort.o: ../../../winix/winixd/core/session.h
sort.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
sort.o: ../../../winix/winixd/core/system.h ../../../winix/winixd/core/job.h
@ -5159,6 +5197,7 @@ specialdefault.o: ../../../winix/winixd/core/config.h
specialdefault.o: ../../../winix/winixd/core/textstream.h
specialdefault.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
specialdefault.o: ../../../winix/winixd/models/winixmodel.h
specialdefault.o: ../../../winix/winixd/core/header.h
specialdefault.o: ../../../winix/winixd/core/session.h
specialdefault.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
specialdefault.o: ../../../winix/winixd/core/system.h
@ -5292,6 +5331,7 @@ stat.o: ../../../ezc/src/funinfo.h ../../../winix/winixd/core/error.h
stat.o: ../../../winix/winixd/core/config.h
stat.o: ../../../winix/winixd/core/textstream.h ../../../ezc/src/outstreams.h
stat.o: ../../../ezc/src/models.h ../../../winix/winixd/models/winixmodel.h
stat.o: ../../../winix/winixd/core/header.h
stat.o: ../../../winix/winixd/core/session.h
stat.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
stat.o: ../../../winix/winixd/core/system.h ../../../winix/winixd/core/job.h
@ -5426,6 +5466,7 @@ subject.o: ../../../winix/winixd/core/config.h
subject.o: ../../../winix/winixd/core/textstream.h
subject.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
subject.o: ../../../winix/winixd/models/winixmodel.h
subject.o: ../../../winix/winixd/core/header.h
subject.o: ../../../winix/winixd/core/session.h
subject.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
subject.o: ../../../winix/winixd/core/system.h
@ -5563,6 +5604,7 @@ template.o: ../../../winix/winixd/core/config.h
template.o: ../../../winix/winixd/core/textstream.h
template.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
template.o: ../../../winix/winixd/models/winixmodel.h
template.o: ../../../winix/winixd/core/header.h
template.o: ../../../winix/winixd/core/session.h
template.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
template.o: ../../../winix/winixd/core/system.h
@ -5701,6 +5743,7 @@ timezone.o: ../../../winix/winixd/core/config.h
timezone.o: ../../../winix/winixd/core/textstream.h
timezone.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
timezone.o: ../../../winix/winixd/models/winixmodel.h
timezone.o: ../../../winix/winixd/core/header.h
timezone.o: ../../../winix/winixd/core/session.h
timezone.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
timezone.o: ../../../winix/winixd/core/system.h
@ -5838,6 +5881,7 @@ tinymce.o: ../../../winix/winixd/core/config.h
tinymce.o: ../../../winix/winixd/core/textstream.h
tinymce.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
tinymce.o: ../../../winix/winixd/models/winixmodel.h
tinymce.o: ../../../winix/winixd/core/header.h
tinymce.o: ../../../winix/winixd/core/session.h
tinymce.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
tinymce.o: ../../../winix/winixd/core/system.h
@ -5973,6 +6017,7 @@ uname.o: ../../../winix/winixd/core/config.h
uname.o: ../../../winix/winixd/core/textstream.h
uname.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
uname.o: ../../../winix/winixd/models/winixmodel.h
uname.o: ../../../winix/winixd/core/header.h
uname.o: ../../../winix/winixd/core/session.h
uname.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
uname.o: ../../../winix/winixd/core/system.h ../../../winix/winixd/core/job.h
@ -6106,6 +6151,7 @@ upload.o: ../../../winix/winixd/core/config.h
upload.o: ../../../winix/winixd/core/textstream.h
upload.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
upload.o: ../../../winix/winixd/models/winixmodel.h
upload.o: ../../../winix/winixd/core/header.h
upload.o: ../../../winix/winixd/core/session.h
upload.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
upload.o: ../../../winix/winixd/core/system.h
@ -6248,6 +6294,7 @@ uptime.o: ../../../winix/winixd/core/config.h
uptime.o: ../../../winix/winixd/core/textstream.h
uptime.o: ../../../ezc/src/outstreams.h ../../../ezc/src/models.h
uptime.o: ../../../winix/winixd/models/winixmodel.h
uptime.o: ../../../winix/winixd/core/header.h
uptime.o: ../../../winix/winixd/core/session.h
uptime.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
uptime.o: ../../../winix/winixd/core/system.h
@ -6377,6 +6424,7 @@ vim.o: ../../../ezc/src/funinfo.h ../../../winix/winixd/core/error.h
vim.o: ../../../winix/winixd/core/config.h
vim.o: ../../../winix/winixd/core/textstream.h ../../../ezc/src/outstreams.h
vim.o: ../../../ezc/src/models.h ../../../winix/winixd/models/winixmodel.h
vim.o: ../../../winix/winixd/core/header.h
vim.o: ../../../winix/winixd/core/session.h
vim.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
vim.o: ../../../winix/winixd/core/system.h ../../../winix/winixd/core/job.h
@ -6503,6 +6551,7 @@ who.o: ../../../ezc/src/funinfo.h ../../../winix/winixd/core/error.h
who.o: ../../../winix/winixd/core/config.h
who.o: ../../../winix/winixd/core/textstream.h ../../../ezc/src/outstreams.h
who.o: ../../../ezc/src/models.h ../../../winix/winixd/models/winixmodel.h
who.o: ../../../winix/winixd/core/header.h
who.o: ../../../winix/winixd/core/session.h
who.o: ../../../winix/winixd/core/rebus.h ipban.h mount.h
who.o: ../../../winix/winixd/core/system.h ../../../winix/winixd/core/job.h

@ -73,6 +73,9 @@ void Download::MakeGet()
cur->request->send_as_attachment = cur->request->IsParam(L"attachment");
bool is_thumb = (cur->request->item.item_content.file_has_thumb && cur->request->IsParam(L"thumb"));
if( !cur->request->item.item_content.file_mime_type.empty() )
cur->request->out_headers.add(Header::content_type, cur->request->item.item_content.file_mime_type);
if( config->send_file_mode == 0 || config->send_file_mode == 1 )
{
system->MakeFilePath(cur->request->item, cur->request->x_sendfile, is_thumb);
@ -84,9 +87,9 @@ void Download::MakeGet()
if( !GetBinaryFile(cur->request->x_sendfile, cur->request->out_bin_stream) )
{
log << log1 << "Download: I cannot read the content of the file: " << cur->request->x_sendfile << logend;
// may it would be good to return a html page with an error?
}
// IMPROVEME it would be good to set Content-Type header too
cur->request->x_sendfile.clear();
cur->request->send_bin_stream = true;
}

@ -124,6 +124,13 @@ void FunctionBase::Init()
}
void FunctionBase::Finish()
{
// this method is called only once at the end
// when winix finishes
}
bool FunctionBase::HasAccess()
{
// true by default

@ -92,12 +92,15 @@ public:
virtual void Init();
virtual void Finish();
virtual bool HasAccess();
virtual void MakePost();
virtual void MakeGet();
virtual void MakeDelete();
virtual void Clear();
//void SetConfig(Config * pconfig);
//void SetCur(Cur * pcur);
void SetDb(Db * pdb);

@ -286,6 +286,15 @@ void Functions::InitFunctions()
}
void Functions::FinishFunctions()
{
Table::iterator i = table.begin();
for( ; i!=table.end() ; ++i)
i->second->Finish();
}
void Functions::Init()
{
CreateFunctions();
@ -293,6 +302,12 @@ void Functions::Init()
}
void Functions::Finish()
{
FinishFunctions();
}
void Functions::Parse()
{
function_parser.Parse(cur, db, this, system);

@ -149,6 +149,7 @@ public:
typedef Table::iterator Iterator;
void Init();
void Finish();
void Parse();
size_t FunctionsSize();
@ -210,6 +211,7 @@ private:
void CreateFunctions();
void InitFunctions();
void FinishFunctions();
void SetObjects(FunctionBase * fun);
void SetDefaultFunctionForFile();

@ -62,6 +62,12 @@ void Upload::Init()
}
void Upload::Finish()
{
CloseMagicLib();
}
bool Upload::HasAccess(const Item & item)
{
// you can use 'upload' only in a directory
@ -229,6 +235,7 @@ void Upload::UploadMulti()
cur->request->item.item_content.file_size = i->second.file_size;
functions->PrepareUrl(cur->request->item);
AnalizeFileType(i->second.tmp_filename, cur->request->item.item_content.file_mime_type);
UploadFile(cur->request->item, i->second.tmp_filename);
i->second.tmp_filename.clear();
}
@ -268,6 +275,7 @@ void Upload::UploadSingle()
functions->PrepareUrl(cur->request->item);
}
AnalizeFileType(post_file.tmp_filename, cur->request->item.item_content.file_mime_type);
UploadFile(cur->request->item, post_file.tmp_filename);
post_file.tmp_filename.clear();
@ -279,10 +287,89 @@ void Upload::UploadSingle()
}
void Upload::InitMagicLibIfNeeded()
{
if( !magic_cookie )
{
log << log3 << "Upload: loading magic library" << logend;
magic_cookie = magic_open(MAGIC_MIME_TYPE);
if( magic_cookie )
{
if( magic_load(magic_cookie, nullptr) < 0 )
{
log << log1 << "Upload: I cannot load the magic file, magic_load failed";
const char * err = magic_error(magic_cookie);
if( err )
{
log << ", error: " << err;
}
log << logend;
CloseMagicLib();
}
}
else
{
log << log1 << "Upload: I cannot initialize magic library, magic_open failed" << logend;
}
}
}
void Upload::CloseMagicLib()
{
if( magic_cookie )
{
log << log3 << "Upload: closing magic library" << logend;
magic_close(magic_cookie);
magic_cookie = nullptr;
}
}
void Upload::AnalizeFileType(const std::wstring & file_path, std::wstring & file_type)
{
file_type.clear();
if( magic_cookie )
{
std::string file;
pt::wide_to_utf8(file_path, file);
log << log3 << "Upload: analize file: " << file;
const char * magic_file_type = magic_file(magic_cookie, file.c_str());
if( magic_file_type )
{
log << ", mime type is: " << magic_file_type << logend;
pt::utf8_to_wide(magic_file_type, file_type);
}
else
{
log << logend << log1 << "Upload: I cannot analize file: " << file << ", magic_file failed";
const char * err = magic_error(magic_cookie);
if( err )
{
log << ", error: " << err;
}
log << logend;
}
}
else
{
log << log1 << "Upload: magic library not initialized" << logend;
}
}
void Upload::MakePost()
{
InitMagicLibIfNeeded();
cur->request->item_tab.clear();
is_jquery_upload = cur->request->IsParam(L"jquery_upload");
@ -299,6 +386,7 @@ void Upload::MakePost()
UploadMulti();
else
UploadSingle();
}

@ -36,6 +36,7 @@
#define headerfile_winix_functions_upload
#include "functionbase.h"
#include <magic.h>
namespace Winix
@ -61,8 +62,10 @@ private:
std::wstring path;
//DbItemQuery query;
bool is_jquery_upload;
magic_t magic_cookie;
void Init();
void Finish();
bool HasAccess(const Item & item);
bool UploadSaveStaticFile(const Item & item, const std::wstring & tmp_filename);
@ -72,6 +75,12 @@ private:
void ResizeImage(Item & item);
void CreateThumb(Item & item);
void CreateAnswer();
void InitMagicLibIfNeeded();
void CloseMagicLib();
void AnalizeFileType(const std::wstring & file_path, std::wstring & file_type);
};

@ -75,6 +75,7 @@ main.o: ../../../winix/winixd/models/itemcontent.h
main.o: ../../../winix/winixd/templates/htmltextstream.h
main.o: ../../../winix/winixd/core/config.h
main.o: ../../../winix/winixd/models/winixmodel.h
main.o: ../../../winix/winixd/core/header.h
main.o: ../../../winix/winixd/core/mount.h
main.o: ../../../winix/winixd/core/winixmodeldeprecated.h
main.o: ../../../winix/winixd/core/plugin.h

@ -97,6 +97,7 @@ item.o: ../../../winix/winixd/core/error.h
item.o: ../../../winix/winixd/core/config.h
item.o: ../../../winix/winixd/core/textstream.h
item.o: ../../../winix/winixd/models/winixmodel.h
item.o: ../../../winix/winixd/core/header.h
item.o: ../../../winix/winixd/templates/templates.h
item.o: ../../../winix/winixd/templates/patterncacher.h
item.o: ../../../winix/winixd/templates/indexpatterns.h
@ -241,6 +242,7 @@ itemcontent.o: ../../../winix/winixd/models/item.h itemcontent.h
itemcontent.o: ../../../winix/winixd/core/error.h
itemcontent.o: ../../../winix/winixd/core/textstream.h
itemcontent.o: ../../../winix/winixd/models/winixmodel.h
itemcontent.o: ../../../winix/winixd/core/header.h
itemcontent.o: ../../../winix/winixd/core/users.h
itemcontent.o: ../../../winix/winixd/core/groups.h
itemcontent.o: ../../../winix/winixd/models/group.h

@ -74,6 +74,7 @@ void ItemContent::fields()
field(L"file_path", file_path);
field(L"file_fs", file_fs);
field(L"file_type", file_type);
field(L"file_mime_type", file_mime_type);
field(L"file_has_thumb", file_has_thumb);
field(L"file_hash", file_hash);
field(L"file_hash_type", file_hash_type);
@ -192,6 +193,7 @@ bool ItemContent::do_migration(int & current_table_version)
ok = ok && morm::Model::do_migration(current_table_version, 2, this, &ItemContent::do_migration_to_2);
ok = ok && morm::Model::do_migration(current_table_version, 3, this, &ItemContent::do_migration_to_3);
ok = ok && morm::Model::do_migration(current_table_version, 4, this, &ItemContent::do_migration_to_4);
ok = ok && morm::Model::do_migration(current_table_version, 5, this, &ItemContent::do_migration_to_5);
return ok;
}
@ -278,6 +280,13 @@ bool ItemContent::do_migration_to_4()
}
bool ItemContent::do_migration_to_5()
{
const char * str = "alter table core.content add column file_mime_type varchar(256)";
return db_query(str);
}
bool ItemContent::has_access(const User * current_user, int mask) const
{
if( current_user )

@ -177,6 +177,22 @@ public:
*/
int file_type;
/*
* mime file type e.g. image/jpeg
*
* CHANGEME
* we need to rething what to do with above file_type
*
* may would be better to have:
* remove file_type and add:
* bool has_static_file;
* std::wstring file_mime_type;
*
* may it would be good to have a seperate mime_type for the thumnail?
*
*/
std::wstring file_mime_type;
/*
* whether or not we have a thumbnail
*/
@ -289,6 +305,7 @@ protected:
bool do_migration_to_2();
bool do_migration_to_3();
bool do_migration_to_4();
bool do_migration_to_5();
bool has_access(const User * current_user, int mask) const;
bool content_type_is(const std::wstring & type);

@ -85,6 +85,7 @@ notify.o: ../../../winix/winixd/core/error.h
notify.o: ../../../winix/winixd/core/config.h
notify.o: ../../../winix/winixd/core/textstream.h
notify.o: ../../../winix/winixd/models/winixmodel.h
notify.o: ../../../winix/winixd/core/header.h
notify.o: ../../../winix/winixd/core/session.h
notify.o: ../../../winix/winixd/core/rebus.h
notify.o: ../../../winix/winixd/core/ipban.h
@ -265,6 +266,7 @@ notifythread.o: ../../../winix/winixd/core/error.h
notifythread.o: ../../../winix/winixd/core/config.h
notifythread.o: ../../../winix/winixd/core/textstream.h
notifythread.o: ../../../winix/winixd/models/winixmodel.h
notifythread.o: ../../../winix/winixd/core/header.h
notifythread.o: ../../../winix/winixd/core/session.h
notifythread.o: ../../../winix/winixd/core/plugindata.h
notifythread.o: ../../../winix/winixd/core/rebus.h

@ -89,6 +89,7 @@ edb.o: ../../../../winix/winixd/core/error.h
edb.o: ../../../../winix/winixd/core/config.h
edb.o: ../../../../winix/winixd/core/textstream.h
edb.o: ../../../../winix/winixd/models/winixmodel.h
edb.o: ../../../../winix/winixd/core/header.h
edb.o: ../../../../winix/winixd/core/winixmodeldeprecated.h
edb.o: ../../../../winix/winixd/core/plugin.h
edb.o: ../../../../winix/winixd/core/pluginmsg.h
@ -185,6 +186,7 @@ exportinfo.o: ../../../../winix/winixd/core/error.h
exportinfo.o: ../../../../winix/winixd/core/config.h
exportinfo.o: ../../../../winix/winixd/core/textstream.h
exportinfo.o: ../../../../winix/winixd/models/winixmodel.h
exportinfo.o: ../../../../winix/winixd/core/header.h
exportinfo.o: ../../../../winix/winixd/core/mounts.h
exportinfo.o: ../../../../winix/winixd/core/mount.h
exportinfo.o: ../../../../winix/winixd/core/mountparser.h
@ -335,6 +337,7 @@ funexport.o: ../../../../winix/winixd/core/error.h
funexport.o: ../../../../winix/winixd/core/config.h
funexport.o: ../../../../winix/winixd/core/textstream.h
funexport.o: ../../../../winix/winixd/models/winixmodel.h
funexport.o: ../../../../winix/winixd/core/header.h
funexport.o: ../../../../winix/winixd/core/system.h
funexport.o: ../../../../winix/winixd/core/job.h
funexport.o: ../../../../winix/winixd/core/basethread.h
@ -483,6 +486,7 @@ init.o: ../../../../winix/winixd/core/error.h
init.o: ../../../../winix/winixd/core/config.h
init.o: ../../../../winix/winixd/core/textstream.h
init.o: ../../../../winix/winixd/models/winixmodel.h
init.o: ../../../../winix/winixd/core/header.h
init.o: ../../../../winix/winixd/core/mounts.h
init.o: ../../../../winix/winixd/core/mount.h
init.o: ../../../../winix/winixd/core/mountparser.h