From 720295848ea0d909cb39c004cbeaf1055fa7cffc Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Thu, 28 May 2015 21:14:52 +0200 Subject: Start of CGI interface --- src/cgi.hh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/cgi.hh (limited to 'src/cgi.hh') diff --git a/src/cgi.hh b/src/cgi.hh new file mode 100644 index 0000000..5879694 --- /dev/null +++ b/src/cgi.hh @@ -0,0 +1,42 @@ +#ifndef CGI_HH +#define CGI_HH + +#include +#include +#include +#include + +namespace stuff { + +class CGI { +public: + enum request_type { + GET, + HEAD, + POST, + PUT, + TRACE, + + UNKNOWN, + }; + + virtual void post_data(std::vector* data) = 0; + // Return true if post data is multipart, false otherwise + virtual bool post_data(std::map* data) = 0; + virtual void query_data(std::map* data) = 0; + virtual std::string request_path() = 0; + virtual request_type request_type() = 0; + virtual std::string content_type() = 0; + + static int run(std::function handle_request); + +protected: + CGI() {} + virtual ~CGI() {} + CGI(const CGI&) = delete; + CGI& operator=(const CGI&) = delete; +}; + +} // namespace stuff + +#endif /* CGI_HH */ -- cgit v1.2.3-70-g09d2