summaryrefslogtreecommitdiffabout
path: root/lib/sitecing_interface_cgi.cc
authorMichael Krelin <hacker@klever.net>2005-01-29 21:21:05 (UTC)
committer Michael Krelin <hacker@klever.net>2005-01-29 21:21:05 (UTC)
commitce1f37aae46ea95020d7b865f7a80e8abdfad0d8 (patch) (side-by-side diff)
tree4964383ab8cd7e6d8ea821f1a615d1bbcf98dad8 /lib/sitecing_interface_cgi.cc
parent3c75c860fc1ad5b3f5185e23ec6f438dd2528958 (diff)
downloadsitecing-ce1f37aae46ea95020d7b865f7a80e8abdfad0d8.zip
sitecing-ce1f37aae46ea95020d7b865f7a80e8abdfad0d8.tar.gz
sitecing-ce1f37aae46ea95020d7b865f7a80e8abdfad0d8.tar.bz2
initial commit into repository0.0
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();
+ }
+
+}