summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cgi.cc6
-rw-r--r--src/cgi.hh2
2 files changed, 8 insertions, 0 deletions
diff --git a/src/cgi.cc b/src/cgi.cc
index 5f86aac..b2467f3 100644
--- a/src/cgi.cc
+++ b/src/cgi.cc
@@ -173,6 +173,12 @@ private:
} // namespace
+void CGI::get_data(std::map<std::string,std::string>* data) {
+ if (post_data(data)) return;
+ query_data(data);
+}
+
+
int CGI::run(std::function<bool(CGI*)> handle_request) {
#if HAVE_FASTCGI
if (!FCGX_IsCGI()) {
diff --git a/src/cgi.hh b/src/cgi.hh
index 5879694..1403719 100644
--- a/src/cgi.hh
+++ b/src/cgi.hh
@@ -24,6 +24,8 @@ public:
// 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;
+ // Will first try post_data and fallback to query_data
+ void get_data(std::map<std::string,std::string>* data);
virtual std::string request_path() = 0;
virtual request_type request_type() = 0;
virtual std::string content_type() = 0;