added: to config:

parameter: ezc_max_elements
          maximum number for elements through the whole template (ezc)
          default: 50000
       parameter: ezc_max_loop_elements
          maximum number of each [for] loop
          default: 5000 (from ezc generator)
added: to Request class:
       time_t start_time;
       tm start_tm;
       they are set when a request starts
       


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@806 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2012-02-17 05:19:24 +00:00
parent 9d2be5c50d
commit 1a51b1adc7
11 changed files with 55 additions and 2 deletions

View File

@@ -265,6 +265,7 @@ void App::ProcessRequest()
{
try
{
cur.request->RequestStarts();
system.load_avg.StartRequest();
log << log2 << config.log_delimiter << logend;

View File

@@ -230,6 +230,10 @@ void Config::AssignValues(bool stdout_is_closed)
content_type_header = Int(L"content_type_header", 0);
umask = Int(L"umask", 0222);
ezc_max_elements = Size(L"ezc_max_elements", 50000);
ezc_max_loop_elements = Size(L"ezc_max_loop_elements", 5000);
}

View File

@@ -459,6 +459,16 @@ public:
int umask;
// maximum number for elements through the whole template
// default: 50000
size_t ezc_max_elements;
// maximum number of each [for] loop
// default: 5000 (from ezc generator)
size_t ezc_max_loop_elements;
Config();
bool ReadConfig(bool errors_to_stdout_, bool stdout_is_closed = true);

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010-2011, Tomasz Sowa
* Copyright (c) 2010-2012, Tomasz Sowa
* All rights reserved.
*
*/
@@ -19,6 +19,10 @@ Item::Item()
}
// !! IMPROVE ME
// now we have Request::start_time and Request::start_tm
// we can somehow get the current time from the request
// may setting the date should be completetly removed from here?
void Item::SetDateToNow()
{
date_creation = Time(std::time(0));

View File

@@ -84,10 +84,23 @@ void Request::Clear()
send_as_attachment = false;
using_ssl = false;
start_time = 0;
memset(&start_tm, 0, sizeof(start_tm));
}
void Request::RequestStarts()
{
// clearing it is better to use at the end of a request
// so starting is much faster
start_time = std::time(0);
start_tm = Time(start_time);
}
// value can be null
void Request::SetCookie(const char * name, const char * value, tm * expires)

View File

@@ -130,12 +130,18 @@ struct Request
// this is a pointer either to the item (if exists) or to the last directory
Item * last_item;
// request start time
// Time() methods are very slow so it is better to directly use those two values
// they are set when a request starts
time_t start_time;
tm start_tm;
Request();
void SetConfig(Config * pconfig);
void RequestStarts();
void Clear();
bool IsParam(const wchar_t * param_name);