Diffstat (limited to 'lib/sitecing_interface_cgi.cc') (more/less context) (ignore whitespace changes)
-rw-r--r-- | lib/sitecing_interface_cgi.cc | 25 |
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 @@ | |||
1 | #include <cassert> | ||
2 | #include "sitecing/sitecing_interface_cgi.h" | ||
3 | |||
4 | namespace sitecing { | ||
5 | |||
6 | sitecing_interface_cgi::sitecing_interface_cgi(sitespace *s) | ||
7 | : sitecing_interface(&prebuffer), ss(s), cgigw(NULL) { | ||
8 | } | ||
9 | |||
10 | void sitecing_interface_cgi::prepare(kingate::cgi_gateway *cg) { | ||
11 | cgigw = cg; | ||
12 | headers.clear(); | ||
13 | headers["Content-Type"] = "text/html"; | ||
14 | prebuffer.str(""); | ||
15 | } | ||
16 | |||
17 | void sitecing_interface_cgi::flush() { | ||
18 | assert(cgigw); | ||
19 | for(headers_t::const_iterator i=headers.begin();i!=headers.end();i++) | ||
20 | cgigw->out() << i->first << ": " << i->second << "\n"; | ||
21 | (cgigw->out() << "\n").write(prebuffer.str().c_str(),prebuffer.tellp()); | ||
22 | cgigw->out().flush(); | ||
23 | } | ||
24 | |||
25 | } | ||