add core/postparser.cpp with implementation from core/postparser.h
now we can remove -lfcgi from winix in winixd/Makefile
This commit is contained in:
@@ -35,13 +35,9 @@
|
||||
#ifndef headerfile_winix_core_postparser
|
||||
#define headerfile_winix_core_postparser
|
||||
|
||||
#include <fcgiapp.h>
|
||||
#include <string>
|
||||
#include "httpsimpleparser.h"
|
||||
#include "request.h"
|
||||
#include "misc.h"
|
||||
#include "utf8/utf8.h"
|
||||
#include "convert/text.h"
|
||||
|
||||
|
||||
namespace Winix
|
||||
@@ -51,6 +47,16 @@ namespace Winix
|
||||
|
||||
class PostParser : public HttpSimpleParser
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
PostParser();
|
||||
void LogValueSize(size_t s);
|
||||
void Parse(FCGX_Stream * in, Request & request);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
FCGX_Stream * in;
|
||||
Request * request;
|
||||
size_t log_value_size;
|
||||
@@ -59,84 +65,9 @@ class PostParser : public HttpSimpleParser
|
||||
bool has_winix_raw_post_msg;
|
||||
std::string raw_post;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
virtual int GetChar()
|
||||
{
|
||||
int c = FCGX_GetChar(in);
|
||||
|
||||
if( c != -1 && has_winix_raw_post_msg )
|
||||
raw_post += c;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
void CreateLog(bool param_added, const std::wstring & name, const std::wstring & value)
|
||||
{
|
||||
log << log2 << "Method POST, name: \"" << name << "\"";
|
||||
|
||||
if( log_value_size > 0 && !pt::is_substr_nc(L"pass", name.c_str()) )
|
||||
{
|
||||
log << ", value: ";
|
||||
|
||||
if( value.size() > log_value_size )
|
||||
log << "(first " << log_value_size << " characters) ";
|
||||
|
||||
log << "\"";
|
||||
log.put_string(value, log_value_size);
|
||||
log << "\" (size: " << value.size() << ")";
|
||||
}
|
||||
|
||||
if( param_added == false )
|
||||
log << log2 << " (skipped)";
|
||||
|
||||
log << log2 << logend;
|
||||
}
|
||||
|
||||
|
||||
|
||||
virtual void Parameter(std::wstring & name, std::wstring & value)
|
||||
{
|
||||
if( has_winix_post_params_msg )
|
||||
plugin->Call(0, WINIX_POST_PARAMS, &name, &value);
|
||||
|
||||
bool added = request->AddPostVar(name, value);
|
||||
CreateLog(added, name, value);
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
|
||||
PostParser()
|
||||
{
|
||||
log_value_size = 0;
|
||||
HttpSimpleParser::getchar_returns_utf8_chars = true;
|
||||
}
|
||||
|
||||
void LogValueSize(size_t s)
|
||||
{
|
||||
log_value_size = s;
|
||||
}
|
||||
|
||||
void Parse(FCGX_Stream * in, Request & request)
|
||||
{
|
||||
this->in = in;
|
||||
this->request = &request;
|
||||
var_index = 1;
|
||||
raw_post.clear();
|
||||
|
||||
has_winix_post_params_msg = plugin->HasMessage(WINIX_POST_PARAMS);
|
||||
has_winix_raw_post_msg = plugin->HasMessage(WINIX_RAW_POST_STRING);
|
||||
|
||||
HttpSimpleParser::Parse();
|
||||
|
||||
if( has_winix_raw_post_msg )
|
||||
plugin->Call(0, WINIX_RAW_POST_STRING, &raw_post);
|
||||
|
||||
raw_post.clear();
|
||||
}
|
||||
virtual int GetChar();
|
||||
void CreateLog(bool param_added, const std::wstring & name, const std::wstring & value);
|
||||
virtual void Parameter(std::wstring & name, std::wstring & value);
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user