#ifndef __FO_WEBREQUEST_H__
#define __FO_WEBREQUEST_H__

#include "socket.h"
#include <string>
#include <map>

typedef struct {
	std::string key;
	std::string value;
} reqparam;

class FoWebRequest {
public:
	FoWebRequest();
	BOOL GetRequest( SOCKET sock );
	
	std::map<std::string,std::string> headers;
	std::map<std::string,std::string> getvars;
	std::map<std::string,std::string> postvars;
	std::map<std::string,std::string> cookies;

	void SetDefaultResponseHeaders( void );	
	BOOL PutResponse( SOCKET sock );
	std::string response_status;
	std::map<std::string,std::string> response_headers;
	std::string response_string;
	

protected:
	BOOL ProcessRequest( std::string req );
	BOOL ProcessHeaderRow( std::string req );
	BOOL ProcessUri( std::string uri );
	BOOL ProcessPost( SOCKET sock );
	reqparam ProcessParam( std::string param );
	std::map<std::string,std::string> ProcessReqParams( std::string paramstring );

	BOOL is_post;
	unsigned int post_size;
	std::string req_uri;
};
#endif
