summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2011-03-08 15:13:42 +0000
committerrandomdan <randomdan@localhost>2011-03-08 15:13:42 +0000
commit540362304c7af2c9e48f496aa6a153672481b7f3 (patch)
tree6b31a88b6e340b7195b4961772c3b46dfbd8e74f
parentSplit appData and envData (diff)
downloadproject2-540362304c7af2c9e48f496aa6a153672481b7f3.tar.bz2
project2-540362304c7af2c9e48f496aa6a153672481b7f3.tar.xz
project2-540362304c7af2c9e48f496aa6a153672481b7f3.zip
Don't shoehorn our HTTP response into a cgicc::status one, just implement ourself
-rw-r--r--project2/cgi/cgiAppEngine.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/project2/cgi/cgiAppEngine.cpp b/project2/cgi/cgiAppEngine.cpp
index e8c23e5..7df0279 100644
--- a/project2/cgi/cgiAppEngine.cpp
+++ b/project2/cgi/cgiAppEngine.cpp
@@ -1,6 +1,6 @@
#include "cgiAppEngine.h"
#include <cgicc/Cgicc.h>
-#include <cgicc/HTTPStatusHeader.h>
+#include <cgicc/HTTPHeader.h>
#include "cgiEnvironment.h"
#include "../xmlObjectLoader.h"
#include "../iterate.h"
@@ -20,12 +20,13 @@ SessionContainer * sessionsContainer = new SessionContainerXml();
SimpleMessageException(UnknownDomain);
-class Project2HttpHeader : public cgicc::HTTPStatusHeader {
+class Project2HttpHeader : public cgicc::HTTPHeader {
public:
typedef std::map<std::string, const Glib::ustring> Headers;
- Project2HttpHeader(int c, const std::string & m, const std::string & t) :
- cgicc::HTTPStatusHeader(c, m)
+ Project2HttpHeader(const std::string & s, const std::string & t) :
+ cgicc::HTTPHeader("")
{
+ addHeader("Status", s);
addHeader("Content-Type", t);
}
void addHeader(const std::string & name, const Glib::ustring & value) {
@@ -36,7 +37,10 @@ class Project2HttpHeader : public cgicc::HTTPStatusHeader {
BOOST_FOREACH(const Headers::value_type & h, headers) {
out << h.first << ": " << h.second << std::endl;
}
- cgicc::HTTPStatusHeader::render(out);
+ BOOST_FOREACH(const cgicc::HTTPCookie & cookie, getCookies()) {
+ out << cookie << std::endl;
+ }
+ out << std::endl;
}
private:
Headers headers;
@@ -160,7 +164,7 @@ CgiApplicationEngine::PresentStage::run()
CgiApplicationEngine::HttpHeaderPtr
CgiApplicationEngine::PresentStage::getHeader() const
{
- Project2HttpHeader * header = new Project2HttpHeader(200, "OK", contentType);
+ Project2HttpHeader * header = new Project2HttpHeader("200 OK", contentType);
header->addHeader("Cache-control", "no-cache");
return HttpHeaderPtr(header);
}
@@ -255,7 +259,7 @@ CgiApplicationEngine::RequestStage::run()
CgiApplicationEngine::HttpHeaderPtr
CgiApplicationEngine::RequestStage::getHeader() const
{
- return HttpHeaderPtr(new Project2HttpHeader(200, "OK", "text/xml"));
+ return HttpHeaderPtr(new Project2HttpHeader("200 OK", "text/xml"));
}
CgiApplicationEngine::XmlDocPtr
@@ -341,7 +345,7 @@ CgiApplicationEngine::NotFoundStage::~NotFoundStage()
CgiApplicationEngine::HttpHeaderPtr
CgiApplicationEngine::NotFoundStage::getHeader() const
{
- return HttpHeaderPtr(new Project2HttpHeader(404, "Not found", env->errorContentType));
+ return HttpHeaderPtr(new Project2HttpHeader("404 Not found", env->errorContentType));
}
const Glib::ustring CgiApplicationEngine::NotFoundStage::resp("notfound");
@@ -375,7 +379,7 @@ CgiApplicationEngine::ErrorStage::~ErrorStage()
CgiApplicationEngine::HttpHeaderPtr
CgiApplicationEngine::ErrorStage::getHeader() const
{
- return HttpHeaderPtr(new Project2HttpHeader(500, "Internal Server Error", env->errorContentType));
+ return HttpHeaderPtr(new Project2HttpHeader("500 Internal Server Error", env->errorContentType));
}
const Glib::ustring CgiApplicationEngine::ErrorStage::resp("error");