remove Request::post_tab and add Request::http_status
Instead of Reqest::post_tab we use now Request::post_in (pt::Space). Request::http_status will be used instead Request::status, but at the moment is not changed in all places. Request::status has been marked as depracated. While here: - Check for root dir in App and not in FunctionParser, let FunctionParser only log the root dir. - Read post variables after parsing url parameters, this allows winix functions to set limits for post input. - Set limits when parsing input json format, new options added to config: post_max_object_items, post_max_table_items, post_max_all_items, post_max_nested_objects. There are similar options in each winix function (they are in FunctionBase). - Some refactoring in App. - Add config option: log_whole_http_post if true then the whole parsed post input is logged. - Add config option: post_json_max - max length of input stream for parsing json. - Add config option: templates_request_status, default request_status.html this is an ezc template used as [content] when the request status is not 200_ok. - Fix: Sort winix function didn't show items to sort (fix and do some refactoring as well) - Properly sort items in: ImgCrop, Ls, Sort, Upload - Remove ezc templates: err_404.html, err_per_denied.html - now request_status.html is used.
This commit is contained in:
@@ -42,8 +42,9 @@ app.o: ../../../morm/src/postgresqlexpression.h
|
||||
app.o: ../../../morm/src/jsonconnector.h
|
||||
app.o: ../../../morm/src/postgresqlconnector.h
|
||||
app.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
app.o: ../../../winix/winixd/core/log.h ../../../winix/winixd/core/filelog.h
|
||||
app.o: lock.h synchro.h ../../../pikotools/src/convert/patternreplacer.h
|
||||
app.o: ../../../morm/src/transaction.h ../../../winix/winixd/core/log.h
|
||||
app.o: ../../../winix/winixd/core/filelog.h lock.h synchro.h
|
||||
app.o: ../../../pikotools/src/convert/patternreplacer.h
|
||||
app.o: ../../../pikotools/src/convert/strtoint.h
|
||||
app.o: ../../../pikotools/src/convert/text.h misc.h requesttypes.h
|
||||
app.o: winix_const.h ../../../pikotools/src/convert/convert.h
|
||||
@@ -191,6 +192,7 @@ basethread.o: ../../../morm/src/postgresqlexpression.h
|
||||
basethread.o: ../../../morm/src/jsonconnector.h
|
||||
basethread.o: ../../../morm/src/postgresqlconnector.h
|
||||
basethread.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
basethread.o: ../../../morm/src/transaction.h
|
||||
basethread.o: ../../../winix/winixd/core/log.h
|
||||
basethread.o: ../../../winix/winixd/core/filelog.h lock.h plugin.h
|
||||
basethread.o: pluginmsg.h plugindata.h winixbase.h
|
||||
@@ -229,6 +231,7 @@ compress.o: ../../../morm/src/postgresqlexpression.h
|
||||
compress.o: ../../../morm/src/jsonconnector.h
|
||||
compress.o: ../../../morm/src/postgresqlconnector.h
|
||||
compress.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
compress.o: ../../../morm/src/transaction.h
|
||||
config.o: config.h log.h logmanipulators.h ../../../pikotools/src/log/log.h
|
||||
config.o: ../../../pikotools/src/textstream/textstream.h
|
||||
config.o: ../../../pikotools/src/textstream/stream.h
|
||||
@@ -261,8 +264,9 @@ config.o: ../../../morm/src/cursor.h ../../../morm/src/jsonexpression.h
|
||||
config.o: ../../../morm/src/postgresqlexpression.h
|
||||
config.o: ../../../morm/src/jsonconnector.h
|
||||
config.o: ../../../morm/src/postgresqlconnector.h
|
||||
config.o: ../../../morm/src/postgresqlqueryresult.h misc.h requesttypes.h
|
||||
config.o: winix_const.h ../../../pikotools/src/convert/convert.h
|
||||
config.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
config.o: ../../../morm/src/transaction.h misc.h requesttypes.h winix_const.h
|
||||
config.o: ../../../pikotools/src/convert/convert.h
|
||||
config.o: ../../../pikotools/src/convert/inttostr.h
|
||||
config.o: ../../../pikotools/src/convert/patternreplacer.h
|
||||
config.o: ../../../pikotools/src/convert/strtoint.h
|
||||
@@ -333,7 +337,7 @@ crypt.o: ../../../morm/src/postgresqlexpression.h
|
||||
crypt.o: ../../../morm/src/jsonconnector.h
|
||||
crypt.o: ../../../morm/src/postgresqlconnector.h
|
||||
crypt.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
crypt.o: ../../../winix/winixd/core/log.h
|
||||
crypt.o: ../../../morm/src/transaction.h ../../../winix/winixd/core/log.h
|
||||
crypt.o: ../../../winix/winixd/core/filelog.h lock.h synchro.h
|
||||
crypt.o: ../../../pikotools/src/convert/patternreplacer.h
|
||||
crypt.o: ../../../pikotools/src/convert/strtoint.h
|
||||
@@ -405,6 +409,7 @@ dircontainer.o: ../../../morm/src/postgresqlexpression.h
|
||||
dircontainer.o: ../../../morm/src/jsonconnector.h
|
||||
dircontainer.o: ../../../morm/src/postgresqlconnector.h
|
||||
dircontainer.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
dircontainer.o: ../../../morm/src/transaction.h
|
||||
dircontainer.o: ../../../winix/winixd/core/filelog.h lock.h synchro.h
|
||||
dircontainer.o: ../../../pikotools/src/convert/patternreplacer.h
|
||||
dircontainer.o: ../../../pikotools/src/convert/strtoint.h
|
||||
@@ -467,8 +472,8 @@ dirs.o: ../../../morm/src/postgresqlexpression.h
|
||||
dirs.o: ../../../morm/src/jsonconnector.h
|
||||
dirs.o: ../../../morm/src/postgresqlconnector.h
|
||||
dirs.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
dirs.o: ../../../winix/winixd/core/filelog.h lock.h synchro.h
|
||||
dirs.o: ../../../pikotools/src/convert/patternreplacer.h
|
||||
dirs.o: ../../../morm/src/transaction.h ../../../winix/winixd/core/filelog.h
|
||||
dirs.o: lock.h synchro.h ../../../pikotools/src/convert/patternreplacer.h
|
||||
dirs.o: ../../../pikotools/src/convert/strtoint.h
|
||||
dirs.o: ../../../pikotools/src/convert/text.h misc.h requesttypes.h
|
||||
dirs.o: winix_const.h ../../../pikotools/src/convert/convert.h
|
||||
@@ -565,7 +570,7 @@ groups.o: ../../../morm/src/postgresqlexpression.h
|
||||
groups.o: ../../../morm/src/jsonconnector.h
|
||||
groups.o: ../../../morm/src/postgresqlconnector.h
|
||||
groups.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
groups.o: ../../../winix/winixd/core/log.h
|
||||
groups.o: ../../../morm/src/transaction.h ../../../winix/winixd/core/log.h
|
||||
groups.o: ../../../winix/winixd/core/filelog.h lock.h synchro.h
|
||||
groups.o: ../../../winix/winixd/core/error.h
|
||||
groups.o: ../../../winix/winixd/models/user.h
|
||||
@@ -591,6 +596,40 @@ groups.o: ../../../winix/winixd/models/winixmodelconnector.h
|
||||
groups.o: ../../../winix/winixd/core/dircontainer.h
|
||||
groups.o: ../../../winix/winixd/core/ugcontainer.h winixbase.h
|
||||
groups.o: winixmodeldeprecated.h plugin.h pluginmsg.h plugindata.h
|
||||
header.o: header.h log.h logmanipulators.h ../../../pikotools/src/log/log.h
|
||||
header.o: ../../../pikotools/src/textstream/textstream.h
|
||||
header.o: ../../../pikotools/src/textstream/stream.h
|
||||
header.o: ../../../pikotools/src/space/space.h
|
||||
header.o: ../../../pikotools/src/textstream/types.h
|
||||
header.o: ../../../pikotools/src/convert/inttostr.h
|
||||
header.o: ../../../pikotools/src/utf8/utf8.h
|
||||
header.o: ../../../pikotools/src/textstream/stream.h
|
||||
header.o: ../../../pikotools/src/utf8/utf8_templates.h
|
||||
header.o: ../../../pikotools/src/utf8/utf8_private.h
|
||||
header.o: ../../../pikotools/src/date/date.h
|
||||
header.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
header.o: ../../../pikotools/src/textstream/types.h
|
||||
header.o: ../../../pikotools/src/utf8/utf8_stream.h filelog.h
|
||||
header.o: ../../../winix/winixd/core/synchro.h ../../../morm/src/morm.h
|
||||
header.o: ../../../morm/src/morm_types.h ../../../morm/src/model.h
|
||||
header.o: ../../../morm/src/modelconnector.h ../../../morm/src/clearer.h
|
||||
header.o: ../../../morm/src/ft.h ../../../morm/src/dbconnector.h
|
||||
header.o: ../../../morm/src/queryresult.h ../../../morm/src/flatconnector.h
|
||||
header.o: ../../../morm/src/dbexpression.h ../../../morm/src/baseexpression.h
|
||||
header.o: ../../../morm/src/modelenv.h ../../../morm/src/modeldata.h
|
||||
header.o: ../../../morm/src/cursorhelper.h ../../../morm/src/finderhelper.h
|
||||
header.o: ../../../morm/src/fieldvaluehelper.h ../../../morm/src/wrapper.h
|
||||
header.o: ../../../morm/src/spacewrapper.h
|
||||
header.o: ../../../morm/src/baseobjectwrapper.h
|
||||
header.o: ../../../morm/src/modelcontainerwrapper.h
|
||||
header.o: ../../../pikotools/src/convert/text.h
|
||||
header.o: ../../../morm/src/flatexpression.h ../../../morm/src/finder.h
|
||||
header.o: ../../../morm/src/cursor.h ../../../morm/src/jsonexpression.h
|
||||
header.o: ../../../morm/src/postgresqlexpression.h
|
||||
header.o: ../../../morm/src/jsonconnector.h
|
||||
header.o: ../../../morm/src/postgresqlconnector.h
|
||||
header.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
header.o: ../../../morm/src/transaction.h
|
||||
httpsimpleparser.o: httpsimpleparser.h winixmodeldeprecated.h
|
||||
httpsimpleparser.o: ../../../winix/winixd/core/winixbase.h
|
||||
httpsimpleparser.o: ../../../winix/winixd/core/config.h
|
||||
@@ -638,6 +677,7 @@ httpsimpleparser.o: ../../../morm/src/postgresqlexpression.h
|
||||
httpsimpleparser.o: ../../../morm/src/jsonconnector.h
|
||||
httpsimpleparser.o: ../../../morm/src/postgresqlconnector.h
|
||||
httpsimpleparser.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
httpsimpleparser.o: ../../../morm/src/transaction.h
|
||||
httpsimpleparser.o: ../../../winix/winixd/core/log.h
|
||||
httpsimpleparser.o: ../../../winix/winixd/core/filelog.h lock.h synchro.h
|
||||
httpsimpleparser.o: plugin.h pluginmsg.h plugindata.h winixbase.h misc.h
|
||||
@@ -687,7 +727,7 @@ image.o: ../../../morm/src/postgresqlexpression.h
|
||||
image.o: ../../../morm/src/jsonconnector.h
|
||||
image.o: ../../../morm/src/postgresqlconnector.h
|
||||
image.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
image.o: ../../../winix/winixd/core/log.h
|
||||
image.o: ../../../morm/src/transaction.h ../../../winix/winixd/core/log.h
|
||||
image.o: ../../../winix/winixd/core/filelog.h lock.h plugin.h pluginmsg.h
|
||||
image.o: plugindata.h winixbase.h textstream.h misc.h requesttypes.h
|
||||
image.o: winix_const.h ../../../pikotools/src/convert/convert.h
|
||||
@@ -782,6 +822,7 @@ ipbancontainer.o: ../../../morm/src/postgresqlexpression.h
|
||||
ipbancontainer.o: ../../../morm/src/jsonconnector.h
|
||||
ipbancontainer.o: ../../../morm/src/postgresqlconnector.h
|
||||
ipbancontainer.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
ipbancontainer.o: ../../../morm/src/transaction.h
|
||||
ipbancontainer.o: ../../../winix/winixd/core/log.h
|
||||
ipbancontainer.o: ../../../winix/winixd/core/filelog.h lock.h synchro.h
|
||||
ipbancontainer.o: plugin.h pluginmsg.h plugindata.h winixbase.h
|
||||
@@ -823,8 +864,9 @@ job.o: ../../../morm/src/postgresqlexpression.h
|
||||
job.o: ../../../morm/src/jsonconnector.h
|
||||
job.o: ../../../morm/src/postgresqlconnector.h
|
||||
job.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
job.o: ../../../winix/winixd/core/log.h ../../../winix/winixd/core/filelog.h
|
||||
job.o: lock.h plugin.h pluginmsg.h plugindata.h winixbase.h
|
||||
job.o: ../../../morm/src/transaction.h ../../../winix/winixd/core/log.h
|
||||
job.o: ../../../winix/winixd/core/filelog.h lock.h plugin.h pluginmsg.h
|
||||
job.o: plugindata.h winixbase.h
|
||||
lastcontainer.o: lastcontainer.h ../../../pikotools/src/date/date.h
|
||||
lastcontainer.o: ../../../pikotools/src/convert/inttostr.h winixbase.h log.h
|
||||
lastcontainer.o: logmanipulators.h ../../../pikotools/src/log/log.h
|
||||
@@ -862,9 +904,9 @@ lastcontainer.o: ../../../morm/src/jsonexpression.h
|
||||
lastcontainer.o: ../../../morm/src/postgresqlexpression.h
|
||||
lastcontainer.o: ../../../morm/src/jsonconnector.h
|
||||
lastcontainer.o: ../../../morm/src/postgresqlconnector.h
|
||||
lastcontainer.o: ../../../morm/src/postgresqlqueryresult.h misc.h
|
||||
lastcontainer.o: requesttypes.h winix_const.h
|
||||
lastcontainer.o: ../../../pikotools/src/convert/convert.h
|
||||
lastcontainer.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
lastcontainer.o: ../../../morm/src/transaction.h misc.h requesttypes.h
|
||||
lastcontainer.o: winix_const.h ../../../pikotools/src/convert/convert.h
|
||||
lastcontainer.o: ../../../pikotools/src/convert/inttostr.h
|
||||
lastcontainer.o: ../../../pikotools/src/convert/patternreplacer.h
|
||||
lastcontainer.o: ../../../pikotools/src/convert/strtoint.h
|
||||
@@ -919,6 +961,7 @@ loadavg.o: ../../../morm/src/postgresqlexpression.h
|
||||
loadavg.o: ../../../morm/src/jsonconnector.h
|
||||
loadavg.o: ../../../morm/src/postgresqlconnector.h
|
||||
loadavg.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
loadavg.o: ../../../morm/src/transaction.h
|
||||
loadavg.o: ../../../winix/winixd/core/filelog.h lock.h synchro.h
|
||||
loadavg.o: ../../../pikotools/src/convert/patternreplacer.h
|
||||
loadavg.o: ../../../pikotools/src/convert/strtoint.h
|
||||
@@ -968,6 +1011,7 @@ log.o: ../../../morm/src/postgresqlexpression.h
|
||||
log.o: ../../../morm/src/jsonconnector.h
|
||||
log.o: ../../../morm/src/postgresqlconnector.h
|
||||
log.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
log.o: ../../../morm/src/transaction.h
|
||||
misc.o: misc.h requesttypes.h ../../../pikotools/src/textstream/textstream.h
|
||||
misc.o: ../../../pikotools/src/textstream/stream.h
|
||||
misc.o: ../../../pikotools/src/space/space.h
|
||||
@@ -1019,8 +1063,9 @@ misc.o: ../../../morm/src/postgresqlexpression.h
|
||||
misc.o: ../../../morm/src/jsonconnector.h
|
||||
misc.o: ../../../morm/src/postgresqlconnector.h
|
||||
misc.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
misc.o: ../../../winix/winixd/core/log.h ../../../winix/winixd/core/filelog.h
|
||||
misc.o: lock.h synchro.h ../../../winix/winixd/models/item.h
|
||||
misc.o: ../../../morm/src/transaction.h ../../../winix/winixd/core/log.h
|
||||
misc.o: ../../../winix/winixd/core/filelog.h lock.h synchro.h
|
||||
misc.o: ../../../winix/winixd/models/item.h
|
||||
misc.o: ../../../winix/winixd/models/winixmodel.h
|
||||
misc.o: ../../../winix/winixd/models/winixmodelconnector.h
|
||||
misc.o: ../../../winix/winixd/models/itemcontent.h
|
||||
@@ -1123,6 +1168,7 @@ mountparser.o: ../../../morm/src/postgresqlexpression.h
|
||||
mountparser.o: ../../../morm/src/jsonconnector.h
|
||||
mountparser.o: ../../../morm/src/postgresqlconnector.h
|
||||
mountparser.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
mountparser.o: ../../../morm/src/transaction.h
|
||||
mountparser.o: ../../../winix/winixd/core/filelog.h lock.h synchro.h
|
||||
mountparser.o: ../../../pikotools/src/convert/patternreplacer.h
|
||||
mountparser.o: ../../../pikotools/src/convert/strtoint.h
|
||||
@@ -1200,6 +1246,7 @@ mounts.o: ../../../morm/src/postgresqlexpression.h
|
||||
mounts.o: ../../../morm/src/jsonconnector.h
|
||||
mounts.o: ../../../morm/src/postgresqlconnector.h
|
||||
mounts.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
mounts.o: ../../../morm/src/transaction.h
|
||||
mounts.o: ../../../winix/winixd/core/filelog.h lock.h synchro.h
|
||||
mounts.o: ../../../pikotools/src/convert/patternreplacer.h
|
||||
mounts.o: ../../../pikotools/src/convert/strtoint.h
|
||||
@@ -1275,7 +1322,7 @@ plugin.o: ../../../morm/src/postgresqlexpression.h
|
||||
plugin.o: ../../../morm/src/jsonconnector.h
|
||||
plugin.o: ../../../morm/src/postgresqlconnector.h
|
||||
plugin.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
plugin.o: ../../../winix/winixd/core/log.h
|
||||
plugin.o: ../../../morm/src/transaction.h ../../../winix/winixd/core/log.h
|
||||
plugin.o: ../../../winix/winixd/core/filelog.h lock.h dirs.h dircontainer.h
|
||||
plugin.o: ../../../winix/winixd/models/item.h
|
||||
plugin.o: ../../../winix/winixd/models/winixmodel.h
|
||||
@@ -1414,7 +1461,8 @@ plugindata.o: ../../../morm/src/postgresqlexpression.h
|
||||
plugindata.o: ../../../morm/src/jsonconnector.h
|
||||
plugindata.o: ../../../morm/src/postgresqlconnector.h
|
||||
plugindata.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
postmultiparser.o: postmultiparser.h error.h requesttypes.h
|
||||
plugindata.o: ../../../morm/src/transaction.h
|
||||
postmultiparser.o: postmultiparser.h error.h request.h requesttypes.h
|
||||
postmultiparser.o: ../../../pikotools/src/textstream/textstream.h
|
||||
postmultiparser.o: ../../../pikotools/src/textstream/stream.h
|
||||
postmultiparser.o: ../../../pikotools/src/space/space.h
|
||||
@@ -1427,24 +1475,20 @@ postmultiparser.o: ../../../pikotools/src/utf8/utf8_private.h
|
||||
postmultiparser.o: ../../../pikotools/src/date/date.h
|
||||
postmultiparser.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
postmultiparser.o: ../../../pikotools/src/textstream/types.h
|
||||
postmultiparser.o: ../../../pikotools/src/utf8/utf8_stream.h config.h misc.h
|
||||
postmultiparser.o: winix_const.h ../../../pikotools/src/convert/convert.h
|
||||
postmultiparser.o: ../../../pikotools/src/convert/inttostr.h
|
||||
postmultiparser.o: ../../../pikotools/src/convert/patternreplacer.h
|
||||
postmultiparser.o: ../../../pikotools/src/convert/strtoint.h
|
||||
postmultiparser.o: ../../../pikotools/src/convert/text.h
|
||||
postmultiparser.o: ../../../pikotools/src/convert/double.h winixbase.h log.h
|
||||
postmultiparser.o: logmanipulators.h ../../../pikotools/src/log/log.h
|
||||
postmultiparser.o: filelog.h ../../../winix/winixd/core/synchro.h
|
||||
postmultiparser.o: ../../../morm/src/morm.h ../../../morm/src/morm_types.h
|
||||
postmultiparser.o: ../../../pikotools/src/utf8/utf8_stream.h
|
||||
postmultiparser.o: ../../../winix/winixd/models/item.h
|
||||
postmultiparser.o: ../../../winix/winixd/models/winixmodel.h
|
||||
postmultiparser.o: ../../../morm/src/model.h
|
||||
postmultiparser.o: ../../../morm/src/modelconnector.h
|
||||
postmultiparser.o: ../../../morm/src/clearer.h ../../../morm/src/ft.h
|
||||
postmultiparser.o: ../../../morm/src/dbconnector.h
|
||||
postmultiparser.o: ../../../pikotools/src/log/log.h filelog.h
|
||||
postmultiparser.o: ../../../winix/winixd/core/synchro.h
|
||||
postmultiparser.o: ../../../morm/src/queryresult.h
|
||||
postmultiparser.o: ../../../morm/src/flatconnector.h
|
||||
postmultiparser.o: ../../../morm/src/dbexpression.h
|
||||
postmultiparser.o: ../../../morm/src/baseexpression.h
|
||||
postmultiparser.o: ../../../morm/src/morm_types.h
|
||||
postmultiparser.o: ../../../morm/src/modelenv.h ../../../morm/src/modeldata.h
|
||||
postmultiparser.o: ../../../morm/src/cursorhelper.h
|
||||
postmultiparser.o: ../../../morm/src/finderhelper.h
|
||||
@@ -1455,12 +1499,44 @@ postmultiparser.o: ../../../morm/src/baseobjectwrapper.h
|
||||
postmultiparser.o: ../../../morm/src/modelcontainerwrapper.h
|
||||
postmultiparser.o: ../../../pikotools/src/convert/text.h
|
||||
postmultiparser.o: ../../../morm/src/flatexpression.h
|
||||
postmultiparser.o: ../../../winix/winixd/core/log.h
|
||||
postmultiparser.o: ../../../winix/winixd/models/winixmodelconnector.h
|
||||
postmultiparser.o: ../../../winix/winixd/models/itemcontent.h
|
||||
postmultiparser.o: ../../../winix/winixd/templates/htmltextstream.h
|
||||
postmultiparser.o: ../../../winix/winixd/templates/misc.h
|
||||
postmultiparser.o: ../../../winix/winixd/templates/localefilter.h
|
||||
postmultiparser.o: ../../../winix/winixd/templates/locale.h
|
||||
postmultiparser.o: ../../../pikotools/src/space/spaceparser.h
|
||||
postmultiparser.o: ../../../pikotools/src/space/space.h
|
||||
postmultiparser.o: ../../../pikotools/src/convert/baseparser.h
|
||||
postmultiparser.o: ../../../winix/winixd/core/winixbase.h
|
||||
postmultiparser.o: ../../../winix/winixd/core/config.h log.h
|
||||
postmultiparser.o: logmanipulators.h ../../../morm/src/morm.h
|
||||
postmultiparser.o: ../../../morm/src/finder.h ../../../morm/src/cursor.h
|
||||
postmultiparser.o: ../../../morm/src/jsonexpression.h
|
||||
postmultiparser.o: ../../../morm/src/postgresqlexpression.h
|
||||
postmultiparser.o: ../../../morm/src/jsonconnector.h
|
||||
postmultiparser.o: ../../../morm/src/postgresqlconnector.h
|
||||
postmultiparser.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
postmultiparser.o: ../../../morm/src/transaction.h
|
||||
postmultiparser.o: ../../../winix/winixd/core/filelog.h lock.h synchro.h
|
||||
postmultiparser.o: ../../../pikotools/src/convert/patternreplacer.h
|
||||
postmultiparser.o: ../../../pikotools/src/convert/strtoint.h
|
||||
postmultiparser.o: ../../../pikotools/src/convert/text.h misc.h winix_const.h
|
||||
postmultiparser.o: ../../../pikotools/src/convert/convert.h
|
||||
postmultiparser.o: ../../../pikotools/src/convert/inttostr.h
|
||||
postmultiparser.o: ../../../pikotools/src/convert/patternreplacer.h
|
||||
postmultiparser.o: ../../../pikotools/src/convert/double.h
|
||||
postmultiparser.o: ../../../ezc/src/ezc.h ../../../ezc/src/generator.h
|
||||
postmultiparser.o: ../../../ezc/src/blocks.h ../../../ezc/src/item.h
|
||||
postmultiparser.o: ../../../ezc/src/cache.h ../../../ezc/src/functions.h
|
||||
postmultiparser.o: ../../../ezc/src/funinfo.h ../../../ezc/src/objects.h
|
||||
postmultiparser.o: ../../../ezc/src/pattern.h ../../../ezc/src/outstreams.h
|
||||
postmultiparser.o: ../../../ezc/src/expressionparser.h
|
||||
postmultiparser.o: ../../../ezc/src/models.h ../../../ezc/src/patternparser.h
|
||||
postmultiparser.o: ../../../winix/winixd/templates/htmltextstream.h config.h
|
||||
postmultiparser.o: textstream.h ../../../winix/winixd/models/winixmodel.h
|
||||
postmultiparser.o: header.h winixbase.h
|
||||
rebus.o: log.h logmanipulators.h ../../../pikotools/src/log/log.h
|
||||
rebus.o: ../../../pikotools/src/textstream/textstream.h
|
||||
rebus.o: ../../../pikotools/src/textstream/stream.h
|
||||
@@ -1493,7 +1569,8 @@ rebus.o: ../../../morm/src/cursor.h ../../../morm/src/jsonexpression.h
|
||||
rebus.o: ../../../morm/src/postgresqlexpression.h
|
||||
rebus.o: ../../../morm/src/jsonconnector.h
|
||||
rebus.o: ../../../morm/src/postgresqlconnector.h
|
||||
rebus.o: ../../../morm/src/postgresqlqueryresult.h rebus.h winixbase.h misc.h
|
||||
rebus.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
rebus.o: ../../../morm/src/transaction.h rebus.h winixbase.h misc.h
|
||||
rebus.o: requesttypes.h winix_const.h
|
||||
rebus.o: ../../../pikotools/src/convert/convert.h
|
||||
rebus.o: ../../../pikotools/src/convert/inttostr.h
|
||||
@@ -1577,6 +1654,7 @@ request.o: ../../../morm/src/postgresqlexpression.h
|
||||
request.o: ../../../morm/src/jsonconnector.h
|
||||
request.o: ../../../morm/src/postgresqlconnector.h
|
||||
request.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
request.o: ../../../morm/src/transaction.h
|
||||
request.o: ../../../winix/winixd/core/filelog.h lock.h synchro.h
|
||||
request.o: ../../../pikotools/src/convert/patternreplacer.h
|
||||
request.o: ../../../pikotools/src/convert/strtoint.h
|
||||
@@ -1620,7 +1698,12 @@ request.o: ../../../winix/winixd/core/winixsystem.h winixmodeldeprecated.h
|
||||
request.o: ../../../winix/winixd/core/cur.h
|
||||
request.o: ../../../winix/winixd/core/sessionmanager.h
|
||||
request.o: ../../../winix/winixd/core/slog.h cur.h session.h rebus.h ipban.h
|
||||
request.o: mount.h
|
||||
request.o: mount.h ../../../winix/winixd/templates/templates.h
|
||||
request.o: ../../../winix/winixd/templates/patterncacher.h
|
||||
request.o: ../../../winix/winixd/templates/indexpatterns.h
|
||||
request.o: ../../../winix/winixd/templates/patterns.h
|
||||
request.o: ../../../winix/winixd/templates/changepatterns.h
|
||||
request.o: ../../../pikotools/src/html/htmlparser.h
|
||||
run.o: run.h winixbase.h
|
||||
session.o: session.h error.h ../../../winix/winixd/models/user.h
|
||||
session.o: ../../../morm/src/model.h
|
||||
@@ -1666,7 +1749,7 @@ session.o: ../../../morm/src/postgresqlexpression.h
|
||||
session.o: ../../../morm/src/jsonconnector.h
|
||||
session.o: ../../../morm/src/postgresqlconnector.h
|
||||
session.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
session.o: ../../../winix/winixd/core/log.h
|
||||
session.o: ../../../morm/src/transaction.h ../../../winix/winixd/core/log.h
|
||||
session.o: ../../../winix/winixd/core/filelog.h lock.h synchro.h
|
||||
session.o: ../../../pikotools/src/convert/patternreplacer.h
|
||||
session.o: ../../../pikotools/src/convert/strtoint.h
|
||||
@@ -1737,6 +1820,7 @@ sessioncontainer.o: ../../../morm/src/postgresqlexpression.h
|
||||
sessioncontainer.o: ../../../morm/src/jsonconnector.h
|
||||
sessioncontainer.o: ../../../morm/src/postgresqlconnector.h
|
||||
sessioncontainer.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
sessioncontainer.o: ../../../morm/src/transaction.h
|
||||
sessioncontainer.o: ../../../winix/winixd/core/log.h
|
||||
sessioncontainer.o: ../../../winix/winixd/core/filelog.h lock.h synchro.h
|
||||
sessioncontainer.o: ../../../pikotools/src/convert/patternreplacer.h
|
||||
@@ -1840,6 +1924,7 @@ sessionmanager.o: ../../../morm/src/postgresqlexpression.h
|
||||
sessionmanager.o: ../../../morm/src/jsonconnector.h
|
||||
sessionmanager.o: ../../../morm/src/postgresqlconnector.h
|
||||
sessionmanager.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
sessionmanager.o: ../../../morm/src/transaction.h
|
||||
sessionmanager.o: ../../../winix/winixd/core/log.h
|
||||
sessionmanager.o: ../../../winix/winixd/core/filelog.h lock.h synchro.h
|
||||
sessionmanager.o: ../../../pikotools/src/convert/patternreplacer.h
|
||||
@@ -1948,6 +2033,7 @@ sessionparser.o: ../../../morm/src/postgresqlexpression.h
|
||||
sessionparser.o: ../../../morm/src/jsonconnector.h
|
||||
sessionparser.o: ../../../morm/src/postgresqlconnector.h
|
||||
sessionparser.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
sessionparser.o: ../../../morm/src/transaction.h
|
||||
sessionparser.o: ../../../winix/winixd/core/log.h
|
||||
sessionparser.o: ../../../winix/winixd/core/filelog.h lock.h synchro.h
|
||||
sessionparser.o: ../../../pikotools/src/convert/patternreplacer.h
|
||||
@@ -2030,8 +2116,8 @@ slog.o: ../../../morm/src/postgresqlexpression.h
|
||||
slog.o: ../../../morm/src/jsonconnector.h
|
||||
slog.o: ../../../morm/src/postgresqlconnector.h
|
||||
slog.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
slog.o: ../../../winix/winixd/core/filelog.h lock.h synchro.h
|
||||
slog.o: ../../../pikotools/src/convert/patternreplacer.h
|
||||
slog.o: ../../../morm/src/transaction.h ../../../winix/winixd/core/filelog.h
|
||||
slog.o: lock.h synchro.h ../../../pikotools/src/convert/patternreplacer.h
|
||||
slog.o: ../../../pikotools/src/convert/strtoint.h
|
||||
slog.o: ../../../pikotools/src/convert/text.h misc.h winix_const.h
|
||||
slog.o: ../../../pikotools/src/convert/convert.h
|
||||
@@ -2088,7 +2174,7 @@ system.o: ../../../morm/src/postgresqlexpression.h
|
||||
system.o: ../../../morm/src/jsonconnector.h
|
||||
system.o: ../../../morm/src/postgresqlconnector.h
|
||||
system.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
system.o: ../../../winix/winixd/core/log.h
|
||||
system.o: ../../../morm/src/transaction.h ../../../winix/winixd/core/log.h
|
||||
system.o: ../../../winix/winixd/core/filelog.h lock.h plugin.h pluginmsg.h
|
||||
system.o: plugindata.h winixbase.h dirs.h dircontainer.h
|
||||
system.o: ../../../winix/winixd/models/item.h
|
||||
@@ -2240,6 +2326,7 @@ threadmanager.o: ../../../morm/src/postgresqlexpression.h
|
||||
threadmanager.o: ../../../morm/src/jsonconnector.h
|
||||
threadmanager.o: ../../../morm/src/postgresqlconnector.h
|
||||
threadmanager.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
threadmanager.o: ../../../morm/src/transaction.h
|
||||
threadmanager.o: ../../../winix/winixd/core/log.h
|
||||
threadmanager.o: ../../../winix/winixd/core/filelog.h lock.h plugin.h
|
||||
threadmanager.o: pluginmsg.h plugindata.h winixbase.h
|
||||
@@ -2308,6 +2395,7 @@ timezones.o: ../../../morm/src/postgresqlexpression.h
|
||||
timezones.o: ../../../morm/src/jsonconnector.h
|
||||
timezones.o: ../../../morm/src/postgresqlconnector.h
|
||||
timezones.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
timezones.o: ../../../morm/src/transaction.h
|
||||
users.o: users.h ../../../winix/winixd/models/user.h
|
||||
users.o: ../../../morm/src/model.h
|
||||
users.o: ../../../pikotools/src/textstream/textstream.h
|
||||
@@ -2351,7 +2439,7 @@ users.o: ../../../morm/src/postgresqlexpression.h
|
||||
users.o: ../../../morm/src/jsonconnector.h
|
||||
users.o: ../../../morm/src/postgresqlconnector.h
|
||||
users.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
users.o: ../../../winix/winixd/core/log.h
|
||||
users.o: ../../../morm/src/transaction.h ../../../winix/winixd/core/log.h
|
||||
users.o: ../../../winix/winixd/core/filelog.h lock.h synchro.h
|
||||
users.o: ../../../pikotools/src/convert/patternreplacer.h
|
||||
users.o: ../../../pikotools/src/convert/strtoint.h
|
||||
@@ -2447,6 +2535,7 @@ winixmodeldeprecated.o: ../../../morm/src/postgresqlexpression.h
|
||||
winixmodeldeprecated.o: ../../../morm/src/jsonconnector.h
|
||||
winixmodeldeprecated.o: ../../../morm/src/postgresqlconnector.h
|
||||
winixmodeldeprecated.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
winixmodeldeprecated.o: ../../../morm/src/transaction.h
|
||||
winixmodeldeprecated.o: ../../../winix/winixd/core/log.h
|
||||
winixmodeldeprecated.o: ../../../winix/winixd/core/filelog.h lock.h synchro.h
|
||||
winixmodeldeprecated.o: plugin.h pluginmsg.h plugindata.h winixbase.h
|
||||
@@ -2493,6 +2582,7 @@ winixsystem.o: ../../../morm/src/postgresqlexpression.h
|
||||
winixsystem.o: ../../../morm/src/jsonconnector.h
|
||||
winixsystem.o: ../../../morm/src/postgresqlconnector.h
|
||||
winixsystem.o: ../../../morm/src/postgresqlqueryresult.h
|
||||
winixsystem.o: ../../../morm/src/transaction.h
|
||||
winixsystem.o: ../../../winix/winixd/core/log.h
|
||||
winixsystem.o: ../../../winix/winixd/core/filelog.h lock.h synchro.h plugin.h
|
||||
winixsystem.o: pluginmsg.h plugindata.h winixbase.h
|
||||
|
||||
@@ -1 +1 @@
|
||||
o = app.o basethread.o compress.o config.o crypt.o dircontainer.o dirs.o filelog.o groups.o httpsimpleparser.o image.o ipbancontainer.o job.o lastcontainer.o loadavg.o lock.o log.o misc.o mount.o mountparser.o mounts.o plugin.o plugindata.o postmultiparser.o rebus.o request.o run.o session.o sessioncontainer.o sessionidmanager.o sessionmanager.o sessionparser.o slog.o synchro.o system.o threadmanager.o timezone.o timezones.o users.o winixbase.o winixmodeldeprecated.o winixrequest.o winixsystem.o
|
||||
o = app.o basethread.o compress.o config.o crypt.o dircontainer.o dirs.o filelog.o groups.o header.o httpsimpleparser.o image.o ipbancontainer.o job.o lastcontainer.o loadavg.o lock.o log.o misc.o mount.o mountparser.o mounts.o plugin.o plugindata.o postmultiparser.o rebus.o request.o run.o session.o sessioncontainer.o sessionidmanager.o sessionmanager.o sessionparser.o slog.o synchro.o system.o threadmanager.o timezone.o timezones.o users.o winixbase.o winixmodeldeprecated.o winixrequest.o winixsystem.o
|
||||
@@ -612,6 +612,7 @@ bool App::CheckAccessFromPlugins()
|
||||
if( res.res_false > 0 )
|
||||
{
|
||||
cur.request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
cur.request->http_status = Header::status_403_forbidden;
|
||||
log << log2 << "App: access prevented by a plugin" << logend;
|
||||
return false;
|
||||
}
|
||||
@@ -621,102 +622,155 @@ return true;
|
||||
|
||||
|
||||
|
||||
void App::ProcessRequestThrow()
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* REFACTOR ME
|
||||
*/
|
||||
void App::MakeRenameMeToABetterName()
|
||||
{
|
||||
ReadRequest();
|
||||
|
||||
// when BaseUrlRedirect() return true we didn't have to set everything in cur.request->Read()
|
||||
// in the future cur.request->Read() can be split and at the beginning only environment variables will be read
|
||||
// and then BaseUrlRedirect() will be called (for performance)
|
||||
if( !BaseUrlRedirect() )
|
||||
if( cur.request->function )
|
||||
{
|
||||
if( cur.request->env_request_uri.size() <= WINIX_URL_MAX_SIZE )
|
||||
{
|
||||
functions.Parse(); // parsing directories, files, functions and parameters
|
||||
|
||||
if( cur.request->function )
|
||||
{
|
||||
cur.request->function->fun.set_connector(model_connector); // IMPROVEME may would be better to add set_connector() method to functions?
|
||||
cur.request->function->fun.propagate_connector();
|
||||
}
|
||||
|
||||
/*
|
||||
* set global connector for now
|
||||
* in the future each thread will have its own model_connector
|
||||
*
|
||||
* don't set connector for item_tab - it will be moved out from request
|
||||
*/
|
||||
cur.request->item.set_connector(model_connector);
|
||||
|
||||
if( !cur.request->dir_tab.empty() )
|
||||
{
|
||||
cur.mount = system.mounts.CalcCurMount();
|
||||
|
||||
cur.session = session_manager.PrepareSession();
|
||||
model_connector.set_winix_session(cur.session);
|
||||
|
||||
functions.CheckFunctionAndSymlink(); // here a function can be changed
|
||||
|
||||
if( cur.request->function )
|
||||
{
|
||||
cur.request->function->fun.set_connector(model_connector);
|
||||
cur.request->function->fun.propagate_connector();
|
||||
}
|
||||
|
||||
cur.session = session_manager.CheckIfFunctionRequireSession();
|
||||
model_connector.set_winix_session(cur.session);
|
||||
|
||||
SetLocale();
|
||||
|
||||
if( cur.session->new_session )
|
||||
{
|
||||
cur.session->plugin_data.Resize(plugin.Size());
|
||||
plugin.Call(WINIX_SESSION_CREATED);
|
||||
}
|
||||
|
||||
plugin.Call(WINIX_SESSION_CHANGED);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* IMPROVE ME
|
||||
* it will not have the root directory set
|
||||
* so as a response only a blank page is shown
|
||||
* (root directory is set in funcions.Parse())
|
||||
*
|
||||
* IMPROVE ME
|
||||
* we can add a better return code (http status):
|
||||
* http://www.ietf.org/rfc/rfc2616.txt
|
||||
* "A server SHOULD return 414 (Request-URI Too Long) status if a URI is longer than the server can handle"
|
||||
*
|
||||
*/
|
||||
cur.request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
log << log1 << "App: the URL is too long: " << cur.request->env_request_uri.size() << logend;
|
||||
}
|
||||
|
||||
if( cur.request->dir_tab.empty() )
|
||||
{
|
||||
log << log1 << "App: there is no a root dir (dir_tab is empty), adding a root dir" << logend;
|
||||
Item * root_dir = system.dirs.GetRootDir();
|
||||
|
||||
if( root_dir )
|
||||
{
|
||||
cur.request->dir_tab.push_back(root_dir);
|
||||
cur.request->last_item = cur.request->dir_tab.back();
|
||||
cur.mount = system.mounts.CalcCurMount();
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "App: oops, we do not have a root dir" << logend;
|
||||
}
|
||||
}
|
||||
|
||||
if( cur.mount->type != system.mounts.MountTypeStatic() )
|
||||
Make();
|
||||
cur.request->function->fun.set_connector(model_connector); // IMPROVEME may would be better to add set_connector() method to functions?
|
||||
cur.request->function->fun.propagate_connector();
|
||||
}
|
||||
|
||||
SendAnswer();
|
||||
/*
|
||||
* set global connector for now
|
||||
* in the future each thread will have its own model_connector
|
||||
*
|
||||
* don't set connector for item_tab - it will be moved out from request
|
||||
*/
|
||||
cur.request->item.set_connector(model_connector);
|
||||
|
||||
cur.mount = system.mounts.CalcCurMount();
|
||||
|
||||
cur.session = session_manager.PrepareSession();
|
||||
model_connector.set_winix_session(cur.session);
|
||||
|
||||
functions.CheckFunctionAndSymlink(); // here a function can be changed
|
||||
|
||||
if( cur.request->function )
|
||||
{
|
||||
cur.request->function->fun.set_connector(model_connector);
|
||||
cur.request->function->fun.propagate_connector();
|
||||
}
|
||||
|
||||
cur.session = session_manager.CheckIfFunctionRequireSession();
|
||||
model_connector.set_winix_session(cur.session);
|
||||
|
||||
SetLocale();
|
||||
|
||||
if( cur.session->new_session )
|
||||
{
|
||||
cur.session->plugin_data.Resize(plugin.Size());
|
||||
plugin.Call(WINIX_SESSION_CREATED);
|
||||
}
|
||||
|
||||
plugin.Call(WINIX_SESSION_CHANGED);
|
||||
|
||||
|
||||
////////////////////////
|
||||
|
||||
|
||||
cur.request->PrepareAnswerType();
|
||||
|
||||
if( cur.session->ip_ban && cur.session->ip_ban->IsIPBanned() )
|
||||
{
|
||||
pt::Date date(cur.session->ip_ban->expires);
|
||||
|
||||
// IMPROVE ME there is no slog now
|
||||
//slog << logerror << T("this_ip_is_banned_until") << ' ' << date << " UTC" << logend;
|
||||
|
||||
cur.request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
cur.request->http_status = Header::status_403_forbidden;
|
||||
}
|
||||
|
||||
// cur.request->status can be changed by function_parser
|
||||
if( cur.request->status == WINIX_ERR_OK && cur.request->http_status == Header::status_200_ok )
|
||||
plugin.Call(WINIX_PREPARE_REQUEST);
|
||||
|
||||
// if( cur.request->status == WINIX_ERR_OK )
|
||||
// functions.CheckFunctionAndSymlink();
|
||||
|
||||
CheckAccessFromPlugins();
|
||||
|
||||
// !! CHECK ME CheckFunctionAndSymlink can set redirect_to
|
||||
// may it should be tested before calling CheckIfNeedSSLredirect?
|
||||
CheckIfNeedSSLredirect();
|
||||
|
||||
if( !cur.request->redirect_to.empty() )
|
||||
return;
|
||||
|
||||
AddDefaultModels();
|
||||
|
||||
if( cur.request->status == WINIX_ERR_OK && cur.request->http_status == Header::status_200_ok )
|
||||
functions.MakeFunction();
|
||||
|
||||
if( cur.session->spam_score > 0 )
|
||||
log << log1 << "App: spam score: " << cur.session->spam_score << logend;
|
||||
|
||||
if( cur.request->IsParam(L"noredirect") )
|
||||
cur.request->redirect_to.clear();
|
||||
|
||||
if( cur.request->status == WINIX_ERR_OK && cur.request->http_status == Header::status_200_ok )
|
||||
plugin.Call(WINIX_PROCESS_REQUEST);
|
||||
|
||||
CheckPostRedirect();
|
||||
|
||||
if( !cur.request->redirect_to.empty() )
|
||||
return;
|
||||
|
||||
if( cur.request->dir_tab.empty() )
|
||||
{
|
||||
log << log1 << "App: there is no a root dir (dir_tab is empty -- after calling a function)" << logend;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool App::AddRootDir()
|
||||
{
|
||||
Item * root_dir = system.dirs.GetRootDir();
|
||||
|
||||
if( root_dir )
|
||||
{
|
||||
cur.request->dir_tab.push_back(root_dir);
|
||||
cur.request->last_item = cur.request->dir_tab.back();
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log3 << "App: there is no a root directory" << logend;
|
||||
cur.request->http_status = Header::status_404_not_found;
|
||||
}
|
||||
|
||||
return root_dir != nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void App::ProcessRequestThrow()
|
||||
{
|
||||
if( AddRootDir() )
|
||||
{
|
||||
ReadRequest();
|
||||
|
||||
if( !BaseUrlRedirect() )
|
||||
{
|
||||
if( functions.Parse() )
|
||||
{
|
||||
ReadPostVars();
|
||||
}
|
||||
|
||||
if( cur.mount->type != system.mounts.MountTypeStatic() )
|
||||
{
|
||||
MakeRenameMeToABetterName();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -732,6 +786,8 @@ void App::ProcessRequest()
|
||||
log << log2 << config.log_delimiter << logend;
|
||||
|
||||
ProcessRequestThrow();
|
||||
ModifyStatusCodeIfNeeded();
|
||||
SendAnswer();
|
||||
SaveSessionsIfNeeded();
|
||||
|
||||
cur.request->RequestEnds();
|
||||
@@ -784,6 +840,7 @@ void App::ClearAfterRequest()
|
||||
aheader_value.clear();
|
||||
cur.mount = system.mounts.GetEmptyMount();
|
||||
system.mounts.pmount = cur.mount; // IMPROVE ME system.mounts.pmount will be removed
|
||||
post_log_tmp_buffer.clear();
|
||||
// send_data_buf doesn't have to be cleared and it is better to not clear it (optimizing)
|
||||
|
||||
model_connector.set_winix_request(nullptr);
|
||||
@@ -908,70 +965,6 @@ void App::AddDefaultModels()
|
||||
|
||||
|
||||
|
||||
// !! IMPROVE ME change to a better name
|
||||
// may ProcessRequest()? but probably it is already defined...
|
||||
// this method needs some refactoring
|
||||
void App::Make()
|
||||
{
|
||||
if( cur.request->dir_tab.empty() )
|
||||
{
|
||||
log << log1 << "App: there is no a root dir (dir_tab is empty)" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
cur.request->PrepareAnswerType();
|
||||
|
||||
if( cur.session->ip_ban && cur.session->ip_ban->IsIPBanned() )
|
||||
{
|
||||
pt::Date date(cur.session->ip_ban->expires);
|
||||
|
||||
// IMPROVE ME there is no slog now
|
||||
//slog << logerror << T("this_ip_is_banned_until") << ' ' << date << " UTC" << logend;
|
||||
|
||||
cur.request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
// cur.request->status can be changed by function_parser
|
||||
if( cur.request->status == WINIX_ERR_OK )
|
||||
plugin.Call(WINIX_PREPARE_REQUEST);
|
||||
|
||||
// if( cur.request->status == WINIX_ERR_OK )
|
||||
// functions.CheckFunctionAndSymlink();
|
||||
|
||||
CheckAccessFromPlugins();
|
||||
|
||||
// !! CHECK ME CheckFunctionAndSymlink can set redirect_to
|
||||
// may it should be tested before calling CheckIfNeedSSLredirect?
|
||||
CheckIfNeedSSLredirect();
|
||||
|
||||
if( !cur.request->redirect_to.empty() )
|
||||
return;
|
||||
|
||||
AddDefaultModels();
|
||||
|
||||
if( cur.request->status == WINIX_ERR_OK )
|
||||
functions.MakeFunction();
|
||||
|
||||
if( cur.session->spam_score > 0 )
|
||||
log << log1 << "App: spam score: " << cur.session->spam_score << logend;
|
||||
|
||||
if( cur.request->IsParam(L"noredirect") )
|
||||
cur.request->redirect_to.clear();
|
||||
|
||||
if( cur.request->status == WINIX_ERR_OK )
|
||||
plugin.Call(WINIX_PROCESS_REQUEST);
|
||||
|
||||
CheckPostRedirect();
|
||||
|
||||
if( !cur.request->redirect_to.empty() )
|
||||
return;
|
||||
|
||||
if( cur.request->dir_tab.empty() )
|
||||
{
|
||||
log << log1 << "App: there is no a root dir (dir_tab is empty -- after calling a function)" << logend;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void App::LogEnvironmentVariables()
|
||||
@@ -1052,7 +1045,7 @@ void App::ReadRequest()
|
||||
LogAccess();
|
||||
ReadEnvHTTPVariables();
|
||||
|
||||
ReadPostVars();
|
||||
//ReadPostVars();
|
||||
|
||||
if( config.log_env_variables )
|
||||
LogEnvironmentVariables();
|
||||
@@ -1071,6 +1064,7 @@ void App::ReadRequest()
|
||||
|
||||
if( cur.request->using_ssl )
|
||||
log << log3 << "App: connection secure through SSL" << logend;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1293,8 +1287,7 @@ void App::LogAccess()
|
||||
}
|
||||
|
||||
|
||||
|
||||
void App::ReadPostJson()
|
||||
void App::ReadInputPostToBuffer()
|
||||
{
|
||||
char buffer[1024];
|
||||
const int buffer_len = sizeof(buffer) / sizeof(char) - 1;
|
||||
@@ -1303,34 +1296,89 @@ void App::ReadPostJson()
|
||||
post_buffer.clear();
|
||||
post_buffer.reserve(1024 * 1024 * 5); // IMPROVEME add to config?
|
||||
|
||||
cur.request->is_postin_used = true;
|
||||
|
||||
do
|
||||
{
|
||||
// IMPROVE ME
|
||||
// we can read to pt::TextBuffer and make a pt::JSONToSpaceParser::Parse(pt::TextBuffer &) method
|
||||
read_len = FCGX_GetStr(buffer, buffer_len, fcgi_request.in);
|
||||
|
||||
if( read_len > 0 )
|
||||
post_buffer.append(buffer, read_len);
|
||||
post_buffer.write(buffer, read_len);
|
||||
}
|
||||
while( read_len == buffer_len );
|
||||
|
||||
}
|
||||
|
||||
|
||||
void App::ParsePostJson()
|
||||
{
|
||||
FunctionBase * fun = cur.request->function;
|
||||
|
||||
space_parser.set_object_items_limit( (fun && fun->post_max_object_items != 0) ? fun->post_max_object_items : config.post_max_object_items);
|
||||
space_parser.set_table_items_limit( (fun && fun->post_max_table_items != 0) ? fun->post_max_table_items : config.post_max_table_items);
|
||||
space_parser.set_all_items_limit( (fun && fun->post_max_all_items != 0) ? fun->post_max_all_items : config.post_max_all_items);
|
||||
space_parser.set_nested_level_limit( (fun && fun->post_max_nested_objects != 0) ? fun->post_max_nested_objects : config.post_max_nested_objects);
|
||||
|
||||
pt::SpaceParser::Status parse_status = space_parser.parse_json(post_buffer, cur.request->post_in);
|
||||
|
||||
if( parse_status == pt::SpaceParser::ok )
|
||||
{
|
||||
}
|
||||
else
|
||||
if( parse_status == pt::SpaceParser::syntax_error )
|
||||
{
|
||||
log << log1 << "App: cannot parse the input stream as an JSON object"
|
||||
<< ", syntax error in line: " << space_parser.get_last_parsed_line() << ":" << space_parser.get_last_parsed_column() << logend;
|
||||
|
||||
cur.request->post_in.clear();
|
||||
cur.request->http_status = Header::status_400_bad_request;
|
||||
}
|
||||
else
|
||||
if( parse_status == pt::SpaceParser::limit_object_items_exceeded )
|
||||
{
|
||||
log << log1 << "App: object items limit exceeded when parsing input JSON object" << logend;
|
||||
cur.request->post_in.clear();
|
||||
cur.request->http_status = Header::status_400_bad_request;
|
||||
}
|
||||
else
|
||||
if( parse_status == pt::SpaceParser::limit_table_items_exceeded )
|
||||
{
|
||||
log << log1 << "App: table items limit exceeded when parsing input JSON object" << logend;
|
||||
cur.request->post_in.clear();
|
||||
cur.request->http_status = Header::status_400_bad_request;
|
||||
}
|
||||
else
|
||||
if( parse_status == pt::SpaceParser::limit_all_items_exceeded )
|
||||
{
|
||||
log << log1 << "App: all items limit exceeded when parsing input JSON object" << logend;
|
||||
cur.request->post_in.clear();
|
||||
cur.request->http_status = Header::status_400_bad_request;
|
||||
}
|
||||
else
|
||||
if( parse_status == pt::SpaceParser::limit_nested_level_exceeded )
|
||||
{
|
||||
log << log1 << "App: nested objects/tables limit exceeded when parsing input JSON object" << logend;
|
||||
cur.request->post_in.clear();
|
||||
cur.request->http_status = Header::status_400_bad_request;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void App::ReadPostJson()
|
||||
{
|
||||
ReadInputPostToBuffer();
|
||||
|
||||
if( !post_buffer.empty() )
|
||||
{
|
||||
pt::SpaceParser::Status status = space_parser.parse_json(post_buffer.c_str(), cur.request->post_in);
|
||||
post_buffer.clear();
|
||||
|
||||
if( status != pt::SpaceParser::ok )
|
||||
if( config.post_json_max == 0 || post_buffer.size() <= config.post_json_max )
|
||||
{
|
||||
log << log1 << "App: cannot parse the input stream as an JSON object";
|
||||
|
||||
if( status == pt::SpaceParser::syntax_error )
|
||||
log << ", syntax error in line: " << space_parser.get_last_parsed_line() << logend;
|
||||
|
||||
cur.request->post_in.clear();
|
||||
// return an error (http error of some kind?)
|
||||
ParsePostJson();
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "App: the input stream exceeded the limit of " << config.post_json_max << " bytes (skipping parsing)" << logend;
|
||||
cur.request->http_status = Header::status_400_bad_request;
|
||||
}
|
||||
|
||||
post_buffer.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1342,26 +1390,29 @@ void App::ReadPostJson()
|
||||
|
||||
void App::ReadPostVars()
|
||||
{
|
||||
// CHECKME
|
||||
// what about errors during parsing input?
|
||||
|
||||
if( cur.request->method == Request::post || cur.request->method == Request::delete_ )
|
||||
{
|
||||
if( pt::is_substr_nc(L"multipart/form-data", cur.request->env_content_type.c_str()) )
|
||||
{
|
||||
log << log3 << "App: post content type: multipart/form-data" << logend;
|
||||
post_multi_parser.Parse(fcgi_request.in, cur.request->post_tab, cur.request->post_file_tab);
|
||||
post_multi_parser.Parse(fcgi_request.in, *cur.request); // IMPROVEME add checking for return status
|
||||
}
|
||||
else
|
||||
if( pt::is_substr_nc(Winix::Header::application_json, cur.request->env_content_type.c_str()) )
|
||||
{
|
||||
log << log3 << "App: post content type: " << Winix::Header::application_json << logend;
|
||||
log << log3 << "App: post content type: " << Winix::Header::application_json << ", using json parser" << logend;
|
||||
ReadPostJson();
|
||||
}
|
||||
else
|
||||
{
|
||||
// IMPROVE ME may to check a correct content-type header?
|
||||
post_parser.Parse(fcgi_request.in, cur.request->post_tab);
|
||||
post_parser.Parse(fcgi_request.in, *cur.request); // IMPROVEME add checking for return status
|
||||
}
|
||||
|
||||
if( config.log_whole_http_post )
|
||||
{
|
||||
cur.request->post_in.serialize_to_json_stream(post_log_tmp_buffer, true);
|
||||
log << log3 << "App: the whole http post after parsing:" << logend << post_log_tmp_buffer << logend;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1464,7 +1515,7 @@ return false;
|
||||
}
|
||||
|
||||
|
||||
bool App::PrepareHeadersStaticCreateResource(pt::WTextStream & out_path)
|
||||
bool App::CreateStaticResourcePath(pt::WTextStream & out_path)
|
||||
{
|
||||
size_t i = 0;
|
||||
Item * dir = system.dirs.GetDir(system.mounts.pmount->dir_id);
|
||||
@@ -1476,7 +1527,7 @@ bool App::PrepareHeadersStaticCreateResource(pt::WTextStream & out_path)
|
||||
}
|
||||
|
||||
size_t how_many_dirs = system.dirs.DirLevel(dir->id);
|
||||
const wchar_t * path = SkipDirs(cur.request->env_request_uri.c_str(), how_many_dirs);
|
||||
const wchar_t * path = SkipDirs(cur.request->env_request_uri.c_str(), how_many_dirs);
|
||||
|
||||
// the path begins with a slash only if how_many_dirs is zero
|
||||
while( *path == '/' )
|
||||
@@ -1492,12 +1543,12 @@ return true;
|
||||
}
|
||||
|
||||
|
||||
void App::PrepareHeadersStatic()
|
||||
void App::PrepareSendFileHeaderForStaticMountpoint()
|
||||
{
|
||||
if( PathHasUpDir(cur.request->env_request_uri) )
|
||||
{
|
||||
log << log1 << "App: incorrect path for a static file" << logend;
|
||||
PrepareHeadersForbidden();
|
||||
cur.request->http_status = Header::status_403_forbidden;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1507,27 +1558,27 @@ void App::PrepareHeadersStatic()
|
||||
if( index >= config.static_dirs.size() )
|
||||
{
|
||||
log << log1 << "App: static dir with index " << index << " is not defined in the config" << logend;
|
||||
PrepareHeadersForbidden();
|
||||
cur.request->http_status = Header::status_403_forbidden;
|
||||
return;
|
||||
}
|
||||
|
||||
pt::WTextStream path;
|
||||
path << config.static_dirs[index] << L"/";
|
||||
|
||||
if( !PrepareHeadersStaticCreateResource(path) )
|
||||
if( !CreateStaticResourcePath(path) )
|
||||
{
|
||||
PrepareHeadersForbidden();
|
||||
cur.request->http_status = Header::status_403_forbidden;
|
||||
return;
|
||||
}
|
||||
|
||||
AddHeader(L"Status", L"200 OK");
|
||||
|
||||
/*
|
||||
* FIX ME now we can send full path (apache, lighttpd) and relative path (nginx)
|
||||
* but this feature for mounting static content probably will be removed
|
||||
* FIX ME now we can send full path (apache, lighttpd) and relative path (nginx)
|
||||
* but this feature for mounting static content probably will be removed
|
||||
*/
|
||||
if( AddHeader(config.send_file_header, path) )
|
||||
{
|
||||
log << log2 << "App: sending a file from a static mountpoint: " << path << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1579,80 +1630,58 @@ void App::PrepareHeaderContentType()
|
||||
|
||||
|
||||
|
||||
void App::PrepareHeadersForbidden()
|
||||
{
|
||||
AddHeader(L"Status", L"403 Forbidden");
|
||||
PrepareHeaderContentType();
|
||||
}
|
||||
|
||||
|
||||
void App::PrepareHeadersRedirect()
|
||||
void App::ModifyStatusForRedirect()
|
||||
{
|
||||
switch(cur.request->redirect_type)
|
||||
{
|
||||
case 300:
|
||||
AddHeader(L"Status", L"300 Multiple Choices");
|
||||
cur.request->http_status = Header::status_300_multiple_choices;
|
||||
break;
|
||||
|
||||
case 301:
|
||||
AddHeader(L"Status", L"301 Moved Permanently");
|
||||
cur.request->http_status = Header::status_301_moved_permanently;
|
||||
break;
|
||||
|
||||
case 302:
|
||||
AddHeader(L"Status", L"302 Found");
|
||||
cur.request->http_status = Header::status_302_found;
|
||||
break;
|
||||
|
||||
case 307:
|
||||
AddHeader(L"Status", L"307 Temporary Redirect");
|
||||
cur.request->http_status = Header::status_307_temporary_redirect;
|
||||
break;
|
||||
|
||||
case 303:
|
||||
default:
|
||||
AddHeader(L"Status", L"303 See Other");
|
||||
cur.request->http_status = Header::status_303_see_other;
|
||||
break;
|
||||
}
|
||||
|
||||
AddHeader(L"Location", cur.request->redirect_to);
|
||||
log << log2 << "App: redirect to: " << cur.request->redirect_to << logend;
|
||||
}
|
||||
|
||||
|
||||
void App::PrepareHeadersSendFile()
|
||||
void App::PrepareSendFileHeader()
|
||||
{
|
||||
AddHeader(L"Status", L"200 OK");
|
||||
|
||||
if( AddHeader(config.send_file_header, cur.request->x_sendfile) )
|
||||
{
|
||||
log << log2 << "App: sending file: " << cur.request->x_sendfile << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void App::PrepareHeadersCompression(int compress_encoding)
|
||||
void App::PrepareContentEncodingHeader(int compress_encoding)
|
||||
{
|
||||
if( compress_encoding == 0 || compress_encoding == 1 )
|
||||
{
|
||||
AddHeader(L"Content-Encoding", L"deflate");
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHeader(L"Content-Encoding", L"gzip");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void App::PrepareHeadersNormal(Header header, size_t output_size)
|
||||
void App::PrepareContentLengthHeader(size_t output_size)
|
||||
{
|
||||
switch( header )
|
||||
{
|
||||
case h_404:
|
||||
AddHeader(L"Status", L"404 Not Found");
|
||||
PrepareHeaderContentType();
|
||||
break;
|
||||
|
||||
case h_403:
|
||||
PrepareHeadersForbidden();
|
||||
break;
|
||||
|
||||
default:
|
||||
AddHeader(L"Status", L"200 OK");
|
||||
PrepareHeaderContentType();
|
||||
}
|
||||
|
||||
if( output_size != static_cast<size_t>(-1) )
|
||||
{
|
||||
pt::WTextStream buf;
|
||||
@@ -1734,35 +1763,53 @@ void App::SendCookies()
|
||||
}
|
||||
|
||||
|
||||
void App::PrepareHeaders(bool compressing, int compress_encoding, Header header, size_t output_size)
|
||||
void App::PrepareHeaderStatus(int http_status)
|
||||
{
|
||||
pt::WTextStream value;
|
||||
Header::prepare_status_value(http_status, value, false);
|
||||
AddHeader(L"Status", value);
|
||||
log << log2 << "App: http status: " << value << logend;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void App::PrepareHeaders(bool compressing, int compress_encoding, size_t output_size)
|
||||
{
|
||||
PrepareSessionCookie();
|
||||
|
||||
if( cur.request->send_as_attachment )
|
||||
{
|
||||
AddHeader(L"Content-Disposition", L"attachment");
|
||||
}
|
||||
|
||||
//if( !cur.request->redirect_to.empty() && !cur.request->return_json )
|
||||
if( !cur.request->redirect_to.empty() )
|
||||
{
|
||||
PrepareHeadersRedirect();
|
||||
ModifyStatusForRedirect();
|
||||
AddHeader(L"Location", cur.request->redirect_to);
|
||||
log << log2 << "App: redirect to: " << cur.request->redirect_to << logend;
|
||||
}
|
||||
else
|
||||
if( system.mounts.pmount->type == system.mounts.MountTypeStatic() )
|
||||
{
|
||||
PrepareHeadersStatic();
|
||||
PrepareSendFileHeaderForStaticMountpoint();
|
||||
}
|
||||
else
|
||||
if( !cur.request->x_sendfile.empty() )
|
||||
{
|
||||
PrepareHeadersSendFile();
|
||||
PrepareSendFileHeader();
|
||||
}
|
||||
else
|
||||
{
|
||||
PrepareHeadersNormal(header, output_size);
|
||||
PrepareContentLengthHeader(output_size);
|
||||
}
|
||||
|
||||
if( compressing )
|
||||
PrepareHeadersCompression(compress_encoding);
|
||||
{
|
||||
PrepareContentEncodingHeader(compress_encoding);
|
||||
}
|
||||
|
||||
PrepareHeaderStatus(cur.request->http_status);
|
||||
PrepareHeaderContentType();
|
||||
}
|
||||
|
||||
|
||||
@@ -1804,7 +1851,6 @@ void App::SelectCompression(size_t source_len, bool & compression_allowed, int &
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( config.compression_encoding == 2 || config.compression_encoding == 20 )
|
||||
{
|
||||
if( accept_encoding_parser.AcceptGzip() )
|
||||
@@ -1833,54 +1879,53 @@ bool App::CanSendContent()
|
||||
return false;
|
||||
}
|
||||
|
||||
// if( cur.request->return_json )
|
||||
// {
|
||||
// // if there is a redirect flag then it will be put to info struct
|
||||
// return true;
|
||||
// }
|
||||
|
||||
if( !cur.request->redirect_to.empty() )
|
||||
{
|
||||
// if there is a redirect and no json is requred then we do not send the content
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
we don't have to check the HEAD method
|
||||
the server (lighttpd) doesn't send the body of its own
|
||||
*/
|
||||
if( cur.request->method == Request::head )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
App::Header App::GetHTTPStatusCode()
|
||||
void App::ModifyStatusCodeIfNeeded()
|
||||
{
|
||||
Error status = cur.request->status;
|
||||
Header header = h_200;
|
||||
Error status = cur.request->status;
|
||||
|
||||
if( status == WINIX_ERR_NO_ITEM || status == WINIX_ERR_NO_FUNCTION || status == WINIX_ERR_UNKNOWN_PARAM )
|
||||
// moved from Templates when a pattern was selected
|
||||
switch( status )
|
||||
{
|
||||
header = h_404;
|
||||
log << log2 << "App: http response: 404 Not Found" << logend;
|
||||
case WINIX_ERR_INCORRECT_URI: // !!temporarily
|
||||
case WINIX_ERR_INTERNAL_ERROR: // !! temprarily
|
||||
case WINIX_ERR_PERMISSION_DENIED:
|
||||
case WINIX_ERR_CANT_CHANGE_USER:
|
||||
case WINIX_ERR_CANT_CHANGE_GROUP:
|
||||
case WINIX_ERR_CANT_CHANGE_PRIVILEGES:
|
||||
cur.request->http_status = Header::status_403_forbidden;
|
||||
break;
|
||||
|
||||
case WINIX_ERR_NO_ITEM:
|
||||
case WINIX_ERR_NO_FUNCTION:
|
||||
case WINIX_ERR_UNKNOWN_PARAM:
|
||||
cur.request->http_status = Header::status_404_not_found;
|
||||
break;
|
||||
}
|
||||
|
||||
if( status == WINIX_ERR_PERMISSION_DENIED || status == WINIX_ERR_CANT_CHANGE_USER || status == WINIX_ERR_CANT_CHANGE_GROUP )
|
||||
{
|
||||
header = h_403;
|
||||
log << log2 << "App: http response: 403 Forbidden" << logend;
|
||||
}
|
||||
|
||||
if( cur.request->use_200_status_for_not_found_and_permission_denied && (header == h_404 || header == h_403) )
|
||||
if( cur.request->use_200_status_for_not_found_and_permission_denied && (
|
||||
cur.request->http_status == Header::status_404_not_found ||
|
||||
cur.request->http_status == Header::status_403_forbidden
|
||||
))
|
||||
{
|
||||
cur.request->http_status = Header::status_200_ok;
|
||||
log << log3 << "App: changing the http response to: 200 OK" << logend;
|
||||
header = h_200;
|
||||
}
|
||||
|
||||
return header;
|
||||
}
|
||||
|
||||
|
||||
@@ -2389,7 +2434,6 @@ void App::Send8bitOutput(BinaryPage & output)
|
||||
{
|
||||
bool compressing = false;
|
||||
int compress_encoding = 0;
|
||||
Header header = GetHTTPStatusCode();
|
||||
size_t output_size = 0;
|
||||
|
||||
SelectCompression(output.size(), compressing, compress_encoding);
|
||||
@@ -2409,7 +2453,7 @@ void App::Send8bitOutput(BinaryPage & output)
|
||||
output_size = output.size();
|
||||
}
|
||||
|
||||
PrepareHeaders(compressing, compress_encoding, header, output_size);
|
||||
PrepareHeaders(compressing, compress_encoding, output_size);
|
||||
SendHeaders();
|
||||
SendCookies();
|
||||
FCGX_PutS("\r\n", fcgi_request.out);
|
||||
|
||||
@@ -127,17 +127,10 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
enum Header
|
||||
{
|
||||
h_200,
|
||||
h_404,
|
||||
h_403
|
||||
};
|
||||
|
||||
PostParser post_parser;
|
||||
PostMultiParser post_multi_parser;
|
||||
pt::SpaceParser space_parser;
|
||||
std::string post_buffer;
|
||||
pt::TextStream post_buffer;
|
||||
|
||||
CookieParser cookie_parser;
|
||||
AcceptBaseParser accept_base_parser;
|
||||
@@ -154,6 +147,7 @@ private:
|
||||
//std::wstring html_filtered;
|
||||
//std::string output_8bit;
|
||||
pt::TextStream serialized_model;
|
||||
pt::WTextStream post_log_tmp_buffer;
|
||||
|
||||
pt::WTextStream output_tmp_filtered_stream;
|
||||
BinaryPage output_8bit;
|
||||
@@ -196,6 +190,8 @@ private:
|
||||
bool DropPrivileges(char * user, char * group);
|
||||
bool DropPrivileges(const char * user, uid_t uid, gid_t gid, bool additional_groups);
|
||||
bool CheckAccessFromPlugins();
|
||||
void MakeRenameMeToABetterName();
|
||||
bool AddRootDir();
|
||||
void ProcessRequestThrow();
|
||||
void ProcessRequest();
|
||||
void BaseUrlRedirect(int code, bool add_subdomain);
|
||||
@@ -205,7 +201,6 @@ private:
|
||||
void CheckPostRedirect();
|
||||
void UseEzcGenerator();
|
||||
void AddDefaultModels();
|
||||
void Make();
|
||||
void SaveSessionsIfNeeded(); // !! IMPROVE ME wywalic do menagera sesji??
|
||||
void LogAccess();
|
||||
void SendData(const BinaryPage & page, FCGX_Stream * out);
|
||||
@@ -251,6 +246,8 @@ private:
|
||||
void ReadEnvHTTPVariables();
|
||||
bool SaveEnvHTTPVariable(const char * env);
|
||||
void ReadEnvRemoteIP();
|
||||
void ReadInputPostToBuffer();
|
||||
void ParsePostJson();
|
||||
void ReadPostJson();
|
||||
void ReadPostVars();
|
||||
|
||||
@@ -263,7 +260,7 @@ private:
|
||||
|
||||
bool IsRequestedFrame();
|
||||
|
||||
Header GetHTTPStatusCode();
|
||||
void ModifyStatusCodeIfNeeded();
|
||||
void PrepareSessionCookie();
|
||||
void SendHeaders();
|
||||
void SendCookies();
|
||||
@@ -271,15 +268,15 @@ private:
|
||||
bool AddHeader(const std::wstring & name, const std::wstring & value);
|
||||
bool AddHeader(const wchar_t * name, const pt::WTextStream & value);
|
||||
bool AddHeader(const std::wstring & name, const pt::WTextStream & value);
|
||||
bool PrepareHeadersStaticCreateResource(pt::WTextStream & out_path);
|
||||
void PrepareHeadersStatic();
|
||||
bool CreateStaticResourcePath(pt::WTextStream & out_path);
|
||||
void PrepareSendFileHeaderForStaticMountpoint();
|
||||
void PrepareHeaderContentType();
|
||||
void PrepareHeadersForbidden();
|
||||
void PrepareHeadersRedirect();
|
||||
void PrepareHeadersSendFile();
|
||||
void PrepareHeadersCompression(int compress_encoding);
|
||||
void PrepareHeadersNormal(Header header, size_t output_size);
|
||||
void PrepareHeaders(bool compressing, int compress_encoding, Header header, size_t output_size);
|
||||
void ModifyStatusForRedirect();
|
||||
void PrepareSendFileHeader();
|
||||
void PrepareContentEncodingHeader(int compress_encoding);
|
||||
void PrepareContentLengthHeader(size_t output_size);
|
||||
void PrepareHeaderStatus(int http_status);
|
||||
void PrepareHeaders(bool compressing, int compress_encoding, size_t output_size);
|
||||
int SelectDeflateVersion();
|
||||
void SelectCompression(size_t source_len, bool & compression_allowed, int & compression_encoding);
|
||||
bool CanSendContent();
|
||||
|
||||
@@ -72,7 +72,12 @@ void Config::ShowError(const std::wstring & config_file)
|
||||
break;
|
||||
|
||||
case pt::SpaceParser::syntax_error:
|
||||
log << log1 << "Config: syntax error in file: " << config_file << ", line: " << parser.get_last_parsed_line() << logend;
|
||||
log << log1 << "Config: syntax error in file: " << config_file << ", line: "
|
||||
<< parser.get_last_parsed_line() << ":" << parser.get_last_parsed_column() << logend;
|
||||
break;
|
||||
|
||||
default:
|
||||
// there are no limits sets when parsing the config file
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -142,9 +147,15 @@ void Config::AssignValues()
|
||||
log_post_value_size = Size(L"log_post_value_size", 80);
|
||||
log_env_variables = Bool(L"log_env_variables", false);
|
||||
log_env_http_variables = Bool(L"log_env_http_variables", false);
|
||||
log_whole_http_post = Bool(L"log_whole_http_post", false);
|
||||
log_http_answer_headers = Bool(L"log_http_answer_headers", false);
|
||||
|
||||
post_file_max = Size(L"post_file_max", 8388608); // 8 MB
|
||||
post_json_max = Size(L"post_json_max", 8388608); // 8 MB
|
||||
post_max_object_items = Size(L"post_max_object_items", 1024);
|
||||
post_max_table_items = Size(L"post_max_table_items", 4096);
|
||||
post_max_all_items = Size(L"post_max_all_items", 8192);
|
||||
post_max_nested_objects = Size(L"post_max_nested_objects", 32);
|
||||
|
||||
upload_dir = Text(L"upload_dir");
|
||||
common_dir = Text(L"common_dir");
|
||||
@@ -177,6 +188,7 @@ void Config::AssignValues()
|
||||
templates_index = Text(L"templates_index", L"index.html");
|
||||
templates_index_generic = Text(L"templates_index_generic", L"index_generic.html");
|
||||
templates_index_raw = Text(L"templates_index_raw", L"index_raw.html");
|
||||
templates_request_status = Text(L"templates_request_status", L"request_status.html");
|
||||
template_only_root_use_template_fun = Bool(L"template_only_root_use_template_fun", false);
|
||||
|
||||
http_session_id_name = Text(L"http_session_id_name", L"session_id");
|
||||
|
||||
@@ -84,7 +84,8 @@ public:
|
||||
// the log level (how much info should be inserted to logs)
|
||||
// 1 - minimum
|
||||
// 2 - (default)
|
||||
// 3 - maximum - all logs
|
||||
// 3 - more logs
|
||||
// 4 - maximum - all logs
|
||||
int log_level;
|
||||
|
||||
// logging to stdout too
|
||||
@@ -130,11 +131,17 @@ public:
|
||||
std::wstring log_delimiter;
|
||||
|
||||
// log environment variables (fastcgi environment)
|
||||
// default: false;
|
||||
bool log_env_variables;
|
||||
|
||||
// log environment http variables (only HTTP_* variables from fastcgi environment)
|
||||
// default: false;
|
||||
bool log_env_http_variables;
|
||||
|
||||
// log the whole http post structure (in json format) after parsing the post input
|
||||
// default: false;
|
||||
bool log_whole_http_post;
|
||||
|
||||
// log headers (+cookies) which are returned to the client
|
||||
// this is what winix has generated -- the web server can change or add other headers
|
||||
// default: false
|
||||
@@ -198,6 +205,10 @@ public:
|
||||
// default: index_raw.html
|
||||
std::wstring templates_index_raw;
|
||||
|
||||
// html template used to show a http status such as Forbidden or Not Found
|
||||
// default: request_status.html
|
||||
std::wstring templates_request_status;
|
||||
|
||||
// if true then only root can use 'template' winix function
|
||||
// default: false
|
||||
bool template_only_root_use_template_fun;
|
||||
@@ -404,6 +415,35 @@ public:
|
||||
// 0 - not used
|
||||
size_t post_file_max;
|
||||
|
||||
// maximum length of the input stream when parsing it as json
|
||||
// default: 8388608 - 8MB
|
||||
// set zero to disable checking
|
||||
size_t post_json_max;
|
||||
|
||||
// maximum key/value pairs in one object when parsing post json structure
|
||||
// default: 1024
|
||||
// set zero to disable checking
|
||||
// each winix function can set its own limits
|
||||
size_t post_max_object_items;
|
||||
|
||||
// maximum items in one table when parsing post json structure
|
||||
// default: 4096
|
||||
// set zero to disable checking
|
||||
// each winix function can set its own limits
|
||||
size_t post_max_table_items;
|
||||
|
||||
// maximum items (key/values pairs of objects or table items) througout the whole post input json structure
|
||||
// default: 8192
|
||||
// set zero to disable checking
|
||||
// each winix function can set its own limits
|
||||
size_t post_max_all_items;
|
||||
|
||||
// maximum nested objects/tables when parsing post json structure
|
||||
// default: 32
|
||||
// set zero to disable checking
|
||||
// each winix function can set its own limits
|
||||
size_t post_max_nested_objects;
|
||||
|
||||
// directory for static files
|
||||
std::wstring upload_dir;
|
||||
|
||||
|
||||
74
winixd/core/header.cpp
Normal file
74
winixd/core/header.cpp
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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) 2022, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "header.h"
|
||||
|
||||
|
||||
namespace Winix
|
||||
{
|
||||
|
||||
const wchar_t * Header::find_status_string_value(int http_status)
|
||||
{
|
||||
size_t table_len = sizeof(status_int_string_map) / sizeof(StatusIntStringMapHelper);
|
||||
|
||||
for(size_t i=0 ; i < table_len ; ++i)
|
||||
{
|
||||
if( status_int_string_map[i].status_int == http_status )
|
||||
{
|
||||
return status_int_string_map[i].status_str;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
void Header::prepare_status_value(int http_status, pt::WTextStream & value, bool clear_value)
|
||||
{
|
||||
if( clear_value )
|
||||
value.clear();
|
||||
|
||||
value << http_status;
|
||||
const wchar_t * value_str = find_status_string_value(http_status);
|
||||
|
||||
if( value_str )
|
||||
{
|
||||
value << ' ' << value_str;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#define headerfile_winix_core_header
|
||||
|
||||
#include "log.h"
|
||||
#include <textstream/textstream.h>
|
||||
|
||||
|
||||
namespace Winix
|
||||
@@ -83,9 +84,63 @@ public:
|
||||
static constexpr const wchar_t * text_javascript_utf8 = L"text/javascript; charset=UTF-8";
|
||||
|
||||
|
||||
static const int status_200_ok = 200;
|
||||
static const int status_300_multiple_choices = 300;
|
||||
static const int status_301_moved_permanently = 301;
|
||||
static const int status_302_found = 302;
|
||||
static const int status_303_see_other = 303;
|
||||
static const int status_307_temporary_redirect = 307;
|
||||
static const int status_400_bad_request = 400;
|
||||
static const int status_403_forbidden = 403;
|
||||
static const int status_404_not_found = 404;
|
||||
static const int status_414_uri_too_long = 414;
|
||||
static const int status_500_internal_server_error = 500;
|
||||
|
||||
|
||||
static constexpr const wchar_t * str_status_200 = L"OK";
|
||||
static constexpr const wchar_t * str_status_300 = L"Multiple Choices";
|
||||
static constexpr const wchar_t * str_status_301 = L"Moved Permanently";
|
||||
static constexpr const wchar_t * str_status_302 = L"Found";
|
||||
static constexpr const wchar_t * str_status_303 = L"See Other";
|
||||
static constexpr const wchar_t * str_status_307 = L"Temporary Redirect";
|
||||
static constexpr const wchar_t * str_status_400 = L"Bad Request";
|
||||
static constexpr const wchar_t * str_status_403 = L"Forbidden";
|
||||
static constexpr const wchar_t * str_status_404 = L"Not Found";
|
||||
static constexpr const wchar_t * str_status_414 = L"URI Too Long";
|
||||
static constexpr const wchar_t * str_status_500 = L"Internal Server Error";
|
||||
|
||||
|
||||
static const wchar_t * find_status_string_value(int http_status);
|
||||
static void prepare_status_value(int http_status, pt::WTextStream & value, bool clear_value = true);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
struct StatusIntStringMapHelper
|
||||
{
|
||||
int status_int;
|
||||
const wchar_t * status_str;
|
||||
};
|
||||
|
||||
static constexpr StatusIntStringMapHelper status_int_string_map[] = {
|
||||
{status_200_ok, str_status_200},
|
||||
{status_300_multiple_choices, str_status_300},
|
||||
{status_301_moved_permanently, str_status_301},
|
||||
{status_302_found, str_status_302},
|
||||
{status_303_see_other, str_status_303},
|
||||
{status_307_temporary_redirect, str_status_307},
|
||||
{status_400_bad_request, str_status_400},
|
||||
{status_403_forbidden, str_status_403},
|
||||
{status_404_not_found, str_status_404},
|
||||
{status_414_uri_too_long, str_status_414},
|
||||
{status_500_internal_server_error, str_status_500},
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
class HeaderValue
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -395,17 +395,10 @@ void PostMultiParser::ConvStr(const std::string & src, std::wstring & dst)
|
||||
|
||||
void PostMultiParser::AddNormalPostVar()
|
||||
{
|
||||
if( post_tab->size() >= WINIX_POSTTABLE_MAXSIZE )
|
||||
{
|
||||
err = WINIX_ERR_INPUT_TOO_LARGE;
|
||||
log << log1 << "PMP: more than " << WINIX_POSTTABLE_MAXSIZE << " post variables (skipping)" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
ConvStr(name, namew);
|
||||
ConvStr(content, contentw);
|
||||
|
||||
bool added = InsertPostVar(*post_tab, namew, contentw);
|
||||
bool added = request->AddPostVar(namew, contentw);
|
||||
|
||||
log << log2 << "PMP: POST var, name: \"" << namew << "\"";
|
||||
|
||||
@@ -418,7 +411,7 @@ void PostMultiParser::AddNormalPostVar()
|
||||
|
||||
void PostMultiParser::AddFilePostVar()
|
||||
{
|
||||
if( post_file_tab->size() >= WINIX_POSTTABLE_MAXSIZE )
|
||||
if( request->post_file_tab.size() >= WINIX_POSTTABLE_MAXSIZE )
|
||||
{
|
||||
err = WINIX_ERR_INPUT_TOO_LARGE;
|
||||
log << log1 << "PMP: more than " << WINIX_POSTTABLE_MAXSIZE << " post file variables (skipping)" << logend;
|
||||
@@ -430,7 +423,7 @@ void PostMultiParser::AddFilePostVar()
|
||||
post_file_temp.tmp_filename = tmp_filename;
|
||||
post_file_temp.file_size = content_len;
|
||||
|
||||
bool added = InsertPostVar(*post_file_tab, namew, post_file_temp);
|
||||
bool added = InsertPostVar(request->post_file_tab, namew, post_file_temp);
|
||||
|
||||
log << log2 << "PMP: POST FILE var, name: \"" << namew << "\"";
|
||||
|
||||
@@ -581,7 +574,7 @@ void PostMultiParser::ReadChar()
|
||||
|
||||
|
||||
|
||||
Error PostMultiParser::Parse(FCGX_Stream * in_, PostTab & post_tab_, PostFileTab & post_file_tab_)
|
||||
Error PostMultiParser::Parse(FCGX_Stream * in_, Request & request)
|
||||
{
|
||||
in = in_;
|
||||
last = 0;
|
||||
@@ -590,8 +583,7 @@ Error PostMultiParser::Parse(FCGX_Stream * in_, PostTab & post_tab_, PostFileTab
|
||||
line_end_dos = false;
|
||||
in_buffer_ind = WINIX_POSTMULTI_INPUT_BUFFER;
|
||||
in_buffer_len = WINIX_POSTMULTI_INPUT_BUFFER;
|
||||
post_tab = &post_tab_;
|
||||
post_file_tab = &post_file_tab_;
|
||||
this->request = &request;
|
||||
tmp_filename_postfix = 1;
|
||||
|
||||
ReadChar();
|
||||
@@ -605,9 +597,8 @@ Error PostMultiParser::Parse(FCGX_Stream * in_, PostTab & post_tab_, PostFileTab
|
||||
|
||||
if( err != WINIX_ERR_OK )
|
||||
{
|
||||
RemovePostFileTmp(*post_file_tab);
|
||||
post_tab->clear();
|
||||
post_file_tab->clear();
|
||||
RemovePostFileTmp(request.post_file_tab);
|
||||
request.post_in.clear();
|
||||
|
||||
if( err != WINIX_ERR_INPUT_TOO_LARGE && err != WINIX_ERR_CANT_CREATE_FILE )
|
||||
log << log1 << "PMP: syntax error" << logend;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008-2018, Tomasz Sowa
|
||||
* Copyright (c) 2008-2022, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -39,7 +39,7 @@
|
||||
#include <fcgiapp.h>
|
||||
#include <fstream>
|
||||
#include "error.h"
|
||||
#include "requesttypes.h"
|
||||
#include "request.h"
|
||||
#include "config.h"
|
||||
#include "misc.h"
|
||||
#include "winixbase.h"
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
~PostMultiParser();
|
||||
|
||||
void SetConfig(Config * pconfig);
|
||||
Error Parse(FCGX_Stream * in_, PostTab & post_tab_, PostFileTab & post_file_tab_);
|
||||
Error Parse(FCGX_Stream * in_, Request & request);
|
||||
|
||||
private:
|
||||
|
||||
@@ -81,8 +81,7 @@ private:
|
||||
size_t in_buffer_ind;
|
||||
size_t in_buffer_len;
|
||||
|
||||
PostTab * post_tab;
|
||||
PostFileTab * post_file_tab;
|
||||
Request * request;
|
||||
|
||||
int last; // last read character
|
||||
int var_index; // used as a postfix to the same name (is auto increment)
|
||||
@@ -148,7 +147,7 @@ std::pair<typename Container::iterator, bool> res;
|
||||
if( !added )
|
||||
{
|
||||
key += L"_inc";
|
||||
key += Toa(var_index);
|
||||
pt::Toa(var_index, key, false, 10, 5);
|
||||
res = container.insert( std::make_pair(key, value) );
|
||||
added = res.second;
|
||||
var_index += 1;
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <fcgiapp.h>
|
||||
#include <string>
|
||||
#include "httpsimpleparser.h"
|
||||
#include "requesttypes.h"
|
||||
#include "request.h"
|
||||
#include "misc.h"
|
||||
#include "utf8/utf8.h"
|
||||
#include "convert/text.h"
|
||||
@@ -52,7 +52,7 @@ namespace Winix
|
||||
class PostParser : public HttpSimpleParser
|
||||
{
|
||||
FCGX_Stream * in;
|
||||
PostTab * post_tab;
|
||||
Request * request;
|
||||
size_t log_value_size;
|
||||
int var_index;
|
||||
bool has_winix_post_params_msg;
|
||||
@@ -99,24 +99,10 @@ protected:
|
||||
|
||||
virtual void Parameter(std::wstring & name, std::wstring & value)
|
||||
{
|
||||
bool added;
|
||||
std::pair<PostTab::iterator, bool> res;
|
||||
|
||||
if( has_winix_post_params_msg )
|
||||
plugin->Call(0, WINIX_POST_PARAMS, &name, &value);
|
||||
|
||||
res = post_tab->insert( std::make_pair(name, value) );
|
||||
added = res.second;
|
||||
|
||||
if( !added )
|
||||
{
|
||||
name += L"_inc";
|
||||
pt::Toa(var_index, name, false, 10, 5);
|
||||
res = post_tab->insert( std::make_pair(name, value) );
|
||||
added = res.second;
|
||||
var_index += 1;
|
||||
}
|
||||
|
||||
bool added = request->AddPostVar(name, value);
|
||||
CreateLog(added, name, value);
|
||||
}
|
||||
|
||||
@@ -134,10 +120,10 @@ public:
|
||||
log_value_size = s;
|
||||
}
|
||||
|
||||
void Parse(FCGX_Stream * in_, PostTab & post_tab_)
|
||||
void Parse(FCGX_Stream * in, Request & request)
|
||||
{
|
||||
in = in_;
|
||||
post_tab = &post_tab_;
|
||||
this->in = in;
|
||||
this->request = &request;
|
||||
var_index = 1;
|
||||
raw_post.clear();
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "plugin.h"
|
||||
#include "misc.h"
|
||||
#include "functions/functionbase.h"
|
||||
#include "templates/templates.h"
|
||||
|
||||
|
||||
namespace Winix
|
||||
@@ -57,8 +58,12 @@ void Request::fields()
|
||||
{
|
||||
field(L"", L"dirs", dir_tab);
|
||||
field(L"", L"is_item", is_item);
|
||||
field(L"", L"http_status", http_status);
|
||||
|
||||
field(L"", L"current_dir", &Request::current_dir);
|
||||
field(L"", L"last_item", &Request::last_item_wrapper);
|
||||
field(L"", L"http_status_error_title", &Request::http_status_error_title);
|
||||
field(L"", L"http_status_error_description", &Request::http_status_error_description);
|
||||
}
|
||||
|
||||
|
||||
@@ -101,11 +106,9 @@ void Request::Clear()
|
||||
if( function )
|
||||
function->Clear();
|
||||
|
||||
post_tab.clear();
|
||||
post_file_tab.clear();
|
||||
cookie_tab.clear();
|
||||
post_in.clear();
|
||||
is_postin_used = false;
|
||||
|
||||
method = unknown_method;
|
||||
|
||||
@@ -148,6 +151,7 @@ void Request::Clear()
|
||||
container_type = ContainerType::container_raw;
|
||||
|
||||
status = WINIX_ERR_OK;
|
||||
http_status = Header::status_200_ok;
|
||||
|
||||
browser_msie = false;
|
||||
redirect_to.clear();
|
||||
@@ -360,122 +364,130 @@ void Request::PrepareFrameNames()
|
||||
}
|
||||
}
|
||||
|
||||
// add such a method to Space
|
||||
bool Request::AddPostVar(const wchar_t * name, const wchar_t * value)
|
||||
{
|
||||
bool status = false;
|
||||
pt::Space * space_value = post_in.get_space(name);
|
||||
Log * log = get_logger();
|
||||
|
||||
if( space_value )
|
||||
{
|
||||
if( space_value->is_table() )
|
||||
{
|
||||
if( space_value->table_size() < WINIX_POSTTABLE_VALUT_TABLE_MAXSIZE )
|
||||
{
|
||||
status = true;
|
||||
space_value->add(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
if( log )
|
||||
{
|
||||
(*log) << log1 << "App: more than " << WINIX_POSTTABLE_VALUT_TABLE_MAXSIZE << " post variables in a table " << name << " (skipping)" << logend;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = true;
|
||||
pt::Space new_table;
|
||||
new_table.add(std::move(*space_value));
|
||||
new_table.add(value);
|
||||
space_value->set(std::move(new_table));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( post_in.object_size() < WINIX_POSTTABLE_MAXSIZE )
|
||||
{
|
||||
post_in.add(name, value);
|
||||
status = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( log )
|
||||
{
|
||||
(*log) << log1 << "App: more than " << WINIX_POSTTABLE_MAXSIZE << " post variables (skipping)" << logend;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
bool Request::AddPostVar(const std::wstring & name, const std::wstring & value)
|
||||
{
|
||||
return AddPostVar(name.c_str(), value.c_str());
|
||||
}
|
||||
|
||||
|
||||
bool Request::IsPostVar(const wchar_t * var)
|
||||
{
|
||||
PostTab::iterator p;
|
||||
|
||||
p = post_tab.find(var);
|
||||
|
||||
if( p == post_tab.end() )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return post_in.has_key(var);
|
||||
}
|
||||
|
||||
|
||||
bool Request::IsPostVar(const std::wstring & var)
|
||||
{
|
||||
PostTab::iterator p;
|
||||
|
||||
p = post_tab.find(var);
|
||||
|
||||
if( p == post_tab.end() )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return post_in.has_key(var);
|
||||
}
|
||||
|
||||
|
||||
const std::wstring & Request::PostVar(const wchar_t * var)
|
||||
{
|
||||
PostTab::iterator p = post_tab.find(var);
|
||||
|
||||
if( p == post_tab.end() )
|
||||
return str_empty;
|
||||
|
||||
return p->second;
|
||||
std::wstring * value = post_in.get_wstr(var);
|
||||
|
||||
if( value )
|
||||
return *value;
|
||||
|
||||
return str_empty;
|
||||
}
|
||||
|
||||
|
||||
const std::wstring & Request::PostVar(const std::wstring & var)
|
||||
{
|
||||
PostTab::iterator p = post_tab.find(var);
|
||||
|
||||
if( p == post_tab.end() )
|
||||
return str_empty;
|
||||
|
||||
return p->second;
|
||||
return PostVar(var.c_str());
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Request::PostVar(const wchar_t * var, std::wstring & result)
|
||||
{
|
||||
PostTab::iterator p = post_tab.find(var);
|
||||
|
||||
if( p == post_tab.end() )
|
||||
std::wstring * value = post_in.get_wstr(var);
|
||||
bool found = false;
|
||||
|
||||
if( value )
|
||||
{
|
||||
result = *value;
|
||||
found = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
result = p->second;
|
||||
|
||||
return true;
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
|
||||
bool Request::PostVar(const std::wstring & var, std::wstring & result)
|
||||
{
|
||||
PostTab::iterator p = post_tab.find(var);
|
||||
|
||||
if( p == post_tab.end() )
|
||||
{
|
||||
result.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
result = p->second;
|
||||
|
||||
return true;
|
||||
return PostVar(var.c_str(), result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::wstring * Request::PostVarp(const wchar_t * var)
|
||||
{
|
||||
PostTab::iterator p = post_tab.find(var);
|
||||
|
||||
if( p == post_tab.end() )
|
||||
return 0;
|
||||
|
||||
return &p->second;
|
||||
return post_in.get_wstr(var);
|
||||
}
|
||||
|
||||
|
||||
std::wstring * Request::PostVarp(const std::wstring & var)
|
||||
{
|
||||
PostTab::iterator p = post_tab.find(var);
|
||||
|
||||
if( p == post_tab.end() )
|
||||
return 0;
|
||||
|
||||
return &p->second;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool Request::AllPostVarEmpty()
|
||||
{
|
||||
PostTab::iterator i;
|
||||
|
||||
for(i=post_tab.begin() ; i!=post_tab.end() ; ++i)
|
||||
if( !i->second.empty() )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return post_in.get_wstr(var.c_str());
|
||||
}
|
||||
|
||||
|
||||
@@ -541,6 +553,7 @@ const std::wstring & Request::ParamValue(const std::wstring & param_name)
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Request::AddParam(const std::wstring & param_name, const std::wstring & param_value)
|
||||
{
|
||||
bool found = false;
|
||||
@@ -663,6 +676,24 @@ bool Request::has_frame(const std::wstring & frame)
|
||||
}
|
||||
|
||||
|
||||
void Request::http_status_error_title(EzcEnv & env)
|
||||
{
|
||||
pt::WTextStream str;
|
||||
str << L"http_error_" << http_status << L"_title";
|
||||
|
||||
const std::wstring & msg = TemplatesFunctions::locale.Get(str);
|
||||
env.out << msg;
|
||||
}
|
||||
|
||||
|
||||
void Request::http_status_error_description(EzcEnv & env)
|
||||
{
|
||||
pt::WTextStream str;
|
||||
str << L"http_error_" << http_status << L"_msg";
|
||||
|
||||
const std::wstring & msg = TemplatesFunctions::locale.Get(str);
|
||||
env.out << msg;
|
||||
}
|
||||
|
||||
|
||||
} // namespace Winix
|
||||
|
||||
@@ -161,11 +161,9 @@ public:
|
||||
!! CHECK ME may post_tab and cookie_tab should be changed to pt::Space now?
|
||||
or may change the name to cookie_in? or in_cookie?
|
||||
*/
|
||||
PostTab post_tab;
|
||||
PostFileTab post_file_tab;
|
||||
CookieTab cookie_tab;
|
||||
pt::Space post_in;
|
||||
bool is_postin_used;// temporarily, before all post variables will be put to post_in
|
||||
|
||||
// input headers (without cookies)
|
||||
// at the moment we are using FastCGI and HTTP headers are prefixed with 'HTTP_' string
|
||||
@@ -337,9 +335,15 @@ public:
|
||||
std::vector<HeaderValue> accept_languages;
|
||||
|
||||
// request status
|
||||
// !! CHANGE ME it'll be better to use ordinary http result codes
|
||||
// DEPRECATED, use http_status instead
|
||||
Error status;
|
||||
|
||||
/*
|
||||
* HTTP result status
|
||||
* at the moment default is -1 which means it is not used (use status in such a case)
|
||||
*/
|
||||
int http_status;
|
||||
|
||||
// if not empty means an address for redirecting to
|
||||
// it should be url-encoded
|
||||
std::wstring redirect_to;
|
||||
@@ -443,6 +447,9 @@ public:
|
||||
void RemoveParam(const wchar_t * param_name);
|
||||
void RemoveParam(const std::wstring & param_name);
|
||||
|
||||
bool AddPostVar(const wchar_t * name, const wchar_t * value);
|
||||
bool AddPostVar(const std::wstring & name, const std::wstring & value);
|
||||
|
||||
bool IsPostVar(const wchar_t * var);
|
||||
bool IsPostVar(const std::wstring & var);
|
||||
const std::wstring & PostVar(const wchar_t * var); // returns an empty string if there is no such a parameter
|
||||
@@ -452,8 +459,6 @@ public:
|
||||
std::wstring * PostVarp(const wchar_t * var);
|
||||
std::wstring * PostVarp(const std::wstring & var);
|
||||
|
||||
bool AllPostVarEmpty(); // returning true if all post vars are empty
|
||||
|
||||
|
||||
// setting a cookie
|
||||
// name - cookie name (either const wchar_t, or std::wstring or pt::WTextStream)
|
||||
@@ -485,6 +490,9 @@ private:
|
||||
void current_dir(morm::Wrapper & wrapper);
|
||||
void last_item_wrapper(morm::Wrapper & wrapper);
|
||||
|
||||
void http_status_error_title(EzcEnv & env);
|
||||
void http_status_error_description(EzcEnv & env);
|
||||
|
||||
|
||||
MORM_MEMBER_FIELD(Request)
|
||||
|
||||
|
||||
@@ -45,12 +45,9 @@ namespace Winix
|
||||
{
|
||||
|
||||
|
||||
|
||||
// !! IMPROVE ME
|
||||
// !! narazie uzywane tylko w post multi parserze
|
||||
// dodac do zwyklego parsera post
|
||||
#define WINIX_POSTTABLE_MAXSIZE 50
|
||||
|
||||
// may move to config?
|
||||
#define WINIX_POSTTABLE_MAXSIZE 1024
|
||||
#define WINIX_POSTTABLE_VALUT_TABLE_MAXSIZE 1024
|
||||
|
||||
|
||||
struct PostFile
|
||||
@@ -70,7 +67,6 @@ struct Param
|
||||
|
||||
|
||||
// some global types used by Request class
|
||||
typedef std::map<std::wstring, std::wstring> PostTab;
|
||||
typedef std::map<std::wstring, PostFile> PostFileTab;
|
||||
typedef std::vector<Param> ParamTab;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user