summaryrefslogtreecommitdiffabout
path: root/lib/sitecing_interface_cgi.cc
Side-by-side diff
Diffstat (limited to 'lib/sitecing_interface_cgi.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--lib/sitecing_interface_cgi.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/sitecing_interface_cgi.cc b/lib/sitecing_interface_cgi.cc
new file mode 100644
index 0000000..5c3d295
--- a/dev/null
+++ b/lib/sitecing_interface_cgi.cc
@@ -0,0 +1,25 @@
+#include <cassert>
+#include "sitecing/sitecing_interface_cgi.h"
+
+namespace sitecing {
+
+ sitecing_interface_cgi::sitecing_interface_cgi(sitespace *s)
+ : sitecing_interface(&prebuffer), ss(s), cgigw(NULL) {
+ }
+
+ void sitecing_interface_cgi::prepare(kingate::cgi_gateway *cg) {
+ cgigw = cg;
+ headers.clear();
+ headers["Content-Type"] = "text/html";
+ prebuffer.str("");
+ }
+
+ void sitecing_interface_cgi::flush() {
+ assert(cgigw);
+ for(headers_t::const_iterator i=headers.begin();i!=headers.end();i++)
+ cgigw->out() << i->first << ": " << i->second << "\n";
+ (cgigw->out() << "\n").write(prebuffer.str().c_str(),prebuffer.tellp());
+ cgigw->out().flush();
+ }
+
+}