add a Request::raw_post buffer
This buffer is used when a Function::NeedToCopyRawPost() method returned true. while here: - remove WINIX_POST_PARAMS and WINIX_RAW_POST_STRING plugin messages
This commit is contained in:
@@ -4,8 +4,8 @@
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2022, Tomasz Sowa
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -36,7 +36,6 @@
|
||||
#include <string>
|
||||
#include "postparser.h"
|
||||
#include "httpsimpleparser.h"
|
||||
#include "utf8/utf8.h"
|
||||
#include "convert/text.h"
|
||||
|
||||
|
||||
@@ -57,22 +56,15 @@ void PostParser::LogValueSize(size_t s)
|
||||
}
|
||||
|
||||
|
||||
void PostParser::Parse(FCGX_Stream * in, Request & request)
|
||||
void PostParser::Parse(FCGX_Stream * in, Request & request, bool copy_raw_post)
|
||||
{
|
||||
this->in = in;
|
||||
this->request = &request;
|
||||
this->copy_raw_post = copy_raw_post;
|
||||
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);
|
||||
this->request->raw_post.clear();
|
||||
|
||||
HttpSimpleParser::Parse();
|
||||
|
||||
if( has_winix_raw_post_msg )
|
||||
plugin->Call(WINIX_RAW_POST_STRING, &raw_post);
|
||||
|
||||
raw_post.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -80,10 +72,10 @@ int PostParser::GetChar()
|
||||
{
|
||||
int c = FCGX_GetChar(in);
|
||||
|
||||
if( c != -1 && has_winix_raw_post_msg )
|
||||
raw_post += c;
|
||||
if( c != -1 && copy_raw_post )
|
||||
request->raw_post << static_cast<unsigned char>(c);
|
||||
|
||||
return c;
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
@@ -110,21 +102,13 @@ void PostParser::CreateLog(bool param_added, const std::wstring & name, const st
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PostParser::Parameter(std::wstring & name, std::wstring & value)
|
||||
{
|
||||
if( has_winix_post_params_msg )
|
||||
plugin->Call(WINIX_POST_PARAMS, &name, &value);
|
||||
|
||||
bool added = request->AddPostVar(name, value);
|
||||
CreateLog(added, name, value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace Winix
|
||||
|
||||
|
Reference in New Issue
Block a user