winix/core/postparser.h

63 lines
979 B
C++
Executable File

/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfilecmslucorepostparser
#define headerfilecmslucorepostparser
#include <fcgiapp.h>
#include <string>
#include "httpsimpleparser.h"
#include "requesttypes.h"
class PostParser : public HttpSimpleParser
{
FCGX_Stream * in;
PostTab * post_tab;
protected:
virtual int GetChar()
{
return FCGX_GetChar(in);
}
virtual void Parameter(std::string & name, std::string & value)
{
std::pair<PostTab::iterator, bool> res = post_tab->insert( std::make_pair(name, value) );
log << log2 << "Method POST, name: \"" << name << "\", value: \"" << value << "\"";
if( res.second == false )
log << log2 << " (skipped)";
log << log2 << logend;
}
public:
void Parse(FCGX_Stream * in_, PostTab & post_tab_)
{
in = in_;
post_tab = &post_tab_;
HttpSimpleParser::Parse();
}
};
#endif