add Request::AddPostVar(pt::Space & space, const wchar_t * name)
This commit is contained in:
@@ -418,45 +418,44 @@ void Request::PrepareFrameNames()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// add such a method to Space
|
||||
bool Request::AddPostVar(const wchar_t * name, const wchar_t * value)
|
||||
pt::Space * Request::AddPostVar(pt::Space & space, const wchar_t * name)
|
||||
{
|
||||
bool status = false;
|
||||
pt::Space * space_value = post_in.get_space(name);
|
||||
pt::Space * space_value = space.get_space(name);
|
||||
pt::Space * new_space = nullptr;
|
||||
Log * log = get_logger();
|
||||
|
||||
if( space_value )
|
||||
{
|
||||
if( space_value->is_table() )
|
||||
{
|
||||
if( space_value->table_size() < WINIX_POSTTABLE_VALUT_TABLE_MAXSIZE )
|
||||
if( space_value->table_size() < WINIX_POSTTABLE_VALUE_TABLE_MAXSIZE )
|
||||
{
|
||||
status = true;
|
||||
space_value->add(value);
|
||||
new_space = &space_value->add_empty_space();
|
||||
}
|
||||
else
|
||||
{
|
||||
if( log )
|
||||
{
|
||||
(*log) << log1 << "Request: more than " << WINIX_POSTTABLE_VALUT_TABLE_MAXSIZE << " post variables in a table " << name << " (skipping)" << logend;
|
||||
(*log) << log1 << "Request: more than " << WINIX_POSTTABLE_VALUE_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);
|
||||
new_space = &new_table.add_empty_space();
|
||||
space_value->set(std::move(new_table));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( post_in.object_size() < WINIX_POSTTABLE_MAXSIZE )
|
||||
if( space.object_size() < WINIX_POSTTABLE_MAXSIZE )
|
||||
{
|
||||
post_in.add(name, value);
|
||||
status = true;
|
||||
new_space = &space.add_empty_space(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -467,7 +466,21 @@ bool Request::AddPostVar(const wchar_t * name, const wchar_t * value)
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
return new_space;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Request::AddPostVar(const wchar_t * name, const wchar_t * value)
|
||||
{
|
||||
pt::Space * new_space = AddPostVar(post_in, name);
|
||||
|
||||
if( new_space )
|
||||
{
|
||||
new_space->set(value);
|
||||
}
|
||||
|
||||
return new_space != nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user