changed the way how the request's answer is created,
now winix can return json, xml, csv from out_main_stream or from frames and json from models removed from Request: bool send_bin_stream bool return_json bool return_info_only pt::Space info bool page_generated bool out_main_stream_use_html_filter bool out_streams_use_html_filter added to Request: enum AnswerSource enum AnswerContainer AnswerSource answer_source AnswerContainer answer_container bool use_ezc_engine std::wstring frame bool send_all_frames bool use_html_filter added to Config: // the name of the url parameter for returning all frames, e.g. https://domain.tld/mydir/myfunction/allframes // default: allframes std::wstring request_all_frames_parameter; // the name of the root element when serializing request answer to xml // default: winix std::wstring xml_root; algorithm (the whole algorithm is described in core/request.h): at the beginning of a request winix sets answer_source to models answer_container to text use_ezc_engine to true next answer_container and use_ezc_engine can be changed in the following way: 1. winix will look for 'Accept' http header and depending on the header winix will set: (not implemented yet) Accept | answer_container | use_ezc_engine ------------------------------------|----------------- application/json | json | false application/xml | xml | false text/csv | csv | false 2. next answer_container is set depending on 'container' url parameter container | answer_container --------------------------------------------------------- not present | don't change the value text | text json | json xml | xml csv | csv use_ezc_engine is set depending on 'answer' url parameter: answer | use_ezc_engine --------------------------------- not present | don't change the value html | true data | false if 'answer' is html then we take into account two more parameters: frame: frame_name (empty default) - if set then winix returns this specific frame allframes: (if present then winix returns all frames)
This commit is contained in:
@@ -10,15 +10,15 @@ acceptbaseparser.o: ../../../pikotools/src/utf8/utf8.h
|
||||
acceptbaseparser.o: ../../../pikotools/src/textstream/stream.h
|
||||
acceptbaseparser.o: ../../../pikotools/src/utf8/utf8_templates.h
|
||||
acceptbaseparser.o: ../../../pikotools/src/utf8/utf8_private.h
|
||||
acceptbaseparser.o: ../../../pikotools/src/convert/baseparser.h log.h
|
||||
acceptbaseparser.o: logmanipulators.h ../../../pikotools/src/log/log.h
|
||||
acceptbaseparser.o: ../../../pikotools/src/convert/baseparser.h
|
||||
acceptbaseparser.o: ../../../pikotools/src/textstream/textstream.h
|
||||
acceptbaseparser.o: ../../../pikotools/src/textstream/stream.h
|
||||
acceptbaseparser.o: ../../../pikotools/src/space/space.h
|
||||
acceptbaseparser.o: ../../../pikotools/src/date/date.h
|
||||
acceptbaseparser.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
acceptbaseparser.o: ../../../pikotools/src/textstream/types.h filelog.h
|
||||
acceptbaseparser.o: ../../../winix/winixd/core/synchro.h
|
||||
acceptbaseparser.o: ../../../pikotools/src/textstream/types.h log.h
|
||||
acceptbaseparser.o: logmanipulators.h ../../../pikotools/src/log/log.h
|
||||
acceptbaseparser.o: filelog.h ../../../winix/winixd/core/synchro.h
|
||||
acceptbaseparser.o: ../../../morm/src/morm.h ../../../morm/src/morm_types.h
|
||||
acceptbaseparser.o: ../../../morm/src/model.h
|
||||
acceptbaseparser.o: ../../../morm/src/modelconnector.h
|
||||
@@ -212,14 +212,14 @@ basethread.o: ../../../pikotools/src/utf8/utf8.h
|
||||
basethread.o: ../../../pikotools/src/textstream/stream.h
|
||||
basethread.o: ../../../pikotools/src/utf8/utf8_templates.h
|
||||
basethread.o: ../../../pikotools/src/utf8/utf8_private.h
|
||||
basethread.o: ../../../pikotools/src/convert/baseparser.h log.h
|
||||
basethread.o: logmanipulators.h ../../../pikotools/src/log/log.h
|
||||
basethread.o: ../../../pikotools/src/convert/baseparser.h
|
||||
basethread.o: ../../../pikotools/src/textstream/textstream.h
|
||||
basethread.o: ../../../pikotools/src/textstream/stream.h
|
||||
basethread.o: ../../../pikotools/src/space/space.h
|
||||
basethread.o: ../../../pikotools/src/date/date.h
|
||||
basethread.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
basethread.o: ../../../pikotools/src/textstream/types.h filelog.h
|
||||
basethread.o: ../../../pikotools/src/textstream/types.h log.h
|
||||
basethread.o: logmanipulators.h ../../../pikotools/src/log/log.h filelog.h
|
||||
basethread.o: ../../../winix/winixd/core/synchro.h ../../../morm/src/morm.h
|
||||
basethread.o: ../../../morm/src/morm_types.h ../../../morm/src/model.h
|
||||
basethread.o: ../../../morm/src/modelconnector.h ../../../morm/src/clearer.h
|
||||
@@ -352,14 +352,14 @@ crypt.o: ../../../pikotools/src/utf8/utf8.h
|
||||
crypt.o: ../../../pikotools/src/textstream/stream.h
|
||||
crypt.o: ../../../pikotools/src/utf8/utf8_templates.h
|
||||
crypt.o: ../../../pikotools/src/utf8/utf8_private.h
|
||||
crypt.o: ../../../pikotools/src/convert/baseparser.h log.h logmanipulators.h
|
||||
crypt.o: ../../../pikotools/src/log/log.h
|
||||
crypt.o: ../../../pikotools/src/convert/baseparser.h
|
||||
crypt.o: ../../../pikotools/src/textstream/textstream.h
|
||||
crypt.o: ../../../pikotools/src/textstream/stream.h
|
||||
crypt.o: ../../../pikotools/src/space/space.h
|
||||
crypt.o: ../../../pikotools/src/date/date.h
|
||||
crypt.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
crypt.o: ../../../pikotools/src/textstream/types.h filelog.h
|
||||
crypt.o: ../../../pikotools/src/textstream/types.h log.h logmanipulators.h
|
||||
crypt.o: ../../../pikotools/src/log/log.h filelog.h
|
||||
crypt.o: ../../../winix/winixd/core/synchro.h ../../../morm/src/morm.h
|
||||
crypt.o: ../../../morm/src/morm_types.h ../../../morm/src/model.h
|
||||
crypt.o: ../../../morm/src/modelconnector.h ../../../morm/src/clearer.h
|
||||
@@ -412,14 +412,14 @@ dircontainer.o: ../../../pikotools/src/utf8/utf8.h
|
||||
dircontainer.o: ../../../pikotools/src/textstream/stream.h
|
||||
dircontainer.o: ../../../pikotools/src/utf8/utf8_templates.h
|
||||
dircontainer.o: ../../../pikotools/src/utf8/utf8_private.h
|
||||
dircontainer.o: ../../../pikotools/src/convert/baseparser.h log.h
|
||||
dircontainer.o: logmanipulators.h ../../../pikotools/src/log/log.h
|
||||
dircontainer.o: ../../../pikotools/src/convert/baseparser.h
|
||||
dircontainer.o: ../../../pikotools/src/textstream/textstream.h
|
||||
dircontainer.o: ../../../pikotools/src/textstream/stream.h
|
||||
dircontainer.o: ../../../pikotools/src/space/space.h
|
||||
dircontainer.o: ../../../pikotools/src/date/date.h
|
||||
dircontainer.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
dircontainer.o: ../../../pikotools/src/textstream/types.h filelog.h
|
||||
dircontainer.o: ../../../pikotools/src/textstream/types.h log.h
|
||||
dircontainer.o: logmanipulators.h ../../../pikotools/src/log/log.h filelog.h
|
||||
dircontainer.o: ../../../winix/winixd/core/synchro.h ../../../morm/src/morm.h
|
||||
dircontainer.o: ../../../morm/src/morm_types.h ../../../morm/src/model.h
|
||||
dircontainer.o: ../../../morm/src/modelconnector.h
|
||||
@@ -477,14 +477,14 @@ dirs.o: ../../../pikotools/src/utf8/utf8.h
|
||||
dirs.o: ../../../pikotools/src/textstream/stream.h
|
||||
dirs.o: ../../../pikotools/src/utf8/utf8_templates.h
|
||||
dirs.o: ../../../pikotools/src/utf8/utf8_private.h
|
||||
dirs.o: ../../../pikotools/src/convert/baseparser.h log.h logmanipulators.h
|
||||
dirs.o: ../../../pikotools/src/log/log.h
|
||||
dirs.o: ../../../pikotools/src/convert/baseparser.h
|
||||
dirs.o: ../../../pikotools/src/textstream/textstream.h
|
||||
dirs.o: ../../../pikotools/src/textstream/stream.h
|
||||
dirs.o: ../../../pikotools/src/space/space.h
|
||||
dirs.o: ../../../pikotools/src/date/date.h
|
||||
dirs.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
dirs.o: ../../../pikotools/src/textstream/types.h filelog.h
|
||||
dirs.o: ../../../pikotools/src/textstream/types.h log.h logmanipulators.h
|
||||
dirs.o: ../../../pikotools/src/log/log.h filelog.h
|
||||
dirs.o: ../../../winix/winixd/core/synchro.h ../../../morm/src/morm.h
|
||||
dirs.o: ../../../morm/src/morm_types.h ../../../morm/src/model.h
|
||||
dirs.o: ../../../morm/src/modelconnector.h ../../../morm/src/clearer.h
|
||||
@@ -667,15 +667,15 @@ httpsimpleparser.o: ../../../pikotools/src/utf8/utf8.h
|
||||
httpsimpleparser.o: ../../../pikotools/src/textstream/stream.h
|
||||
httpsimpleparser.o: ../../../pikotools/src/utf8/utf8_templates.h
|
||||
httpsimpleparser.o: ../../../pikotools/src/utf8/utf8_private.h
|
||||
httpsimpleparser.o: ../../../pikotools/src/convert/baseparser.h log.h
|
||||
httpsimpleparser.o: logmanipulators.h ../../../pikotools/src/log/log.h
|
||||
httpsimpleparser.o: ../../../pikotools/src/convert/baseparser.h
|
||||
httpsimpleparser.o: ../../../pikotools/src/textstream/textstream.h
|
||||
httpsimpleparser.o: ../../../pikotools/src/textstream/stream.h
|
||||
httpsimpleparser.o: ../../../pikotools/src/space/space.h
|
||||
httpsimpleparser.o: ../../../pikotools/src/date/date.h
|
||||
httpsimpleparser.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
httpsimpleparser.o: ../../../pikotools/src/textstream/types.h filelog.h
|
||||
httpsimpleparser.o: ../../../winix/winixd/core/synchro.h
|
||||
httpsimpleparser.o: ../../../pikotools/src/textstream/types.h log.h
|
||||
httpsimpleparser.o: logmanipulators.h ../../../pikotools/src/log/log.h
|
||||
httpsimpleparser.o: filelog.h ../../../winix/winixd/core/synchro.h
|
||||
httpsimpleparser.o: ../../../morm/src/morm.h ../../../morm/src/morm_types.h
|
||||
httpsimpleparser.o: ../../../morm/src/model.h
|
||||
httpsimpleparser.o: ../../../morm/src/modelconnector.h
|
||||
@@ -723,14 +723,14 @@ image.o: ../../../pikotools/src/utf8/utf8.h
|
||||
image.o: ../../../pikotools/src/textstream/stream.h
|
||||
image.o: ../../../pikotools/src/utf8/utf8_templates.h
|
||||
image.o: ../../../pikotools/src/utf8/utf8_private.h
|
||||
image.o: ../../../pikotools/src/convert/baseparser.h log.h logmanipulators.h
|
||||
image.o: ../../../pikotools/src/log/log.h
|
||||
image.o: ../../../pikotools/src/convert/baseparser.h
|
||||
image.o: ../../../pikotools/src/textstream/textstream.h
|
||||
image.o: ../../../pikotools/src/textstream/stream.h
|
||||
image.o: ../../../pikotools/src/space/space.h
|
||||
image.o: ../../../pikotools/src/date/date.h
|
||||
image.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
image.o: ../../../pikotools/src/textstream/types.h filelog.h
|
||||
image.o: ../../../pikotools/src/textstream/types.h log.h logmanipulators.h
|
||||
image.o: ../../../pikotools/src/log/log.h filelog.h
|
||||
image.o: ../../../winix/winixd/core/synchro.h ../../../morm/src/morm.h
|
||||
image.o: ../../../morm/src/morm_types.h ../../../morm/src/model.h
|
||||
image.o: ../../../morm/src/modelconnector.h ../../../morm/src/clearer.h
|
||||
@@ -810,15 +810,15 @@ ipbancontainer.o: ../../../pikotools/src/utf8/utf8.h
|
||||
ipbancontainer.o: ../../../pikotools/src/textstream/stream.h
|
||||
ipbancontainer.o: ../../../pikotools/src/utf8/utf8_templates.h
|
||||
ipbancontainer.o: ../../../pikotools/src/utf8/utf8_private.h
|
||||
ipbancontainer.o: ../../../pikotools/src/convert/baseparser.h log.h
|
||||
ipbancontainer.o: logmanipulators.h ../../../pikotools/src/log/log.h
|
||||
ipbancontainer.o: ../../../pikotools/src/convert/baseparser.h
|
||||
ipbancontainer.o: ../../../pikotools/src/textstream/textstream.h
|
||||
ipbancontainer.o: ../../../pikotools/src/textstream/stream.h
|
||||
ipbancontainer.o: ../../../pikotools/src/space/space.h
|
||||
ipbancontainer.o: ../../../pikotools/src/date/date.h
|
||||
ipbancontainer.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
ipbancontainer.o: ../../../pikotools/src/textstream/types.h filelog.h
|
||||
ipbancontainer.o: ../../../winix/winixd/core/synchro.h
|
||||
ipbancontainer.o: ../../../pikotools/src/textstream/types.h log.h
|
||||
ipbancontainer.o: logmanipulators.h ../../../pikotools/src/log/log.h
|
||||
ipbancontainer.o: filelog.h ../../../winix/winixd/core/synchro.h
|
||||
ipbancontainer.o: ../../../morm/src/morm.h ../../../morm/src/morm_types.h
|
||||
ipbancontainer.o: ../../../morm/src/model.h
|
||||
ipbancontainer.o: ../../../morm/src/modelconnector.h
|
||||
@@ -857,14 +857,14 @@ job.o: ../../../pikotools/src/utf8/utf8.h
|
||||
job.o: ../../../pikotools/src/textstream/stream.h
|
||||
job.o: ../../../pikotools/src/utf8/utf8_templates.h
|
||||
job.o: ../../../pikotools/src/utf8/utf8_private.h
|
||||
job.o: ../../../pikotools/src/convert/baseparser.h log.h logmanipulators.h
|
||||
job.o: ../../../pikotools/src/log/log.h
|
||||
job.o: ../../../pikotools/src/convert/baseparser.h
|
||||
job.o: ../../../pikotools/src/textstream/textstream.h
|
||||
job.o: ../../../pikotools/src/textstream/stream.h
|
||||
job.o: ../../../pikotools/src/space/space.h
|
||||
job.o: ../../../pikotools/src/date/date.h
|
||||
job.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
job.o: ../../../pikotools/src/textstream/types.h filelog.h
|
||||
job.o: ../../../pikotools/src/textstream/types.h log.h logmanipulators.h
|
||||
job.o: ../../../pikotools/src/log/log.h filelog.h
|
||||
job.o: ../../../winix/winixd/core/synchro.h ../../../morm/src/morm.h
|
||||
job.o: ../../../morm/src/morm_types.h ../../../morm/src/model.h
|
||||
job.o: ../../../morm/src/modelconnector.h ../../../morm/src/clearer.h
|
||||
@@ -895,13 +895,13 @@ lastcontainer.o: ../../../pikotools/src/utf8/utf8.h
|
||||
lastcontainer.o: ../../../pikotools/src/textstream/stream.h
|
||||
lastcontainer.o: ../../../pikotools/src/utf8/utf8_templates.h
|
||||
lastcontainer.o: ../../../pikotools/src/utf8/utf8_private.h
|
||||
lastcontainer.o: ../../../pikotools/src/convert/baseparser.h log.h
|
||||
lastcontainer.o: logmanipulators.h ../../../pikotools/src/log/log.h
|
||||
lastcontainer.o: ../../../pikotools/src/convert/baseparser.h
|
||||
lastcontainer.o: ../../../pikotools/src/textstream/textstream.h
|
||||
lastcontainer.o: ../../../pikotools/src/textstream/stream.h
|
||||
lastcontainer.o: ../../../pikotools/src/space/space.h
|
||||
lastcontainer.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
lastcontainer.o: ../../../pikotools/src/textstream/types.h filelog.h
|
||||
lastcontainer.o: ../../../pikotools/src/textstream/types.h log.h
|
||||
lastcontainer.o: logmanipulators.h ../../../pikotools/src/log/log.h filelog.h
|
||||
lastcontainer.o: ../../../winix/winixd/core/synchro.h
|
||||
lastcontainer.o: ../../../morm/src/morm.h ../../../morm/src/morm_types.h
|
||||
lastcontainer.o: ../../../morm/src/model.h ../../../morm/src/modelconnector.h
|
||||
@@ -943,14 +943,14 @@ loadavg.o: ../../../pikotools/src/utf8/utf8.h
|
||||
loadavg.o: ../../../pikotools/src/textstream/stream.h
|
||||
loadavg.o: ../../../pikotools/src/utf8/utf8_templates.h
|
||||
loadavg.o: ../../../pikotools/src/utf8/utf8_private.h
|
||||
loadavg.o: ../../../pikotools/src/convert/baseparser.h log.h
|
||||
loadavg.o: logmanipulators.h ../../../pikotools/src/log/log.h
|
||||
loadavg.o: ../../../pikotools/src/convert/baseparser.h
|
||||
loadavg.o: ../../../pikotools/src/textstream/textstream.h
|
||||
loadavg.o: ../../../pikotools/src/textstream/stream.h
|
||||
loadavg.o: ../../../pikotools/src/space/space.h
|
||||
loadavg.o: ../../../pikotools/src/date/date.h
|
||||
loadavg.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
loadavg.o: ../../../pikotools/src/textstream/types.h filelog.h
|
||||
loadavg.o: ../../../pikotools/src/textstream/types.h log.h logmanipulators.h
|
||||
loadavg.o: ../../../pikotools/src/log/log.h filelog.h
|
||||
loadavg.o: ../../../winix/winixd/core/synchro.h ../../../morm/src/morm.h
|
||||
loadavg.o: ../../../morm/src/morm_types.h ../../../morm/src/model.h
|
||||
loadavg.o: ../../../morm/src/modelconnector.h ../../../morm/src/clearer.h
|
||||
@@ -1138,14 +1138,14 @@ mountparser.o: ../../../pikotools/src/utf8/utf8.h
|
||||
mountparser.o: ../../../pikotools/src/textstream/stream.h
|
||||
mountparser.o: ../../../pikotools/src/utf8/utf8_templates.h
|
||||
mountparser.o: ../../../pikotools/src/utf8/utf8_private.h
|
||||
mountparser.o: ../../../pikotools/src/convert/baseparser.h log.h
|
||||
mountparser.o: logmanipulators.h ../../../pikotools/src/log/log.h
|
||||
mountparser.o: ../../../pikotools/src/convert/baseparser.h
|
||||
mountparser.o: ../../../pikotools/src/textstream/textstream.h
|
||||
mountparser.o: ../../../pikotools/src/textstream/stream.h
|
||||
mountparser.o: ../../../pikotools/src/space/space.h
|
||||
mountparser.o: ../../../pikotools/src/date/date.h
|
||||
mountparser.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
mountparser.o: ../../../pikotools/src/textstream/types.h filelog.h
|
||||
mountparser.o: ../../../pikotools/src/textstream/types.h log.h
|
||||
mountparser.o: logmanipulators.h ../../../pikotools/src/log/log.h filelog.h
|
||||
mountparser.o: ../../../winix/winixd/core/synchro.h ../../../morm/src/morm.h
|
||||
mountparser.o: ../../../morm/src/morm_types.h ../../../morm/src/model.h
|
||||
mountparser.o: ../../../morm/src/modelconnector.h ../../../morm/src/clearer.h
|
||||
@@ -1217,14 +1217,14 @@ mounts.o: ../../../pikotools/src/utf8/utf8.h
|
||||
mounts.o: ../../../pikotools/src/textstream/stream.h
|
||||
mounts.o: ../../../pikotools/src/utf8/utf8_templates.h
|
||||
mounts.o: ../../../pikotools/src/utf8/utf8_private.h
|
||||
mounts.o: ../../../pikotools/src/convert/baseparser.h log.h logmanipulators.h
|
||||
mounts.o: ../../../pikotools/src/log/log.h
|
||||
mounts.o: ../../../pikotools/src/convert/baseparser.h
|
||||
mounts.o: ../../../pikotools/src/textstream/textstream.h
|
||||
mounts.o: ../../../pikotools/src/textstream/stream.h
|
||||
mounts.o: ../../../pikotools/src/space/space.h
|
||||
mounts.o: ../../../pikotools/src/date/date.h
|
||||
mounts.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
mounts.o: ../../../pikotools/src/textstream/types.h filelog.h
|
||||
mounts.o: ../../../pikotools/src/textstream/types.h log.h logmanipulators.h
|
||||
mounts.o: ../../../pikotools/src/log/log.h filelog.h
|
||||
mounts.o: ../../../winix/winixd/core/synchro.h ../../../morm/src/morm.h
|
||||
mounts.o: ../../../morm/src/morm_types.h ../../../morm/src/model.h
|
||||
mounts.o: ../../../morm/src/modelconnector.h ../../../morm/src/clearer.h
|
||||
@@ -1291,14 +1291,14 @@ plugin.o: ../../../pikotools/src/utf8/utf8.h
|
||||
plugin.o: ../../../pikotools/src/textstream/stream.h
|
||||
plugin.o: ../../../pikotools/src/utf8/utf8_templates.h
|
||||
plugin.o: ../../../pikotools/src/utf8/utf8_private.h
|
||||
plugin.o: ../../../pikotools/src/convert/baseparser.h log.h logmanipulators.h
|
||||
plugin.o: ../../../pikotools/src/log/log.h
|
||||
plugin.o: ../../../pikotools/src/convert/baseparser.h
|
||||
plugin.o: ../../../pikotools/src/textstream/textstream.h
|
||||
plugin.o: ../../../pikotools/src/textstream/stream.h
|
||||
plugin.o: ../../../pikotools/src/space/space.h
|
||||
plugin.o: ../../../pikotools/src/date/date.h
|
||||
plugin.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
plugin.o: ../../../pikotools/src/textstream/types.h filelog.h
|
||||
plugin.o: ../../../pikotools/src/textstream/types.h log.h logmanipulators.h
|
||||
plugin.o: ../../../pikotools/src/log/log.h filelog.h
|
||||
plugin.o: ../../../winix/winixd/core/synchro.h ../../../morm/src/morm.h
|
||||
plugin.o: ../../../morm/src/morm_types.h ../../../morm/src/model.h
|
||||
plugin.o: ../../../morm/src/modelconnector.h ../../../morm/src/clearer.h
|
||||
@@ -1439,14 +1439,14 @@ plugindata.o: ../../../pikotools/src/utf8/utf8.h
|
||||
plugindata.o: ../../../pikotools/src/textstream/stream.h
|
||||
plugindata.o: ../../../pikotools/src/utf8/utf8_templates.h
|
||||
plugindata.o: ../../../pikotools/src/utf8/utf8_private.h
|
||||
plugindata.o: ../../../pikotools/src/convert/baseparser.h log.h
|
||||
plugindata.o: logmanipulators.h ../../../pikotools/src/log/log.h
|
||||
plugindata.o: ../../../pikotools/src/convert/baseparser.h
|
||||
plugindata.o: ../../../pikotools/src/textstream/textstream.h
|
||||
plugindata.o: ../../../pikotools/src/textstream/stream.h
|
||||
plugindata.o: ../../../pikotools/src/space/space.h
|
||||
plugindata.o: ../../../pikotools/src/date/date.h
|
||||
plugindata.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
plugindata.o: ../../../pikotools/src/textstream/types.h filelog.h
|
||||
plugindata.o: ../../../pikotools/src/textstream/types.h log.h
|
||||
plugindata.o: logmanipulators.h ../../../pikotools/src/log/log.h filelog.h
|
||||
plugindata.o: ../../../winix/winixd/core/synchro.h ../../../morm/src/morm.h
|
||||
plugindata.o: ../../../morm/src/morm_types.h ../../../morm/src/model.h
|
||||
plugindata.o: ../../../morm/src/modelconnector.h ../../../morm/src/clearer.h
|
||||
@@ -1688,14 +1688,14 @@ run.o: ../../../pikotools/src/utf8/utf8.h
|
||||
run.o: ../../../pikotools/src/textstream/stream.h
|
||||
run.o: ../../../pikotools/src/utf8/utf8_templates.h
|
||||
run.o: ../../../pikotools/src/utf8/utf8_private.h
|
||||
run.o: ../../../pikotools/src/convert/baseparser.h log.h logmanipulators.h
|
||||
run.o: ../../../pikotools/src/log/log.h
|
||||
run.o: ../../../pikotools/src/convert/baseparser.h
|
||||
run.o: ../../../pikotools/src/textstream/textstream.h
|
||||
run.o: ../../../pikotools/src/textstream/stream.h
|
||||
run.o: ../../../pikotools/src/space/space.h
|
||||
run.o: ../../../pikotools/src/date/date.h
|
||||
run.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
run.o: ../../../pikotools/src/textstream/types.h filelog.h
|
||||
run.o: ../../../pikotools/src/textstream/types.h log.h logmanipulators.h
|
||||
run.o: ../../../pikotools/src/log/log.h filelog.h
|
||||
run.o: ../../../winix/winixd/core/synchro.h ../../../morm/src/morm.h
|
||||
run.o: ../../../morm/src/morm_types.h ../../../morm/src/model.h
|
||||
run.o: ../../../morm/src/modelconnector.h ../../../morm/src/clearer.h
|
||||
@@ -1867,14 +1867,14 @@ sessionidmanager.o: ../../../pikotools/src/utf8/utf8.h
|
||||
sessionidmanager.o: ../../../pikotools/src/textstream/stream.h
|
||||
sessionidmanager.o: ../../../pikotools/src/utf8/utf8_templates.h
|
||||
sessionidmanager.o: ../../../pikotools/src/utf8/utf8_private.h
|
||||
sessionidmanager.o: ../../../pikotools/src/convert/baseparser.h log.h
|
||||
sessionidmanager.o: logmanipulators.h ../../../pikotools/src/log/log.h
|
||||
sessionidmanager.o: ../../../pikotools/src/convert/baseparser.h
|
||||
sessionidmanager.o: ../../../pikotools/src/textstream/textstream.h
|
||||
sessionidmanager.o: ../../../pikotools/src/textstream/stream.h
|
||||
sessionidmanager.o: ../../../pikotools/src/date/date.h
|
||||
sessionidmanager.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
sessionidmanager.o: ../../../pikotools/src/textstream/types.h filelog.h
|
||||
sessionidmanager.o: ../../../winix/winixd/core/synchro.h
|
||||
sessionidmanager.o: ../../../pikotools/src/textstream/types.h log.h
|
||||
sessionidmanager.o: logmanipulators.h ../../../pikotools/src/log/log.h
|
||||
sessionidmanager.o: filelog.h ../../../winix/winixd/core/synchro.h
|
||||
sessionidmanager.o: ../../../morm/src/morm.h ../../../morm/src/morm_types.h
|
||||
sessionidmanager.o: ../../../morm/src/model.h
|
||||
sessionidmanager.o: ../../../morm/src/modelconnector.h
|
||||
@@ -2176,14 +2176,14 @@ system.o: ../../../pikotools/src/utf8/utf8.h
|
||||
system.o: ../../../pikotools/src/textstream/stream.h
|
||||
system.o: ../../../pikotools/src/utf8/utf8_templates.h
|
||||
system.o: ../../../pikotools/src/utf8/utf8_private.h
|
||||
system.o: ../../../pikotools/src/convert/baseparser.h log.h logmanipulators.h
|
||||
system.o: ../../../pikotools/src/log/log.h
|
||||
system.o: ../../../pikotools/src/convert/baseparser.h
|
||||
system.o: ../../../pikotools/src/textstream/textstream.h
|
||||
system.o: ../../../pikotools/src/textstream/stream.h
|
||||
system.o: ../../../pikotools/src/space/space.h
|
||||
system.o: ../../../pikotools/src/date/date.h
|
||||
system.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
system.o: ../../../pikotools/src/textstream/types.h filelog.h
|
||||
system.o: ../../../pikotools/src/textstream/types.h log.h logmanipulators.h
|
||||
system.o: ../../../pikotools/src/log/log.h filelog.h
|
||||
system.o: ../../../winix/winixd/core/synchro.h ../../../morm/src/morm.h
|
||||
system.o: ../../../morm/src/morm_types.h ../../../morm/src/model.h
|
||||
system.o: ../../../morm/src/modelconnector.h ../../../morm/src/clearer.h
|
||||
@@ -2322,14 +2322,14 @@ threadmanager.o: ../../../pikotools/src/utf8/utf8.h
|
||||
threadmanager.o: ../../../pikotools/src/textstream/stream.h
|
||||
threadmanager.o: ../../../pikotools/src/utf8/utf8_templates.h
|
||||
threadmanager.o: ../../../pikotools/src/utf8/utf8_private.h
|
||||
threadmanager.o: ../../../pikotools/src/convert/baseparser.h log.h
|
||||
threadmanager.o: logmanipulators.h ../../../pikotools/src/log/log.h
|
||||
threadmanager.o: ../../../pikotools/src/convert/baseparser.h
|
||||
threadmanager.o: ../../../pikotools/src/textstream/textstream.h
|
||||
threadmanager.o: ../../../pikotools/src/textstream/stream.h
|
||||
threadmanager.o: ../../../pikotools/src/space/space.h
|
||||
threadmanager.o: ../../../pikotools/src/date/date.h
|
||||
threadmanager.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
threadmanager.o: ../../../pikotools/src/textstream/types.h filelog.h
|
||||
threadmanager.o: ../../../pikotools/src/textstream/types.h log.h
|
||||
threadmanager.o: logmanipulators.h ../../../pikotools/src/log/log.h filelog.h
|
||||
threadmanager.o: ../../../winix/winixd/core/synchro.h
|
||||
threadmanager.o: ../../../morm/src/morm.h ../../../morm/src/morm_types.h
|
||||
threadmanager.o: ../../../morm/src/model.h ../../../morm/src/modelconnector.h
|
||||
@@ -2384,13 +2384,13 @@ timezones.o: ../../../pikotools/src/utf8/utf8.h
|
||||
timezones.o: ../../../pikotools/src/textstream/stream.h
|
||||
timezones.o: ../../../pikotools/src/utf8/utf8_templates.h
|
||||
timezones.o: ../../../pikotools/src/utf8/utf8_private.h
|
||||
timezones.o: ../../../pikotools/src/convert/baseparser.h winixbase.h
|
||||
timezones.o: ../../../winix/winixd/core/config.h log.h logmanipulators.h
|
||||
timezones.o: ../../../pikotools/src/log/log.h
|
||||
timezones.o: ../../../pikotools/src/convert/baseparser.h
|
||||
timezones.o: ../../../pikotools/src/textstream/textstream.h
|
||||
timezones.o: ../../../pikotools/src/textstream/stream.h
|
||||
timezones.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
timezones.o: ../../../pikotools/src/textstream/types.h filelog.h
|
||||
timezones.o: ../../../pikotools/src/textstream/types.h winixbase.h
|
||||
timezones.o: ../../../winix/winixd/core/config.h log.h logmanipulators.h
|
||||
timezones.o: ../../../pikotools/src/log/log.h filelog.h
|
||||
timezones.o: ../../../winix/winixd/core/synchro.h ../../../morm/src/morm.h
|
||||
timezones.o: ../../../morm/src/morm_types.h ../../../morm/src/model.h
|
||||
timezones.o: ../../../morm/src/modelconnector.h ../../../morm/src/clearer.h
|
||||
@@ -2518,14 +2518,14 @@ winixbase.o: ../../../pikotools/src/utf8/utf8.h
|
||||
winixbase.o: ../../../pikotools/src/textstream/stream.h
|
||||
winixbase.o: ../../../pikotools/src/utf8/utf8_templates.h
|
||||
winixbase.o: ../../../pikotools/src/utf8/utf8_private.h
|
||||
winixbase.o: ../../../pikotools/src/convert/baseparser.h log.h
|
||||
winixbase.o: logmanipulators.h ../../../pikotools/src/log/log.h
|
||||
winixbase.o: ../../../pikotools/src/convert/baseparser.h
|
||||
winixbase.o: ../../../pikotools/src/textstream/textstream.h
|
||||
winixbase.o: ../../../pikotools/src/textstream/stream.h
|
||||
winixbase.o: ../../../pikotools/src/space/space.h
|
||||
winixbase.o: ../../../pikotools/src/date/date.h
|
||||
winixbase.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
winixbase.o: ../../../pikotools/src/textstream/types.h filelog.h
|
||||
winixbase.o: ../../../pikotools/src/textstream/types.h log.h
|
||||
winixbase.o: logmanipulators.h ../../../pikotools/src/log/log.h filelog.h
|
||||
winixbase.o: ../../../winix/winixd/core/synchro.h ../../../morm/src/morm.h
|
||||
winixbase.o: ../../../morm/src/morm_types.h ../../../morm/src/model.h
|
||||
winixbase.o: ../../../morm/src/modelconnector.h ../../../morm/src/clearer.h
|
||||
@@ -2559,15 +2559,15 @@ winixmodeldeprecated.o: ../../../pikotools/src/utf8/utf8.h
|
||||
winixmodeldeprecated.o: ../../../pikotools/src/textstream/stream.h
|
||||
winixmodeldeprecated.o: ../../../pikotools/src/utf8/utf8_templates.h
|
||||
winixmodeldeprecated.o: ../../../pikotools/src/utf8/utf8_private.h
|
||||
winixmodeldeprecated.o: ../../../pikotools/src/convert/baseparser.h log.h
|
||||
winixmodeldeprecated.o: logmanipulators.h ../../../pikotools/src/log/log.h
|
||||
winixmodeldeprecated.o: ../../../pikotools/src/convert/baseparser.h
|
||||
winixmodeldeprecated.o: ../../../pikotools/src/textstream/textstream.h
|
||||
winixmodeldeprecated.o: ../../../pikotools/src/textstream/stream.h
|
||||
winixmodeldeprecated.o: ../../../pikotools/src/space/space.h
|
||||
winixmodeldeprecated.o: ../../../pikotools/src/date/date.h
|
||||
winixmodeldeprecated.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
winixmodeldeprecated.o: ../../../pikotools/src/textstream/types.h filelog.h
|
||||
winixmodeldeprecated.o: ../../../winix/winixd/core/synchro.h
|
||||
winixmodeldeprecated.o: ../../../pikotools/src/textstream/types.h log.h
|
||||
winixmodeldeprecated.o: logmanipulators.h ../../../pikotools/src/log/log.h
|
||||
winixmodeldeprecated.o: filelog.h ../../../winix/winixd/core/synchro.h
|
||||
winixmodeldeprecated.o: ../../../morm/src/morm.h
|
||||
winixmodeldeprecated.o: ../../../morm/src/morm_types.h
|
||||
winixmodeldeprecated.o: ../../../morm/src/model.h
|
||||
@@ -2611,14 +2611,14 @@ winixsystem.o: ../../../pikotools/src/utf8/utf8.h
|
||||
winixsystem.o: ../../../pikotools/src/textstream/stream.h
|
||||
winixsystem.o: ../../../pikotools/src/utf8/utf8_templates.h
|
||||
winixsystem.o: ../../../pikotools/src/utf8/utf8_private.h
|
||||
winixsystem.o: ../../../pikotools/src/convert/baseparser.h log.h
|
||||
winixsystem.o: logmanipulators.h ../../../pikotools/src/log/log.h
|
||||
winixsystem.o: ../../../pikotools/src/convert/baseparser.h
|
||||
winixsystem.o: ../../../pikotools/src/textstream/textstream.h
|
||||
winixsystem.o: ../../../pikotools/src/textstream/stream.h
|
||||
winixsystem.o: ../../../pikotools/src/space/space.h
|
||||
winixsystem.o: ../../../pikotools/src/date/date.h
|
||||
winixsystem.o: ../../../pikotools/src/membuffer/membuffer.h
|
||||
winixsystem.o: ../../../pikotools/src/textstream/types.h filelog.h
|
||||
winixsystem.o: ../../../pikotools/src/textstream/types.h log.h
|
||||
winixsystem.o: logmanipulators.h ../../../pikotools/src/log/log.h filelog.h
|
||||
winixsystem.o: ../../../winix/winixd/core/synchro.h ../../../morm/src/morm.h
|
||||
winixsystem.o: ../../../morm/src/morm_types.h ../../../morm/src/model.h
|
||||
winixsystem.o: ../../../morm/src/modelconnector.h ../../../morm/src/clearer.h
|
||||
|
@@ -711,8 +711,9 @@ void App::ClearAfterRequest()
|
||||
cur.session->ClearAfterRequest();
|
||||
cur.session = session_manager.GetTmpSession();
|
||||
output_8bit.clear();
|
||||
output_8bit2.clear();
|
||||
compressed_output.clear();
|
||||
html_filtered.clear();
|
||||
//html_filtered.clear();
|
||||
aheader_name.clear();
|
||||
aheader_value.clear();
|
||||
cur.mount = system.mounts.GetEmptyMount();
|
||||
@@ -775,77 +776,11 @@ void App::SaveSessionsIfNeeded()
|
||||
}
|
||||
|
||||
|
||||
|
||||
pt::WTextStream * App::CreateFrameAnswer()
|
||||
{
|
||||
Request & req = *cur.request;
|
||||
auto i = req.out_streams.streams_map.begin();
|
||||
const std::wstring * frame = cur.request->ParamValuep(config.request_frame_parameter);
|
||||
|
||||
if( frame )
|
||||
{
|
||||
for( ; i != req.out_streams.streams_map.end() ; ++i)
|
||||
{
|
||||
if( i->first == *frame )
|
||||
{
|
||||
return &i->second->get_buffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
pt::WTextStream * App::CreateJSONAnswer()
|
||||
{
|
||||
Request & req = *cur.request;
|
||||
json_out_stream.clear();
|
||||
|
||||
if( !req.return_info_only )
|
||||
{
|
||||
json_out_stream << L"{\n\"frames\": {\n";
|
||||
|
||||
auto i = req.out_streams.streams_map.begin();
|
||||
bool is_first = true;
|
||||
|
||||
for( ; i != req.out_streams.streams_map.end() ; ++i)
|
||||
{
|
||||
if( !is_first )
|
||||
{
|
||||
json_out_stream << L",\n";
|
||||
}
|
||||
|
||||
json_out_stream << L"\"";
|
||||
JSONescape(i->first, json_out_stream);
|
||||
json_out_stream << L"\": \"";
|
||||
JSONescapeStream(i->second->get_buffer(), json_out_stream);
|
||||
json_out_stream << L"\"";
|
||||
is_first = false;
|
||||
}
|
||||
|
||||
json_out_stream << L"}\n,\n\"info\": ";
|
||||
}
|
||||
|
||||
req.info.serialize_to_json_stream(json_out_stream, false);
|
||||
log << log3 << "App: sending JSON answer";
|
||||
|
||||
if( !req.return_info_only )
|
||||
json_out_stream << L"}\n";
|
||||
else
|
||||
log << " (Request::info only)";
|
||||
|
||||
log << logend;
|
||||
|
||||
return &json_out_stream;
|
||||
}
|
||||
|
||||
|
||||
// !! IMPROVE ME change to a better name
|
||||
void App::MakePage()
|
||||
void App::MakeEzcGenerator()
|
||||
{
|
||||
if( cur.request->page_generated || !cur.request->redirect_to.empty() || !cur.request->x_sendfile.empty() )
|
||||
return;
|
||||
// if( cur.request->page_generated || !cur.request->redirect_to.empty() || !cur.request->x_sendfile.empty() )
|
||||
// return;
|
||||
|
||||
|
||||
clock_gettime(CLOCK_REALTIME, &cur.request->timespec_ezc_engine_start);
|
||||
@@ -888,10 +823,12 @@ void App::CheckPostRedirect()
|
||||
|
||||
void App::AddDefaultModels()
|
||||
{
|
||||
if( !cur.request->send_bin_stream && !cur.request->return_json )
|
||||
// there is no need to add default models if we return a binary stream
|
||||
if( cur.request->answer_source != Request::AnswerSource::answer_bin_stream )
|
||||
{
|
||||
if( cur.request->function && cur.request->function->register_default_models )
|
||||
{
|
||||
// may it would be better do not return cur.request by default?
|
||||
cur.request->models.Add(L"request", cur.request);
|
||||
|
||||
if( cur.session && cur.session->puser )
|
||||
@@ -920,8 +857,8 @@ void App::Make()
|
||||
return;
|
||||
}
|
||||
|
||||
if( cur.request->ParamValue(L"reqtype") == L"json" )
|
||||
cur.request->return_json = true;
|
||||
if( !cur.request->PrepareAnswerType() )
|
||||
return;
|
||||
|
||||
if( cur.session->ip_ban && cur.session->ip_ban->IsIPBanned() )
|
||||
{
|
||||
@@ -973,9 +910,6 @@ void App::Make()
|
||||
log << log1 << "App: there is no a root dir (dir_tab is empty -- after calling a function)" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
plugin.Call(WINIX_CONTENT_MAKE);
|
||||
MakePage();
|
||||
}
|
||||
|
||||
|
||||
@@ -1316,9 +1250,9 @@ void App::ReadPostVars()
|
||||
post_multi_parser.Parse(fcgi_request.in, cur.request->post_tab, cur.request->post_file_tab);
|
||||
}
|
||||
else
|
||||
if( pt::is_substr_nc(L"application/json", cur.request->env_content_type.c_str()) )
|
||||
if( pt::is_substr_nc(Winix::Header::application_json, cur.request->env_content_type.c_str()) )
|
||||
{
|
||||
log << log3 << "App: post content type: application/json" << logend;
|
||||
log << log3 << "App: post content type: " << Winix::Header::application_json << logend;
|
||||
ReadPostJson();
|
||||
}
|
||||
else
|
||||
@@ -1498,27 +1432,42 @@ void App::PrepareHeaderContentType()
|
||||
{
|
||||
if( !cur.request->out_headers.has_key(Winix::Header::content_type) )
|
||||
{
|
||||
if( !cur.request->send_bin_stream )
|
||||
if( cur.request->answer_source == Request::AnswerSource::answer_bin_stream )
|
||||
{
|
||||
if( cur.request->return_json )
|
||||
cur.request->out_headers.add(Winix::Header::content_type, Winix::Header::application_octet_stream);
|
||||
}
|
||||
else
|
||||
{
|
||||
if( cur.request->answer_container == Request::AnswerContainer::answer_json )
|
||||
{
|
||||
cur.request->out_headers.add(Winix::Header::content_type, L"application/json; charset=UTF-8");
|
||||
cur.request->out_headers.add(Winix::Header::content_type, Winix::Header::application_json_utf8);
|
||||
}
|
||||
else
|
||||
if( cur.request->answer_container == Request::AnswerContainer::answer_xml )
|
||||
{
|
||||
cur.request->out_headers.add(Winix::Header::content_type, Winix::Header::application_xml_utf8);
|
||||
}
|
||||
else
|
||||
if( cur.request->answer_container == Request::AnswerContainer::answer_csv )
|
||||
{
|
||||
cur.request->out_headers.add(Winix::Header::content_type, Winix::Header::text_csv_utf8);
|
||||
}
|
||||
else
|
||||
if( cur.request->answer_container == Request::AnswerContainer::answer_text )
|
||||
{
|
||||
switch( config.content_type_header )
|
||||
{
|
||||
case 1:
|
||||
cur.request->out_headers.add(Winix::Header::content_type, L"application/xhtml+xml; charset=UTF-8");
|
||||
cur.request->out_headers.add(Winix::Header::content_type, Winix::Header::application_xhtml_xml_utf8);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
cur.request->out_headers.add(Winix::Header::content_type, L"application/xml; charset=UTF-8");
|
||||
cur.request->out_headers.add(Winix::Header::content_type, Winix::Header::application_xml_utf8);
|
||||
break;
|
||||
|
||||
case 0:
|
||||
default:
|
||||
cur.request->out_headers.add(Winix::Header::content_type, L"text/html; charset=UTF-8");
|
||||
cur.request->out_headers.add(Winix::Header::content_type, Winix::Header::text_html_utf8);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1689,7 +1638,8 @@ void App::PrepareHeaders(bool compressing, int compress_encoding, Header header,
|
||||
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() && !cur.request->return_json )
|
||||
if( !cur.request->redirect_to.empty() )
|
||||
{
|
||||
PrepareHeadersRedirect();
|
||||
}
|
||||
@@ -1713,82 +1663,6 @@ void App::PrepareHeaders(bool compressing, int compress_encoding, Header header,
|
||||
}
|
||||
|
||||
|
||||
void App::PrepareStandardJSONFields()
|
||||
{
|
||||
pt::Space & info = cur.request->info;
|
||||
|
||||
if( !info.has_key(L"status") )
|
||||
{
|
||||
info.add(L"status", cur.request->status);
|
||||
}
|
||||
|
||||
if( !cur.request->redirect_to.empty() && !info.has_key(L"redirect_to") )
|
||||
{
|
||||
info.add(L"redirect_to", cur.request->redirect_to);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void App::FilterContent()
|
||||
{
|
||||
Request & req = *cur.request;
|
||||
|
||||
bool filter_main_stream = false;
|
||||
bool filter_json = false;
|
||||
|
||||
if( config.html_filter && !req.send_bin_stream )
|
||||
{
|
||||
if( req.return_json )
|
||||
{
|
||||
if( !req.return_info_only && req.out_streams_use_html_filter )
|
||||
{
|
||||
filter_json = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( req.out_main_stream_use_html_filter )
|
||||
filter_main_stream = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( filter_main_stream )
|
||||
{
|
||||
std::wstring tmp_out_main_stream;
|
||||
req.out_main_stream.to_str(tmp_out_main_stream, false);
|
||||
TemplatesFunctions::html_filter.Filter(tmp_out_main_stream, html_filtered); // IMPROVEME let Filter take pt::WTextStream
|
||||
|
||||
/*
|
||||
* it would be better to just return a pointer from this method
|
||||
*
|
||||
*/
|
||||
req.out_main_stream.clear();
|
||||
req.out_main_stream.PutText(html_filtered);
|
||||
log << log3 << "App: html in the main stream has been filtered" << logend;
|
||||
}
|
||||
|
||||
if( filter_json )
|
||||
{
|
||||
for(auto i = req.out_streams.streams_map.begin() ; i != req.out_streams.streams_map.end() ; ++i)
|
||||
{
|
||||
HtmlTextStream & stream = *i->second;
|
||||
|
||||
std::wstring tmp_stream;
|
||||
stream.to_str(tmp_stream, false);
|
||||
|
||||
TemplatesFunctions::html_filter.Filter(tmp_stream, html_filtered);
|
||||
|
||||
stream.clear();
|
||||
stream.PutText(html_filtered);
|
||||
}
|
||||
|
||||
log << log3 << "App: html in json out streams have been filtered" << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int App::SelectDeflateVersion()
|
||||
@@ -1856,11 +1730,11 @@ 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->return_json )
|
||||
// {
|
||||
// // if there is a redirect flag then it will be put to info struct
|
||||
// return true;
|
||||
// }
|
||||
|
||||
if( !cur.request->redirect_to.empty() )
|
||||
{
|
||||
@@ -1918,79 +1792,9 @@ bool App::IsRequestedFrame()
|
||||
}
|
||||
|
||||
|
||||
void App::SendTextAnswer()
|
||||
{
|
||||
const pt::WTextStream * source = nullptr;
|
||||
bool compressing = false;
|
||||
int compress_encoding = 0;
|
||||
size_t output_size = 0;
|
||||
|
||||
Header header = GetHTTPStatusCode();
|
||||
|
||||
if( CanSendContent() )
|
||||
{
|
||||
/*
|
||||
* FIXME frames are not filtered (when is_htmx_request is true)
|
||||
*
|
||||
* FilterContent() should be combined with CreateJSONAnswer() and CreateFrameAnswer() somehow
|
||||
*/
|
||||
FilterContent();
|
||||
|
||||
// cur.request->return_json is depracated, we will create json from models/space registered through request->models object
|
||||
if( cur.request->return_json )
|
||||
{
|
||||
source = CreateJSONAnswer();
|
||||
}
|
||||
else
|
||||
if( IsRequestedFrame() )
|
||||
{
|
||||
source = CreateFrameAnswer();
|
||||
|
||||
if( !source )
|
||||
{
|
||||
empty_response.clear();
|
||||
source = &empty_response;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
source = &cur.request->out_main_stream.get_buffer();
|
||||
}
|
||||
|
||||
SelectCompression(source->size(), compressing, compress_encoding);
|
||||
|
||||
pt::wide_stream_to_utf8(*source, output_8bit);
|
||||
|
||||
// !! IMPROVE ME add to log the binary stream as well
|
||||
if( config.log_server_answer )
|
||||
log << log1 << "App: the server's answer is:\n" << output_8bit << "\nApp: end of the server's answer" << logend;
|
||||
|
||||
if( compressing )
|
||||
{
|
||||
compress.Compressing(output_8bit.c_str(), output_8bit.length(), compressed_output, compress_encoding);
|
||||
output_size = compressed_output.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
output_size = output_8bit.size();
|
||||
}
|
||||
}
|
||||
|
||||
PrepareHeaders(compressing, compress_encoding, header, output_size);
|
||||
SendHeaders();
|
||||
SendCookies();
|
||||
FCGX_PutS("\r\n", fcgi_request.out);
|
||||
|
||||
if( CanSendContent() )
|
||||
{
|
||||
if( compressing )
|
||||
SendData(compressed_output, fcgi_request.out);
|
||||
else
|
||||
FCGX_PutStr(output_8bit.c_str(), output_8bit.size(), fcgi_request.out);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// IMPROVEME
|
||||
// we can send directly from BinaryPage without copying to a temporary buffer
|
||||
// (but there is no an interface in BinaryPage yet)
|
||||
void App::SendData(const BinaryPage & page, FCGX_Stream * out)
|
||||
{
|
||||
const size_t buf_size = 4096;
|
||||
@@ -2014,28 +1818,410 @@ void App::SendData(const BinaryPage & page, FCGX_Stream * out)
|
||||
}
|
||||
|
||||
|
||||
void App::SendBinaryAnswer()
|
||||
|
||||
void App::SendAnswer()
|
||||
{
|
||||
BinaryPage & source = cur.request->out_bin_stream;
|
||||
Header header = h_200;
|
||||
Error status = cur.request->status;
|
||||
bool compressing;
|
||||
int compress_encoding;
|
||||
output_8bit.clear();
|
||||
output_8bit2.clear();
|
||||
compressed_output.clear();
|
||||
|
||||
SelectCompression(source.size(), compressing, compress_encoding);
|
||||
// may use CanSendContent() method?
|
||||
// what about method HEAD?
|
||||
if( !cur.request->redirect_to.empty() || !cur.request->x_sendfile.empty() )
|
||||
{
|
||||
Send8bitOutput(output_8bit);
|
||||
return;
|
||||
}
|
||||
|
||||
if( status == WINIX_ERR_NO_ITEM || status == WINIX_ERR_NO_FUNCTION || status == WINIX_ERR_UNKNOWN_PARAM )
|
||||
header = h_404;
|
||||
if( cur.request->answer_source == Request::AnswerSource::answer_bin_stream )
|
||||
{
|
||||
Send8bitOutput(cur.request->out_bin_stream);
|
||||
}
|
||||
else
|
||||
{
|
||||
// is this plugin call correct here?
|
||||
plugin.Call(WINIX_CONTENT_MAKE);
|
||||
|
||||
if( status == WINIX_ERR_PERMISSION_DENIED || status == WINIX_ERR_CANT_CHANGE_USER || status == WINIX_ERR_CANT_CHANGE_GROUP )
|
||||
header = h_403;
|
||||
if( cur.request->answer_source == Request::AnswerSource::answer_models && cur.request->use_ezc_engine )
|
||||
{
|
||||
MakeEzcGenerator(); // give me a better name
|
||||
|
||||
if( !cur.request->frame.empty() || cur.request->send_all_frames )
|
||||
{
|
||||
cur.request->answer_source = Request::AnswerSource::answer_frame_streams;
|
||||
}
|
||||
else
|
||||
{
|
||||
cur.request->answer_source = Request::AnswerSource::answer_main_stream;
|
||||
}
|
||||
}
|
||||
|
||||
if( cur.request->answer_source == Request::AnswerSource::answer_main_stream )
|
||||
{
|
||||
const wchar_t * field_name = nullptr;
|
||||
|
||||
if( cur.request->answer_container == Request::AnswerContainer::answer_xml )
|
||||
field_name = config.xml_root.c_str();
|
||||
|
||||
SerializeStream(cur.request->out_main_stream.get_buffer(), field_name);
|
||||
}
|
||||
else
|
||||
if( cur.request->answer_source == Request::AnswerSource::answer_frame_streams )
|
||||
{
|
||||
SerializeFrames();
|
||||
}
|
||||
else
|
||||
if( cur.request->answer_source == Request::AnswerSource::answer_models )
|
||||
{
|
||||
SerializeModels();
|
||||
}
|
||||
|
||||
Send8bitOutput(output_8bit);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// !! IMPROVE ME add header: content-length (size from Item struct)
|
||||
// warning: if someone changed a file on the disk (in the real os)
|
||||
// then winix would send an incorrect content-lenght header,
|
||||
// we are waiting for the fsck winix function to be implemented
|
||||
PrepareHeaders(compressing, compress_encoding, header, static_cast<size_t>(-1));
|
||||
void App::SerializeStream(const pt::WTextStream & input_stream, const wchar_t * field_name)
|
||||
{
|
||||
switch( cur.request->answer_container )
|
||||
{
|
||||
case Request::AnswerContainer::answer_json:
|
||||
SerializeStreamJson(input_stream, field_name);
|
||||
break;
|
||||
|
||||
case Request::AnswerContainer::answer_xml:
|
||||
SerializeStreamXml(input_stream, field_name);
|
||||
break;
|
||||
|
||||
case Request::AnswerContainer::answer_csv:
|
||||
SerializeStreamCsv(input_stream, field_name);
|
||||
break;
|
||||
|
||||
case Request::AnswerContainer::answer_text:
|
||||
default:
|
||||
FilterHtmlIfNeeded(input_stream, output_8bit);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void App::SerializeStreamJson(const pt::WTextStream & input_stream, const wchar_t * field_name)
|
||||
{
|
||||
if( field_name )
|
||||
{
|
||||
output_8bit << '"';
|
||||
pt::esc_to_json(field_name, output_8bit);
|
||||
output_8bit << "\":";
|
||||
}
|
||||
|
||||
output_8bit << '"';
|
||||
FilterHtmlIfNeeded(input_stream, output_8bit2);
|
||||
pt::esc_to_json(output_8bit2, output_8bit);
|
||||
output_8bit << '"';
|
||||
}
|
||||
|
||||
|
||||
void App::SerializeStreamXml(const pt::WTextStream & input_stream, const wchar_t * field_name)
|
||||
{
|
||||
if( field_name )
|
||||
{
|
||||
output_8bit << '<';
|
||||
pt::esc_to_xml(field_name, output_8bit);
|
||||
output_8bit << '>';
|
||||
}
|
||||
|
||||
FilterHtmlIfNeeded(input_stream, output_8bit2);
|
||||
pt::esc_to_xml(output_8bit2, output_8bit);
|
||||
|
||||
if( field_name )
|
||||
{
|
||||
output_8bit << "</";
|
||||
pt::esc_to_xml(field_name, output_8bit);
|
||||
output_8bit << '>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void App::SerializeStreamCsv(const pt::WTextStream & input_stream, const wchar_t * field_name)
|
||||
{
|
||||
if( field_name )
|
||||
{
|
||||
output_8bit << '"';
|
||||
pt::esc_to_csv(field_name, output_8bit);
|
||||
output_8bit << "\";";
|
||||
}
|
||||
|
||||
FilterHtmlIfNeeded(input_stream, output_8bit2);
|
||||
output_8bit << '"';
|
||||
pt::esc_to_csv(output_8bit2, output_8bit);
|
||||
output_8bit << "\";\n";
|
||||
}
|
||||
|
||||
|
||||
void App::SerializeFrames()
|
||||
{
|
||||
if( cur.request->answer_container == Request::AnswerContainer::answer_json )
|
||||
{
|
||||
output_8bit << '{';
|
||||
}
|
||||
else
|
||||
if( cur.request->answer_container == Request::AnswerContainer::answer_xml )
|
||||
{
|
||||
output_8bit << '<';
|
||||
pt::esc_to_xml(config.xml_root, output_8bit);
|
||||
output_8bit << '>';
|
||||
}
|
||||
|
||||
if( cur.request->frame.empty() || cur.request->send_all_frames )
|
||||
SerializeAllFrames();
|
||||
else
|
||||
SerializeOneFrame();
|
||||
|
||||
if( cur.request->answer_container == Request::AnswerContainer::answer_json )
|
||||
{
|
||||
output_8bit << '}';
|
||||
}
|
||||
else
|
||||
if( cur.request->answer_container == Request::AnswerContainer::answer_xml )
|
||||
{
|
||||
output_8bit << "</";
|
||||
pt::esc_to_xml(config.xml_root, output_8bit);
|
||||
output_8bit << '>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void App::SerializeAllFrames()
|
||||
{
|
||||
auto i = cur.request->out_streams.streams_map.begin();
|
||||
bool is_first = true;
|
||||
|
||||
for( ; i != cur.request->out_streams.streams_map.end() ; ++i)
|
||||
{
|
||||
if( cur.request->answer_container == Request::AnswerContainer::answer_json && !is_first )
|
||||
{
|
||||
output_8bit << ',';
|
||||
}
|
||||
|
||||
if( cur.request->answer_container == Request::AnswerContainer::answer_xml && i->first.empty() )
|
||||
{
|
||||
log << log2 << "App: I cannot serialize a frame with an empty name to xml (frame skipped)" << logend;
|
||||
}
|
||||
else
|
||||
{
|
||||
SerializeStream(i->second->get_buffer(), i->first.c_str());
|
||||
}
|
||||
|
||||
is_first = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void App::SerializeOneFrame()
|
||||
{
|
||||
auto i = cur.request->out_streams.streams_map.find(cur.request->frame);
|
||||
|
||||
if( i != cur.request->out_streams.streams_map.end() )
|
||||
{
|
||||
SerializeStream(i->second->get_buffer(), cur.request->frame.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log2 << "App: there is no such a frame: " << cur.request->frame << logend;
|
||||
// return 404 in such a case?
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void App::SerializeModels()
|
||||
{
|
||||
Ezc::Models::ModelsMap models_map = cur.request->models.GetMap();
|
||||
auto i = models_map.begin();
|
||||
|
||||
if( cur.request->answer_container == Request::AnswerContainer::answer_json )
|
||||
{
|
||||
output_8bit << '{';
|
||||
}
|
||||
else
|
||||
if( cur.request->answer_container == Request::AnswerContainer::answer_xml )
|
||||
{
|
||||
output_8bit << '<';
|
||||
pt::esc_to_xml(config.xml_root, output_8bit);
|
||||
output_8bit << '>';
|
||||
log << log2 << "App: serializing models to xml not implemented yet" << logend;
|
||||
}
|
||||
|
||||
bool is_first = true;
|
||||
|
||||
for( ; i != models_map.end() ; ++i)
|
||||
{
|
||||
if( cur.request->answer_container == Request::AnswerContainer::answer_json && !is_first )
|
||||
{
|
||||
output_8bit << ',';
|
||||
}
|
||||
|
||||
if( cur.request->answer_container == Request::AnswerContainer::answer_xml && i->first.empty() )
|
||||
{
|
||||
log << log2 << "App: I cannot serialize a model with an empty name to xml (model skipped)" << logend;
|
||||
}
|
||||
else
|
||||
{
|
||||
SerializeModel(i->second, i->first.c_str());
|
||||
}
|
||||
|
||||
is_first = false;
|
||||
}
|
||||
|
||||
if( cur.request->answer_container == Request::AnswerContainer::answer_json )
|
||||
{
|
||||
output_8bit << '}';
|
||||
}
|
||||
else
|
||||
if( cur.request->answer_container == Request::AnswerContainer::answer_xml )
|
||||
{
|
||||
output_8bit << "</";
|
||||
pt::esc_to_xml(config.xml_root, output_8bit);
|
||||
output_8bit << '>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void App::SerializeModel(morm::Wrapper & wrapper, const wchar_t * field_name)
|
||||
{
|
||||
switch( cur.request->answer_container )
|
||||
{
|
||||
case Request::AnswerContainer::answer_json:
|
||||
SerializeModelJson(wrapper, field_name);
|
||||
break;
|
||||
|
||||
case Request::AnswerContainer::answer_xml:
|
||||
SerializeModelXml(wrapper, field_name);
|
||||
break;
|
||||
|
||||
case Request::AnswerContainer::answer_csv:
|
||||
SerializeModelCsv(wrapper, field_name);
|
||||
break;
|
||||
|
||||
case Request::AnswerContainer::answer_text:
|
||||
default:
|
||||
SerializeModelCsv(wrapper, field_name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void App::SerializeModelJson(morm::Wrapper & wrapper, const wchar_t * field_name)
|
||||
{
|
||||
if( field_name )
|
||||
{
|
||||
output_8bit << '"';
|
||||
pt::esc_to_json(field_name, output_8bit);
|
||||
output_8bit << "\":";
|
||||
}
|
||||
|
||||
if( wrapper.model )
|
||||
{
|
||||
serialized_model.clear();
|
||||
wrapper.model->set_connector(model_connector);
|
||||
wrapper.model->to_text(serialized_model);
|
||||
output_8bit << serialized_model;
|
||||
}
|
||||
|
||||
if( wrapper.date )
|
||||
{
|
||||
output_8bit << '"';
|
||||
wrapper.date->SerializeISO(output_8bit);
|
||||
output_8bit << '"';
|
||||
}
|
||||
|
||||
if( wrapper.space_wrapper )
|
||||
{
|
||||
wrapper.space_wrapper->get_space()->serialize_to_json_stream(output_8bit, false);
|
||||
}
|
||||
|
||||
if( wrapper.model_container_wrapper )
|
||||
{
|
||||
wrapper.model_container_wrapper->set_iterator_at_first_model();
|
||||
bool is_first = true;
|
||||
output_8bit << '[';
|
||||
|
||||
while( wrapper.model_container_wrapper->is_iterator_correct() )
|
||||
{
|
||||
if( !is_first )
|
||||
output_8bit << ',';
|
||||
|
||||
morm::Model * model = wrapper.model_container_wrapper->get_model();
|
||||
serialized_model.clear();
|
||||
model->set_connector(model_connector);
|
||||
model->to_text(serialized_model);
|
||||
output_8bit << serialized_model;
|
||||
|
||||
wrapper.model_container_wrapper->increment_iterator();
|
||||
is_first = false;
|
||||
}
|
||||
|
||||
output_8bit << ']';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void App::SerializeModelXml(morm::Wrapper & wrapper, const wchar_t * field_name)
|
||||
{
|
||||
// IMPROVEME
|
||||
log << log2 << "App: serializing models to xml not implemented yet" << logend;
|
||||
}
|
||||
|
||||
|
||||
void App::SerializeModelCsv(morm::Wrapper & wrapper, const wchar_t * field_name)
|
||||
{
|
||||
// IMPROVEME
|
||||
log << log2 << "App: serializing models to csv not implemented yet" << logend;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// IMPROVEME
|
||||
// gime me a better name
|
||||
void App::FilterHtmlIfNeeded(const pt::WTextStream & input_stream, BinaryPage & output, bool clear_stream)
|
||||
{
|
||||
if( config.html_filter && cur.request->use_html_filter )
|
||||
{
|
||||
TemplatesFunctions::html_filter.filter(input_stream, output, clear_stream);
|
||||
}
|
||||
else
|
||||
{
|
||||
pt::wide_stream_to_utf8(input_stream, output, clear_stream);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
||||
if( config.log_server_answer )
|
||||
{
|
||||
log << log1 << "App: the server's answer is:\n" << output << "\nApp: end of the server's answer" << logend;
|
||||
}
|
||||
|
||||
if( compressing )
|
||||
{
|
||||
compress.Compressing(output, compressed_output, compress_encoding);
|
||||
output_size = compressed_output.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
output_size = output.size();
|
||||
}
|
||||
|
||||
PrepareHeaders(compressing, compress_encoding, header, output_size);
|
||||
SendHeaders();
|
||||
SendCookies();
|
||||
FCGX_PutS("\r\n", fcgi_request.out);
|
||||
@@ -2043,29 +2229,13 @@ int compress_encoding;
|
||||
if( CanSendContent() )
|
||||
{
|
||||
if( compressing )
|
||||
{
|
||||
compress.Compressing(source, compressed_output, compress_encoding);
|
||||
SendData(compressed_output, fcgi_request.out);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendData(source, fcgi_request.out);
|
||||
}
|
||||
SendData(output, fcgi_request.out);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void App::SendAnswer()
|
||||
{
|
||||
if( cur.request->return_json )
|
||||
PrepareStandardJSONFields();
|
||||
|
||||
if( cur.request->send_bin_stream )
|
||||
SendBinaryAnswer();
|
||||
else
|
||||
SendTextAnswer();
|
||||
}
|
||||
|
||||
|
||||
void App::LogUser(const char * msg, uid_t id)
|
||||
{
|
||||
|
@@ -149,9 +149,13 @@ private:
|
||||
std::string send_data_buf;
|
||||
pt::WTextStream json_out_stream;
|
||||
std::string aheader_name, aheader_value;
|
||||
std::wstring html_filtered;
|
||||
std::string output_8bit;
|
||||
//std::wstring html_filtered;
|
||||
//std::string output_8bit;
|
||||
pt::TextStream serialized_model;
|
||||
|
||||
BinaryPage output_8bit, output_8bit2;
|
||||
BinaryPage compressed_output;
|
||||
|
||||
std::wstring cookie_id_string;
|
||||
std::wstring http_header_name;
|
||||
std::wstring http_header_value;
|
||||
@@ -194,19 +198,32 @@ private:
|
||||
void CheckIfNeedSSLredirect();
|
||||
void SetLocale();
|
||||
void CheckPostRedirect();
|
||||
void MakePage();
|
||||
void MakeEzcGenerator();
|
||||
void AddDefaultModels();
|
||||
void Make();
|
||||
void SaveSessionsIfNeeded(); // !! IMPROVE ME wywalic do menagera sesji??
|
||||
void LogAccess();
|
||||
void SendData(const BinaryPage & page, FCGX_Stream * out);
|
||||
pt::WTextStream * CreateFrameAnswer();
|
||||
pt::WTextStream * CreateJSONAnswer();
|
||||
|
||||
void ReadRequest();
|
||||
void SendTextAnswer();
|
||||
void SendBinaryAnswer();
|
||||
void SendAnswer();
|
||||
void SerializeStream(const pt::WTextStream & input_stream, const wchar_t * field_name);
|
||||
void SerializeStreamJson(const pt::WTextStream & input_stream, const wchar_t * field_name);
|
||||
void SerializeStreamXml(const pt::WTextStream & input_stream, const wchar_t * field_name);
|
||||
void SerializeStreamCsv(const pt::WTextStream & input_stream, const wchar_t * field_name);
|
||||
void SerializeFrames();
|
||||
void SerializeAllFrames();
|
||||
void SerializeOneFrame();
|
||||
void SerializeModels();
|
||||
void Send8bitOutput(BinaryPage & output);
|
||||
|
||||
void SerializeModel(morm::Wrapper & wrapper, const wchar_t * field_name);
|
||||
void SerializeModelJson(morm::Wrapper & wrapper, const wchar_t * field_name);
|
||||
void SerializeModelXml(morm::Wrapper & wrapper, const wchar_t * field_name);
|
||||
void SerializeModelCsv(morm::Wrapper & wrapper, const wchar_t * field_name);
|
||||
|
||||
void FilterHtmlIfNeeded(const pt::WTextStream & input_stream, BinaryPage & output, bool clear_stream = true);
|
||||
|
||||
|
||||
void LogEnvironmentVariables();
|
||||
void LogEnvironmentHTTPVariables();
|
||||
@@ -230,7 +247,6 @@ private:
|
||||
|
||||
Header GetHTTPStatusCode();
|
||||
void PrepareSessionCookie();
|
||||
void FilterContent();
|
||||
void SendHeaders();
|
||||
void SendCookies();
|
||||
bool AddHeader(const wchar_t * name, const wchar_t * value);
|
||||
@@ -246,7 +262,6 @@ private:
|
||||
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 PrepareStandardJSONFields();
|
||||
int SelectDeflateVersion();
|
||||
void SelectCompression(size_t source_len, bool & compression_allowed, int & compression_encoding);
|
||||
bool CanSendContent();
|
||||
|
@@ -258,6 +258,8 @@ BinaryPage::const_iterator i = page.begin();
|
||||
source_len -= strm.avail_in;
|
||||
flush = (source_len == 0) ? Z_FINISH : Z_NO_FLUSH;
|
||||
strm.next_in = (Bytef*)buffer_in;
|
||||
|
||||
// IMPROVE ME we can add an interface to pt::TextStreamBase<> and get all chunks of memory
|
||||
CopyToInputBuffer(i, strm.avail_in);
|
||||
|
||||
do
|
||||
|
@@ -285,6 +285,9 @@ void Config::AssignValues(bool stdout_is_closed)
|
||||
ezc_max_loop_elements = Size(L"ezc_max_loop_elements", 5000);
|
||||
ezc_out_streams_size = Size(L"ezc_out_streams_size", 128);
|
||||
request_frame_parameter = Text(L"request_frame_parameter", L"frame");
|
||||
request_all_frames_parameter = Text(L"request_all_frames_parameter", L"allframes");
|
||||
|
||||
xml_root = Text(L"xml_root", L"winix");
|
||||
|
||||
account_need_email_verification = Bool(L"account_need_email_verification", true);
|
||||
reset_password_code_expiration_time = Long(L"reset_password_code_expiration_time", 86400);
|
||||
|
@@ -676,6 +676,14 @@ public:
|
||||
// default: frame
|
||||
std::wstring request_frame_parameter;
|
||||
|
||||
// the name of the url parameter for returning all frames, e.g. https://domain.tld/mydir/myfunction/allframes
|
||||
// default: allframes
|
||||
std::wstring request_all_frames_parameter;
|
||||
|
||||
// the name of the root element when serializing request answer to xml
|
||||
// default: winix
|
||||
std::wstring xml_root;
|
||||
|
||||
// when true then when a user want to create a new account
|
||||
// he has to provide his email and a message will be sent back to him
|
||||
// with a link to activate the account
|
||||
|
@@ -43,10 +43,30 @@ class Header
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
static constexpr const wchar_t * content_type = L"Content-Type";
|
||||
/*
|
||||
* headers' names
|
||||
*/
|
||||
static constexpr const wchar_t * content_type = L"Content-Type";
|
||||
|
||||
|
||||
/*
|
||||
* headers' values
|
||||
*/
|
||||
static constexpr const wchar_t * application_octet_stream = L"application/octet-stream";
|
||||
|
||||
static constexpr const wchar_t * text_html = L"text/html";
|
||||
static constexpr const wchar_t * application_json = L"application/json";
|
||||
static constexpr const wchar_t * application_xml = L"application/xml";
|
||||
static constexpr const wchar_t * application_xhtml_xml = L"application/xhtml+xml";
|
||||
static constexpr const wchar_t * text_csv = L"text/csv";
|
||||
static constexpr const wchar_t * text_javascript = L"text/javascript";
|
||||
|
||||
static constexpr const wchar_t * text_html_utf8 = L"text/html; charset=UTF-8";
|
||||
static constexpr const wchar_t * application_json_utf8 = L"application/json; charset=UTF-8";
|
||||
static constexpr const wchar_t * application_xml_utf8 = L"application/xml; charset=UTF-8";
|
||||
static constexpr const wchar_t * application_xhtml_xml_utf8 = L"application/xhtml+xml; charset=UTF-8";
|
||||
static constexpr const wchar_t * text_csv_utf8 = L"text/csv; charset=UTF-8";
|
||||
static constexpr const wchar_t * text_javascript_utf8 = L"text/javascript; charset=UTF-8";
|
||||
|
||||
};
|
||||
|
||||
|
@@ -1500,6 +1500,18 @@ void JSONescapeStream(const pt::WTextStream & in, pt::WTextStream & out)
|
||||
}
|
||||
|
||||
|
||||
void JSONescapeStream(const std::wstring & in, pt::WTextStream & out)
|
||||
{
|
||||
std::wstring::const_iterator i = in.begin();
|
||||
|
||||
for( ; i != in.end() ; ++i)
|
||||
{
|
||||
JSONescape(*i, out);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool wide_to_utf8(const wchar_t * wide_string, char * utf8, size_t utf8_size)
|
||||
{
|
||||
bool res = pt::wide_to_utf8(wide_string, utf8, utf8_size);
|
||||
@@ -1589,6 +1601,5 @@ void timespec_to_stream_with_unit(timespec & val, pt::Stream & stream)
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace Winix
|
||||
|
||||
|
@@ -986,6 +986,7 @@ void JSONescape(const StringType & str, Stream & out)
|
||||
|
||||
|
||||
void JSONescapeStream(const pt::WTextStream & in, pt::WTextStream & out);
|
||||
void JSONescapeStream(const std::wstring & in, pt::WTextStream & out);
|
||||
|
||||
|
||||
|
||||
|
@@ -86,8 +86,6 @@ size_t len = 0;
|
||||
*/
|
||||
out_streams.ClearMap();
|
||||
out_streams.ResizeTab(len);
|
||||
out_main_stream_use_html_filter = true;
|
||||
out_streams_use_html_filter = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -116,8 +114,6 @@ void Request::Clear()
|
||||
out_headers.clear();
|
||||
out_cookies.clear();
|
||||
|
||||
page_generated = false;
|
||||
|
||||
env_request_method.clear();
|
||||
env_request_uri.clear();
|
||||
env_http_cookie.clear();
|
||||
@@ -137,6 +133,12 @@ void Request::Clear()
|
||||
function = nullptr;
|
||||
param_tab.clear();
|
||||
anchor.clear();
|
||||
|
||||
answer_source = AnswerSource::answer_models;
|
||||
answer_container = AnswerContainer::answer_text;
|
||||
use_ezc_engine = true;
|
||||
frame.clear();
|
||||
send_all_frames = false;
|
||||
|
||||
status = WINIX_ERR_OK;
|
||||
|
||||
@@ -165,13 +167,9 @@ void Request::Clear()
|
||||
timespec_ezc_engine_stop.tv_nsec = 0;
|
||||
|
||||
subdomain.clear();
|
||||
return_info_only = false;
|
||||
info.clear();
|
||||
return_json = false;
|
||||
models.Clear();
|
||||
|
||||
out_bin_stream.clear();
|
||||
send_bin_stream = false;
|
||||
|
||||
gen_trim_white = false;
|
||||
gen_skip_new_line = false;
|
||||
@@ -182,6 +180,7 @@ void Request::Clear()
|
||||
use_200_status_for_not_found_and_permission_denied = false;
|
||||
|
||||
html_template.clear();
|
||||
use_html_filter = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -207,6 +206,110 @@ void Request::RequestEnds()
|
||||
|
||||
|
||||
|
||||
bool Request::PrepareAnswerType()
|
||||
{
|
||||
answer_source = AnswerSource::answer_models;
|
||||
answer_container = AnswerContainer::answer_text;
|
||||
use_ezc_engine = true;
|
||||
|
||||
frame = ParamValue(config->request_frame_parameter);
|
||||
send_all_frames = (ParamValuep(config->request_all_frames_parameter) != nullptr);
|
||||
use_html_filter = config->html_filter;
|
||||
|
||||
bool ok = true;
|
||||
|
||||
// IMPLEMENT ME add checking for Accept header;
|
||||
|
||||
ok = ok && CheckContainerParameter();
|
||||
ok = ok && CheckAnswerParameter();
|
||||
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
// IMPROVE ME give me a better name
|
||||
bool Request::CheckContainerParameter()
|
||||
{
|
||||
std::wstring * container = ParamValuep(L"container");
|
||||
|
||||
if( container )
|
||||
{
|
||||
// IMPROVEME do a plugin call here
|
||||
// if a plugin can consume this then don't check text/json/xml/csv and just return true
|
||||
|
||||
if( *container == L"text" )
|
||||
{
|
||||
answer_container = Request::AnswerContainer::answer_text;
|
||||
}
|
||||
else
|
||||
if( *container == L"json" )
|
||||
{
|
||||
answer_container = Request::AnswerContainer::answer_json;
|
||||
}
|
||||
else
|
||||
if( *container == L"xml" )
|
||||
{
|
||||
answer_container = Request::AnswerContainer::answer_xml;
|
||||
}
|
||||
else
|
||||
if( *container == L"csv" )
|
||||
{
|
||||
answer_container = Request::AnswerContainer::answer_csv;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log * log = get_logger();
|
||||
|
||||
if( log )
|
||||
{
|
||||
(*log) << log2 << "App: an unknown 'container' parameter: " << *container << logend;
|
||||
// IMPROVE ME set status to 404
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// IMPROVE ME give me a better name
|
||||
bool Request::CheckAnswerParameter()
|
||||
{
|
||||
std::wstring * answer = ParamValuep(L"answer");
|
||||
|
||||
if( answer )
|
||||
{
|
||||
// IMPROVEME do a plugin call here
|
||||
// if a plugin can consume this then don't check html/data and just return true
|
||||
|
||||
if( *answer == L"html" )
|
||||
{
|
||||
use_ezc_engine = true;
|
||||
}
|
||||
else
|
||||
if( *answer == L"data" )
|
||||
{
|
||||
use_ezc_engine = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log * log = get_logger();
|
||||
|
||||
if( log )
|
||||
{
|
||||
(*log) << log2 << "App: an unknown 'answer' parameter: " << *answer << logend;
|
||||
// IMPROVE ME set status to 404
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Request::IsPostVar(const wchar_t * var)
|
||||
{
|
||||
PostTab::iterator p;
|
||||
|
@@ -249,6 +249,181 @@ public:
|
||||
*
|
||||
*/
|
||||
|
||||
// the algorithm how a request's answer is created
|
||||
// ------------------------------------------------------------------------------------------
|
||||
//
|
||||
// at the beginning of a request winix sets
|
||||
// answer_source to models
|
||||
// answer_container to text
|
||||
// use_ezc_engine to true
|
||||
//
|
||||
// next answer_container and use_ezc_engine can be changed in the following way:
|
||||
//
|
||||
// 1. winix will look for 'Accept' http header and depending on the header winix will set:
|
||||
//
|
||||
// Accept | answer_container | use_ezc_engine
|
||||
// ------------------------------------|-----------------
|
||||
// application/json | json | false
|
||||
// application/xml | xml | false
|
||||
// text/csv | csv | false
|
||||
//
|
||||
//
|
||||
//
|
||||
// 2. next answer_container is set depending on 'container' url parameter
|
||||
// container | answer_container
|
||||
// ---------------------------------------------------------
|
||||
// not present | don't change the value
|
||||
// text | text
|
||||
// json | json
|
||||
// xml | xml
|
||||
// csv | csv
|
||||
//
|
||||
// use_ezc_engine is set depending on 'answer' url parameter:
|
||||
// answer | use_ezc_engine
|
||||
// ---------------------------------
|
||||
// not present | don't change the value
|
||||
// html | true
|
||||
// data | false
|
||||
//
|
||||
// if 'answer' is html then we take into account two more parameters:
|
||||
// frame: frame_name (empty default) - if set then winix returns this specific frame
|
||||
// allframes: (if present then winix returns all frames)
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// the whole algorithm how the answer is created is shown below:
|
||||
//
|
||||
//
|
||||
// answer_source: bin_stream
|
||||
// |--------------->-------------- send out_bin_stream
|
||||
// |
|
||||
// |
|
||||
// |
|
||||
// |
|
||||
// | answer_source: models and use_ezc_engine: true
|
||||
// |------------------------>------------------------
|
||||
// | |
|
||||
// | use ezc engine
|
||||
// | for converting models
|
||||
// | to out_main_stream and frame_streams
|
||||
// | |
|
||||
// | change answer_source to
|
||||
// | frame_stream (if there is 'allframes' parameter or 'frame' parameter is not empty)
|
||||
// | or to main_stream otherwise
|
||||
// | |
|
||||
// |-------------------------<-----------------------
|
||||
// |
|
||||
// |
|
||||
// |
|
||||
// |
|
||||
// |
|
||||
// | answer_source: main_stream
|
||||
// |----------------------->-------------------------
|
||||
// | |
|
||||
// | depending on answer_container
|
||||
// | |
|
||||
// | --------------------------------------------------------------------
|
||||
// | | | | |
|
||||
// | text json xml csv
|
||||
// | | | | |
|
||||
// | send send send send
|
||||
// | out_main_stream out_main_stream out_main_stream out_main_stream
|
||||
// | as json text in one cell in first csv cell
|
||||
// | (without making e.g.
|
||||
// | an object) <winix>
|
||||
// | e.g. "text" text
|
||||
// | </winix>
|
||||
// |
|
||||
// |
|
||||
// |
|
||||
// | answer_source: frame_streams
|
||||
// |-------->-------
|
||||
// | |
|
||||
// | |
|
||||
// | depending on
|
||||
// | 'frame' string variable and 'allframes'
|
||||
// | |
|
||||
// | |
|
||||
// | | is 'frame' string empty or there is 'allframes' parameter
|
||||
// | |----------------------->---------------------
|
||||
// | | |
|
||||
// | | depending on answer_container
|
||||
// | | |
|
||||
// | | --------------------------------------------------------------------
|
||||
// | | | | | |
|
||||
// | | text json xml csv
|
||||
// | | | | | |
|
||||
// | | send text serialize serialize serialize
|
||||
// | | from all frames all frames all frames all frames
|
||||
// | | one by one to json to xml to csv
|
||||
// | |
|
||||
// | |
|
||||
// | |
|
||||
// | |
|
||||
// | | is 'frame' string not empty and there is no 'allframes' parameter
|
||||
// | |----------------------->---------------------
|
||||
// | |
|
||||
// | depending on answer_container
|
||||
// | |
|
||||
// | --------------------------------------------------------------------
|
||||
// | | | | |
|
||||
// | text json xml csv
|
||||
// | | | | |
|
||||
// | send text serialize serialize serialize
|
||||
// | from one frame one frame one frame one frame
|
||||
// | to json to xml to csv
|
||||
// |
|
||||
// |
|
||||
// |
|
||||
// |
|
||||
// |
|
||||
// |
|
||||
// | answer_source: models
|
||||
// |------------------------>------------------------
|
||||
// |
|
||||
// depending on answer_container
|
||||
// |
|
||||
// --------------------------------------------------------------------
|
||||
// | | | |
|
||||
// text json xml csv
|
||||
// | | | |
|
||||
// serialize serialize models serialize models serialize models
|
||||
// models to to json to xml to csv
|
||||
// csv
|
||||
// but return
|
||||
// as text/plain
|
||||
|
||||
|
||||
// change maybe answer_bin_stream -> source_bin_stream?
|
||||
enum AnswerSource
|
||||
{
|
||||
answer_bin_stream,
|
||||
answer_models,
|
||||
answer_main_stream,
|
||||
answer_frame_streams,
|
||||
};
|
||||
|
||||
|
||||
// change maybe answer_text -> container_text?
|
||||
enum AnswerContainer
|
||||
{
|
||||
answer_text,
|
||||
answer_json,
|
||||
answer_xml,
|
||||
answer_csv,
|
||||
};
|
||||
|
||||
AnswerSource answer_source;
|
||||
AnswerContainer answer_container;
|
||||
|
||||
bool use_ezc_engine;
|
||||
|
||||
std::wstring frame;
|
||||
bool send_all_frames;
|
||||
|
||||
|
||||
// request status
|
||||
// !! CHANGE ME it'll be better to use ordinary http result codes
|
||||
@@ -280,90 +455,24 @@ public:
|
||||
// a value can be either a cookie value or the whole cookie string (with domain, date etc)
|
||||
pt::Space out_cookies;
|
||||
|
||||
// winix can return either a text answer or a binary answer
|
||||
// if send_bin_stream is true then the binary answer is sent (out_bin_stream)
|
||||
// or if send_bin_stream is false then the text answer is sent
|
||||
// default: false
|
||||
//
|
||||
//
|
||||
// winix answer send to the client's browser
|
||||
// |
|
||||
// |
|
||||
// depending on send_bin_stream
|
||||
// (if false) ------------------------------------------------- (if true)
|
||||
// | |
|
||||
// text answer binary answer
|
||||
// | |
|
||||
// depending on return_json sending out_bin_stream
|
||||
// (if false) ------------------------------------ (if true)
|
||||
// | |
|
||||
// normal request ajax request
|
||||
// | |
|
||||
// sending out_main_stream |
|
||||
// |
|
||||
// |
|
||||
// depending on return_info_only
|
||||
// (if false) ------------------------------------------------------------- (if true)
|
||||
// | |
|
||||
// generating JSON object from: generating JSON object only from info
|
||||
// out_streams and info, e.g.: e.g.:
|
||||
// { { info object serialized here }
|
||||
// "out": { out_streams serialized here e.g.:
|
||||
// "stream_name_1": "some html content",
|
||||
// "stream_name_2": "some other html content"
|
||||
// },
|
||||
// "info": { info object serialized here }
|
||||
// }
|
||||
//
|
||||
//
|
||||
bool send_bin_stream;
|
||||
|
||||
// binary page sent to the client if send_bin_stream is true
|
||||
// binary page sent to the client if answer_source is answer_bin_stream
|
||||
BinaryPage out_bin_stream;
|
||||
|
||||
// when returning the text answer we can either return the whole html page (normal requests)
|
||||
// or a JSON object (for requests generated from AJAX)
|
||||
// if return_json is false then we return the whole html page (which is in out_main_stream)
|
||||
// if return_json is true we are creating an JSON object from out_streams
|
||||
// and from info space (see above picture)
|
||||
// (or just only from info if return_info_only is true)
|
||||
// default: false
|
||||
// return_json is set to true by App at the beginning of a request
|
||||
// if reqtype:json parameter is present (in the url)
|
||||
// note: return_json is only valid if send_bin_stream is false
|
||||
bool return_json;
|
||||
|
||||
// main text output stream where the html otput is generated from ezc templates
|
||||
// here the whole html page (with doctype, head, body) is generated
|
||||
HtmlTextStream out_main_stream;
|
||||
|
||||
// text output streams used in ajax requests (send in JSON format to the client)
|
||||
// text output streams used in ajax requests
|
||||
// in ezc templates you can use [ezc frame "stream_name"] or just [frame "stream_name"] keyword
|
||||
// to switch between streams
|
||||
Ezc::OutStreams<HtmlTextStream, true> out_streams;
|
||||
|
||||
// if true the JSON object is generated only from info (out_streams are not used)
|
||||
// default: false
|
||||
bool return_info_only;
|
||||
|
||||
// additional info added when sending the JSON answer
|
||||
pt::Space info;
|
||||
|
||||
// models to return or to render through ezc library
|
||||
Ezc::Models models;
|
||||
|
||||
|
||||
// if set to true then the standard template system will not be used
|
||||
// default: false
|
||||
bool page_generated;
|
||||
|
||||
// whether or not the main html stream should be filtered by our html filter
|
||||
bool out_main_stream_use_html_filter;
|
||||
|
||||
// whether or not the ajax streams should be filtered by our html filter
|
||||
// this filter is only aplied to streams in "out" space, "info" space is not touched
|
||||
bool out_streams_use_html_filter;
|
||||
|
||||
// filter html content with HTMLFilter, default the same as config.html_filter
|
||||
bool use_html_filter;
|
||||
|
||||
// if this variable is true then winix always return 200 OK header
|
||||
// when the status would be 404 (not found) or 403 (permission denied)
|
||||
@@ -375,7 +484,6 @@ public:
|
||||
bool gen_skip_new_line;
|
||||
bool gen_use_special_chars;
|
||||
|
||||
|
||||
// index template name
|
||||
std::wstring html_template;
|
||||
|
||||
@@ -384,6 +492,7 @@ public:
|
||||
additional variables used for common uses
|
||||
*/
|
||||
|
||||
// DEPRECATED will be removed
|
||||
// usually items in the current directory (depends on the function)
|
||||
std::vector<Item> item_tab;
|
||||
|
||||
@@ -407,7 +516,9 @@ public:
|
||||
void RequestEnds();
|
||||
void Clear();
|
||||
|
||||
|
||||
bool PrepareAnswerType();
|
||||
bool CheckContainerParameter();
|
||||
bool CheckAnswerParameter();
|
||||
|
||||
bool IsParam(const wchar_t * param_name);
|
||||
bool IsParam(const std::wstring & param_name);
|
||||
|
@@ -1461,7 +1461,7 @@ return ok;
|
||||
current limitation:
|
||||
warning: the url is not prepared by PrepareUrl() (PrepareUrl is from functions)
|
||||
*/
|
||||
bool System::AddCommonFileToVar(const wchar_t * file_path, const wchar_t * url, bool overwrite_existing)
|
||||
bool System::AddCommonFileToVar(const wchar_t * file_path, const wchar_t * url, const wchar_t * mime_type, bool overwrite_existing)
|
||||
{
|
||||
if( config->common_dir.empty() )
|
||||
{
|
||||
@@ -1489,20 +1489,14 @@ bool System::AddCommonFileToVar(const wchar_t * file_path, const wchar_t * url,
|
||||
|
||||
morm::Finder<Item> finder(model_connector);
|
||||
|
||||
bool status = finder.select().where().eq(L"parent_id", var->id).eq(L"url", url).get(file_content_item);
|
||||
file_content_item = finder.select().where().eq(L"parent_id", var->id).eq(L"url", url).get();
|
||||
|
||||
//if( db->GetItem(var->id, url, file_content_item) == WINIX_ERR_OK )
|
||||
if( status )
|
||||
if( file_content_item.found() )
|
||||
{
|
||||
if( overwrite_existing )
|
||||
{
|
||||
file_content_item.remove();
|
||||
//db->DelItem(file_content_item);
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !overwrite_existing )
|
||||
return true;
|
||||
}
|
||||
|
||||
file_content_item.remove();
|
||||
}
|
||||
|
||||
file_content_item.Clear();
|
||||
@@ -1517,6 +1511,9 @@ bool System::AddCommonFileToVar(const wchar_t * file_path, const wchar_t * url,
|
||||
file_content_item.item_content.content_raw = file_content;
|
||||
file_content_item.item_content.content_raw_type = ItemContent::ct_other;
|
||||
|
||||
if( mime_type )
|
||||
file_content_item.item_content.file_mime_type = mime_type;
|
||||
|
||||
return AddFile(file_content_item, false);
|
||||
}
|
||||
|
||||
|
@@ -210,7 +210,7 @@ public:
|
||||
bool follow_dir_default = false, bool stop_on_link_redirect = false, bool check_access = true);
|
||||
|
||||
|
||||
bool AddCommonFileToVar(const wchar_t * file_path, const wchar_t * url, bool overwrite_existing = true);
|
||||
bool AddCommonFileToVar(const wchar_t * file_path, const wchar_t * url, const wchar_t * mime_type = nullptr, bool overwrite_existing = true);
|
||||
|
||||
// reloading time zones
|
||||
void ReadTimeZones();
|
||||
|
Reference in New Issue
Block a user