changed: now we do not use std::string and char* in the Winix API
everywhere we are using std::wstring and wchar_t* (std::string and char* is used only locally in some places especially when creating a path to OS file system etc.) added: to the special thread when winix closes: a write function for curl: FetchPageOnExitCurlCallback() without this function the curl library will print the page's content to the standart output changed: TextStream<> class from core can make UTF8<->wide strings conversions removed: from config: utf8 option now winix expects UTF8 from the user's input (html forms, url-es) and outputs strings in the UTF8 format git-svn-id: svn://ttmath.org/publicrep/winix/trunk@965 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -42,7 +42,6 @@
|
||||
#include "misc.h"
|
||||
#include "utf8/utf8.h"
|
||||
#include "log.h"
|
||||
#include "config.h"
|
||||
#include "plugin.h"
|
||||
|
||||
|
||||
@@ -53,18 +52,14 @@ namespace Winix
|
||||
|
||||
class PostParser : public HttpSimpleParser
|
||||
{
|
||||
|
||||
FCGX_Stream * in;
|
||||
PostTab * post_tab;
|
||||
std::wstring temp_name, temp_value;
|
||||
bool input_as_utf8;
|
||||
size_t log_value_size;
|
||||
int var_index;
|
||||
bool has_winix_post_params_msg;
|
||||
bool has_winix_raw_post_msg;
|
||||
std::string raw_post;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -79,20 +74,20 @@ protected:
|
||||
}
|
||||
|
||||
|
||||
void CreateLog(bool param_added)
|
||||
void CreateLog(bool param_added, const std::wstring & name, const std::wstring & value)
|
||||
{
|
||||
log << log2 << "Method POST, name: \"" << temp_name << "\"";
|
||||
log << log2 << "Method POST, name: \"" << name << "\"";
|
||||
|
||||
if( log_value_size > 0 && !IsSubStringNoCase(L"pass", temp_name.c_str()) )
|
||||
if( log_value_size > 0 && !IsSubStringNoCase(L"pass", name.c_str()) )
|
||||
{
|
||||
log << ", value: ";
|
||||
|
||||
if( temp_value.size() > log_value_size )
|
||||
if( value.size() > log_value_size )
|
||||
log << "(first " << log_value_size << " characters) ";
|
||||
|
||||
log << "\"";
|
||||
log.LogString(temp_value, log_value_size);
|
||||
log << "\" (size: " << temp_value.size() << ")";
|
||||
log.LogString(value, log_value_size);
|
||||
log << "\" (size: " << value.size() << ")";
|
||||
}
|
||||
|
||||
if( param_added == false )
|
||||
@@ -102,16 +97,8 @@ protected:
|
||||
}
|
||||
|
||||
|
||||
void ConvStr(const std::string & src, std::wstring & dst)
|
||||
{
|
||||
if( input_as_utf8 )
|
||||
PT::UTF8ToWide(src, dst);
|
||||
else
|
||||
AssignString(src, dst);
|
||||
}
|
||||
|
||||
|
||||
virtual void Parameter(std::string & name, std::string & value)
|
||||
virtual void Parameter(std::wstring & name, std::wstring & value)
|
||||
{
|
||||
bool added;
|
||||
std::pair<PostTab::iterator, bool> res;
|
||||
@@ -119,22 +106,19 @@ protected:
|
||||
if( has_winix_post_params_msg )
|
||||
plugin.Call(0, WINIX_POST_PARAMS, &name, &value);
|
||||
|
||||
ConvStr(name, temp_name);
|
||||
ConvStr(value, temp_value);
|
||||
|
||||
res = post_tab->insert( std::make_pair(temp_name, temp_value) );
|
||||
res = post_tab->insert( std::make_pair(name, value) );
|
||||
added = res.second;
|
||||
|
||||
if( !added )
|
||||
{
|
||||
temp_name += L"_inc";
|
||||
temp_name += Toa(var_index);
|
||||
res = post_tab->insert( std::make_pair(temp_name, temp_value) );
|
||||
name += L"_inc";
|
||||
name += Toa(var_index);
|
||||
res = post_tab->insert( std::make_pair(name, value) );
|
||||
added = res.second;
|
||||
var_index += 1;
|
||||
}
|
||||
|
||||
CreateLog(added);
|
||||
CreateLog(added, name, value);
|
||||
}
|
||||
|
||||
|
||||
@@ -142,13 +126,8 @@ public:
|
||||
|
||||
PostParser()
|
||||
{
|
||||
input_as_utf8 = false;
|
||||
log_value_size = 0;
|
||||
}
|
||||
|
||||
void UTF8(bool utf)
|
||||
{
|
||||
input_as_utf8 = utf;
|
||||
HttpSimpleParser::getchar_returns_utf8_chars = true;
|
||||
}
|
||||
|
||||
void LogValueSize(size_t s)
|
||||
|
Reference in New Issue
Block a user