the first part of reimplementing has been done
now we have app object and singletons are only: log logn plugin and app git-svn-id: svn://ttmath.org/publicrep/winix/trunk@628 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "postmultiparser.h"
|
||||
#include "log.h"
|
||||
#include "data.h"
|
||||
|
||||
|
||||
|
||||
PostMultiParser::PostMultiParser()
|
||||
@@ -18,16 +18,17 @@ PostMultiParser::PostMultiParser()
|
||||
}
|
||||
|
||||
|
||||
PostMultiParser::PostMultiParser(const PostMultiParser &)
|
||||
PostMultiParser::PostMultiParser(const PostMultiParser & p)
|
||||
{
|
||||
in_buffer = new unsigned char[WINIX_POSTMULTI_INPUT_BUFFER];
|
||||
config = p.config;
|
||||
}
|
||||
|
||||
|
||||
|
||||
PostMultiParser & PostMultiParser::operator=(const PostMultiParser &)
|
||||
PostMultiParser & PostMultiParser::operator=(const PostMultiParser & p)
|
||||
{
|
||||
in_buffer = new unsigned char[WINIX_POSTMULTI_INPUT_BUFFER];
|
||||
config = p.config;
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -39,6 +40,11 @@ PostMultiParser::~PostMultiParser()
|
||||
}
|
||||
|
||||
|
||||
void PostMultiParser::SetConfig(Config * pconfig)
|
||||
{
|
||||
config = pconfig;
|
||||
}
|
||||
|
||||
|
||||
void PostMultiParser::ReadBoundary()
|
||||
{
|
||||
@@ -263,10 +269,10 @@ bool has_boundary = false;
|
||||
content.erase(0, WINIX_POSTMULTI_OUTPUT_BUFFER);
|
||||
}
|
||||
|
||||
if( data.post_file_max != 0 && content_len > (size_t)data.post_file_max )
|
||||
if( config->post_file_max != 0 && content_len > (size_t)config->post_file_max )
|
||||
{
|
||||
err = WINIX_ERR_INPUT_TOO_LARGE;
|
||||
log << log1 << "PMP: content greater than " << data.post_file_max << " (skipping)" << logend;
|
||||
log << log1 << "PMP: content greater than " << config->post_file_max << " (skipping)" << logend;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -317,10 +323,10 @@ bool has_boundary = false;
|
||||
content_len += 1;
|
||||
ReadChar();
|
||||
|
||||
if( data.post_file_max != 0 && content_len > (size_t)data.post_file_max )
|
||||
if( config->post_file_max != 0 && content_len > (size_t)config->post_file_max )
|
||||
{
|
||||
err = WINIX_ERR_INPUT_TOO_LARGE;
|
||||
log << log1 << "PMP: content greater than " << data.post_file_max << " (skipping)" << logend;
|
||||
log << log1 << "PMP: content greater than " << config->post_file_max << " (skipping)" << logend;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -433,14 +439,14 @@ void PostMultiParser::CreateTmpFile()
|
||||
{
|
||||
char buf[100];
|
||||
|
||||
if( data.auth_tmp_dir.empty() )
|
||||
if( config->auth_tmp_dir.empty() )
|
||||
{
|
||||
log << log1 << "PMP: auth_tmp_dir is not set in the config" << logend;
|
||||
err = WINIX_ERR_CANT_CREATE_FILE;
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf(buf, "%s/winix_%u_%d_%u", data.auth_tmp_dir.c_str(), (unsigned)getpid(), tmp_filename_postfix, rand());
|
||||
sprintf(buf, "%s/winix_%u_%d_%u", config->auth_tmp_dir.c_str(), (unsigned)getpid(), tmp_filename_postfix, rand());
|
||||
tmp_filename_postfix += 1;
|
||||
|
||||
tmp_file.open(buf, std::ios_base::binary | std::ios_base::out);
|
||||
@@ -457,6 +463,8 @@ char buf[100];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void PostMultiParser::ReadPart()
|
||||
{
|
||||
name.clear();
|
||||
|
Reference in New Issue
Block a user