summaryrefslogtreecommitdiff
path: root/src/HttpServer.cc
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-12-08 08:20:07 -0800
committerPixel <pixel@nobis-crew.org>2011-12-08 08:21:09 -0800
commit69efca1a157245b35cd80a09718f45b30412dcea (patch)
treee4559bdbefc4d76b3b2c6b411c45f2073f3b6e5e /src/HttpServer.cc
parentaec08e7e3a8cf646463d45f61d2e546d3223aa3c (diff)
Moving the HTTP status messages out of the HTTP server, and into its own file. Also making it complete.
Diffstat (limited to 'src/HttpServer.cc')
-rw-r--r--src/HttpServer.cc20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/HttpServer.cc b/src/HttpServer.cc
index ee6919b..1268c7b 100644
--- a/src/HttpServer.cc
+++ b/src/HttpServer.cc
@@ -176,25 +176,11 @@ void Balau::HttpWorker::readVariables(Http::StringMap & variables, char * str) {
} while (ampPos);
}
-static const char * getErrorMsg(int httpError) {
- switch (httpError) {
- case 400:
- return "Bad Request";
- case 403:
- return "Forbidden";
- case 404:
- return "Not Found";
- case 405:
- return "Method Not Allowed";
- case 500:
- default:
- return "Internal Error";
- }
-}
-
void Balau::HttpWorker::sendError(int error, const char * msg, const char * details, bool closeConnection, std::vector<String> extraHeaders, std::vector<String> trace) {
SimpleMustache * tpl = &m_errorTemplate;
- const char * errorMsg = getErrorMsg(error);
+ const char * errorMsg = Http::getStatusMsg(error);
+ if (!errorMsg)
+ errorMsg = "Unknown Status";
Printer::elog(Balau::E_HTTPSERVER, "%s caused a %i error (%s)", m_name.to_charp(), error, errorMsg);
SimpleMustache::Context ctx;
String title;