summaryrefslogtreecommitdiffabout
path: root/include/kingate/cgi_gateway.h
Unidiff
Diffstat (limited to 'include/kingate/cgi_gateway.h') (more/less context) (ignore whitespace changes)
-rw-r--r--include/kingate/cgi_gateway.h57
1 files changed, 54 insertions, 3 deletions
diff --git a/include/kingate/cgi_gateway.h b/include/kingate/cgi_gateway.h
index f20d72b..a26b0ae 100644
--- a/include/kingate/cgi_gateway.h
+++ b/include/kingate/cgi_gateway.h
@@ -43,6 +43,37 @@ namespace kingate {
43 */ 43 */
44 params_t post; 44 params_t post;
45 /** 45 /**
46 * Abstract base class for retrieving posted files.
47 */
48 class basic_file_t {
49 public:
50 /**
51 * Retrieve file name.
52 * @return filename
53 */
54 virtual const string& filename() const = 0;
55 /**
56 * Retrieve file content type.
57 * @return content type
58 */
59 virtual const string& content_type() const = 0;
60 /**
61 * Retrieve file contents.
62 * @return reference to the stream for accessing file content.
63 */
64 virtual istream& content() = 0;
65 virtual ~basic_file_t();
66 };
67 typedef basic_file_t *file_t;
68 /**
69 * The map holding information pertaining to files uploaded via post.
70 */
71 typedef multimap<string,file_t> files_t;
72 /**
73 * Files uploaded via post
74 */
75 files_t files;
76 /**
46 * Cookies passed. 77 * Cookies passed.
47 */ 78 */
48 cookies_t cookies; 79 cookies_t cookies;
@@ -54,7 +85,13 @@ namespace kingate {
54 /** 85 /**
55 * @param ci the interface to use. 86 * @param ci the interface to use.
56 */ 87 */
57 cgi_gateway(cgi_interface& ci); 88 cgi_gateway(cgi_interface& ci,bool parsebody = true);
89 virtual ~cgi_gateway() throw();
90
91 /**
92 * Parse request body.
93 */
94 void parse_request_body();
58 95
59 /** 96 /**
60 * Check whether there is an 'environment' meta-variable with specific name 97 * Check whether there is an 'environment' meta-variable with specific name
@@ -136,10 +173,24 @@ namespace kingate {
136 * Retrieve the parameter passed either via POST or GET 173 * Retrieve the parameter passed either via POST or GET
137 * (GET-parameter takes precedence). 174 * (GET-parameter takes precedence).
138 * @param n the parameter name. 175 * @param n the parameter name.
139 * @return true if yes. 176 * @return the parameter contents.
140 * @see exception_notfound. 177 * @see exception_notfound.
141 */ 178 */
142 const string& get_param(const string& n) const; 179 const string& get_param(const string& n) const;
180 /**
181 * Check to see whether the file was uploaded in the request body.
182 * @param n the parameter name.
183 * @return true if yes.
184 */
185 bool has_file(const string& n) const;
186 /**
187 * Retrieve the file uploaded in the request body.
188 * @param n the parameter name.
189 * @return the file.
190 * @see exception_notfound.
191 */
192 const file_t get_file(const string& n) const;
193 file_t get_file(const string& n);
143 194
144 /** 195 /**
145 * Retrieve the POST content-type (as passed via CONTENT_TYPE 196 * Retrieve the POST content-type (as passed via CONTENT_TYPE
@@ -177,7 +228,7 @@ namespace kingate {
177 * Retrieve the CONTENT_LENGTH meta-variable (see RFC3875) 228 * Retrieve the CONTENT_LENGTH meta-variable (see RFC3875)
178 * @return size of the request message body. 229 * @return size of the request message body.
179 */ 230 */
180 unsigned long cgi_gateway::content_length() const; 231 unsigned long content_length() const;
181 /** 232 /**
182 * Retrieve the CONTENT_TYPE meta-variable (see RFC3875) 233 * Retrieve the CONTENT_TYPE meta-variable (see RFC3875)
183 * @return media type of the request message body. 234 * @return media type of the request message body.