diff options
| author | Joel Klinghed <the_jk@yahoo.com> | 2015-06-03 00:08:30 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@yahoo.com> | 2015-06-03 00:08:30 +0200 |
| commit | 823dc403a9b56e00be4982d0082d30b8df5e53d6 (patch) | |
| tree | 7cceaf19fa709c5c9adcde4de4819581930321f2 | |
| parent | 0cbc7dd8dd00c92570f35f901b820a1ea96acdf0 (diff) | |
Add CGI::get_data utility method
| -rw-r--r-- | src/cgi.cc | 6 | ||||
| -rw-r--r-- | src/cgi.hh | 2 |
2 files changed, 8 insertions, 0 deletions
@@ -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()) { @@ -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; |
