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