summaryrefslogtreecommitdiff
path: root/server/src/admin_connection.cc
diff options
context:
space:
mode:
authordeva <deva>2011-02-07 08:59:39 +0000
committerdeva <deva>2011-02-07 08:59:39 +0000
commit1f3b20415c59ce08479d9291b92bbe5ffa8b2f6c (patch)
tree3d6d5dd808c4ca377c8acc329cbfd46526fe1a02 /server/src/admin_connection.cc
parent24e34e58b58474c845d8cd1f7dec974961d66365 (diff)
Added resource handler.
Diffstat (limited to 'server/src/admin_connection.cc')
-rw-r--r--server/src/admin_connection.cc19
1 files changed, 17 insertions, 2 deletions
diff --git a/server/src/admin_connection.cc b/server/src/admin_connection.cc
index 32cc67e..21fe331 100644
--- a/server/src/admin_connection.cc
+++ b/server/src/admin_connection.cc
@@ -27,6 +27,8 @@
*/
#include "admin_connection.h"
+#include "admin_rc.h"
+
#include "debug.h"
static std::string admin_sessionunlock(Environment &env, std::string id)
@@ -44,6 +46,11 @@ static std::string admin_sessionunlock(Environment &env, std::string id)
return "Session " + id + " does not exist or has been committed.";
}
+static std::string admin_favicon()
+{
+ return admin_rc("favicon");
+}
+
AdminConnection::AdminConnection(Environment &e, headers_t a, std::string u)
: env(e), args(a), uri(u) {}
@@ -52,13 +59,20 @@ AdminConnection::~AdminConnection() {}
bool AdminConnection::handle(const char *data, size_t size)
{
if(data == NULL && size == 0) {
+ DEBUG(admin, "URI: %s\n", uri.c_str());
+
if(uri == "/sessionunlock" && args.find("id") != args.end()) {
reply = admin_sessionunlock(env, args["id"]);
return true;
}
- reply = "Try something else...";
- return false;
+ if(uri == "/favicon.ico") {
+ reply = admin_favicon();
+ return true;
+ }
+
+ reply = "'" + uri + "' not recognised as a valid command.";
+ return true;
}
return true;
@@ -72,6 +86,7 @@ std::string AdminConnection::getResponse()
headers_t AdminConnection::getHeaders()
{
headers_t hdrs;
+ hdrs["Content-Type"] = "text/plain; charset=UTF-8";
return hdrs;
}