added support for UTF-8
now the UTF-8 is a default charset git-svn-id: svn://ttmath.org/publicrep/winix/trunk@677 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
#include <string>
|
||||
#include "httpsimpleparser.h"
|
||||
#include "requesttypes.h"
|
||||
|
||||
#include "misc.h"
|
||||
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@ class PostParser : public HttpSimpleParser
|
||||
|
||||
FCGX_Stream * in;
|
||||
PostTab * post_tab;
|
||||
std::wstring temp_name, temp_value;
|
||||
bool input_as_utf8;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -35,9 +37,20 @@ protected:
|
||||
|
||||
virtual void Parameter(std::string & name, std::string & value)
|
||||
{
|
||||
std::pair<PostTab::iterator, bool> res = post_tab->insert( std::make_pair(name, value) );
|
||||
if( input_as_utf8 )
|
||||
{
|
||||
Ezc::UTF8ToWide(name, temp_name);
|
||||
Ezc::UTF8ToWide(value, temp_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
AssignString(name, temp_name);
|
||||
AssignString(value, temp_value);
|
||||
}
|
||||
|
||||
std::pair<PostTab::iterator, bool> res = post_tab->insert( std::make_pair(temp_name, temp_value) );
|
||||
|
||||
log << log2 << "Method POST, name: \"" << name << "\", value: \"" << value << "\"";
|
||||
log << log2 << "Method POST, name: \"" << temp_name << "\", value: \"" << temp_value << "\"";
|
||||
|
||||
if( res.second == false )
|
||||
log << log2 << " (skipped)";
|
||||
@@ -48,6 +61,18 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
PostParser()
|
||||
{
|
||||
input_as_utf8 = false;
|
||||
}
|
||||
|
||||
|
||||
void UTF8(bool utf)
|
||||
{
|
||||
input_as_utf8 = utf;
|
||||
}
|
||||
|
||||
|
||||
void Parse(FCGX_Stream * in_, PostTab & post_tab_)
|
||||
{
|
||||
in = in_;
|
||||
|
Reference in New Issue
Block a user