summaryrefslogtreecommitdiff
path: root/project2/cgi/cgiHttpHeader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'project2/cgi/cgiHttpHeader.cpp')
-rw-r--r--project2/cgi/cgiHttpHeader.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/project2/cgi/cgiHttpHeader.cpp b/project2/cgi/cgiHttpHeader.cpp
new file mode 100644
index 0000000..37a48c9
--- /dev/null
+++ b/project2/cgi/cgiHttpHeader.cpp
@@ -0,0 +1,29 @@
+#include "cgiHttpHeader.h"
+#include <boost/foreach.hpp>
+
+Project2HttpHeader::Project2HttpHeader(const std::string & s, const std::string & t) :
+ cgicc::HTTPHeader("")
+{
+ addHeader("Status", s);
+ addHeader("Content-Type", t);
+}
+
+void
+Project2HttpHeader::addHeader(const std::string & name, const Glib::ustring & value)
+{
+ headers.erase(name);
+ headers.insert(Headers::value_type(name, value));
+}
+
+void
+Project2HttpHeader::render(std::ostream & out) const
+{
+ BOOST_FOREACH(const Headers::value_type & h, headers) {
+ out << h.first << ": " << h.second << std::endl;
+ }
+ BOOST_FOREACH(const cgicc::HTTPCookie & cookie, getCookies()) {
+ out << cookie << std::endl;
+ }
+ out << std::endl;
+}
+