#ifndef _ipagehandler_\r
#define _ipagehandler_\r
\r
-#include <shttpd.h>\r
+#include <cstdlib>\r
#include <string>\r
#include <map>\r
+#include <vector>\r
+#include <shttpd.h>\r
\r
class IPageHandler\r
{\r
public:\r
+ IPageHandler() {}\r
+ IPageHandler(const std::string &templatestr) { m_template=templatestr; }\r
+ virtual ~IPageHandler() {}\r
\r
/**\r
\brief Handles request for a page\r
const bool Handle(shttpd_arg *arg);\r
\r
private:\r
- void HandlePost(shttpd_arg *arg);\r
- void HadleGet(shttpd_arg *arg);\r
virtual const bool WillHandleURI(const std::string &uri)=0;\r
virtual const std::string GeneratePage(const std::string &method, const std::map<std::string,std::string> &queryvars)=0;\r
\r
+protected:\r
+ // splits apart data into name,data pairs in args map\r
+ void HandleMultiPartData(const std::string &contenttypeheader, char *data, const long datalen, std::map<std::string,std::string> &args);\r
+ // converts from basename[#] query args into a vector where the vector pos is the index pos #\r
+ void CreateArgArray(const std::map<std::string,std::string> &vars, const std::string &basename, std::vector<std::string> &args);\r
+\r
+ // replaces html control characters with elements (i.e. < becomes <)\r
+ const std::string SanitizeOutput(const std::string &input);\r
+\r
+ std::string m_template;\r
+\r
};\r
\r
#endif // _ipagehandler_\r