diff options
| author | Joel Klinghed <the_jk@yahoo.com> | 2015-05-28 21:14:52 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@yahoo.com> | 2015-05-28 21:16:14 +0200 |
| commit | 720295848ea0d909cb39c004cbeaf1055fa7cffc (patch) | |
| tree | 3a4c0332f8145986ddfc1c83e89b9cf8a1491546 /src/cgi.hh | |
| parent | 978bb2523f2eef42eca8dbe35e0ad351a4953aa7 (diff) | |
Start of CGI interface
Diffstat (limited to 'src/cgi.hh')
| -rw-r--r-- | src/cgi.hh | 42 |
1 files changed, 42 insertions, 0 deletions
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 <functional> +#include <map> +#include <string> +#include <vector> + +namespace stuff { + +class CGI { +public: + enum request_type { + GET, + HEAD, + POST, + PUT, + TRACE, + + UNKNOWN, + }; + + virtual void post_data(std::vector<char>* data) = 0; + // Return true if post data is multipart, false otherwise + virtual bool post_data(std::map<std::string,std::string>* data) = 0; + virtual void query_data(std::map<std::string,std::string>* 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<bool(CGI*)> handle_request); + +protected: + CGI() {} + virtual ~CGI() {} + CGI(const CGI&) = delete; + CGI& operator=(const CGI&) = delete; +}; + +} // namespace stuff + +#endif /* CGI_HH */ |
