summaryrefslogtreecommitdiffstats
path: root/src/uscxml/server
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-09-23 16:30:04 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-09-23 16:30:04 (GMT)
commitbe3c180fec71866a91b5f9297708d581bc1d6435 (patch)
tree830acee295b8456d1e629a0db6c3734f629074a3 /src/uscxml/server
parent8dde1311719b29c63efb379566916cb1aa9a7cd7 (diff)
downloaduscxml-be3c180fec71866a91b5f9297708d581bc1d6435.zip
uscxml-be3c180fec71866a91b5f9297708d581bc1d6435.tar.gz
uscxml-be3c180fec71866a91b5f9297708d581bc1d6435.tar.bz2
Added instant messaging invoker
Diffstat (limited to 'src/uscxml/server')
-rw-r--r--src/uscxml/server/HTTPServer.cpp31
-rw-r--r--src/uscxml/server/HTTPServer.h1
2 files changed, 4 insertions, 28 deletions
diff --git a/src/uscxml/server/HTTPServer.cpp b/src/uscxml/server/HTTPServer.cpp
index 0521d74..8799fc2 100644
--- a/src/uscxml/server/HTTPServer.cpp
+++ b/src/uscxml/server/HTTPServer.cpp
@@ -71,7 +71,6 @@ HTTPServer::~HTTPServer() {
HTTPServer* HTTPServer::_instance = NULL;
tthread::recursive_mutex HTTPServer::_instanceMutex;
-std::map<std::string, std::string> HTTPServer::mimeTypes;
HTTPServer* HTTPServer::getInstance(int port) {
// tthread::lock_guard<tthread::recursive_mutex> lock(_instanceMutex);
@@ -80,25 +79,6 @@ HTTPServer* HTTPServer::getInstance(int port) {
WSADATA wsaData;
WSAStartup(MAKEWORD(2, 2), &wsaData);
#endif
- // this is but a tiny list, supply a content-type <header> yourself
- mimeTypes["txt"] = "text/plain";
- mimeTypes["c"] = "text/plain";
- mimeTypes["h"] = "text/plain";
- mimeTypes["html"] = "text/html";
- mimeTypes["htm"] = "text/htm";
- mimeTypes["css"] = "text/css";
- mimeTypes["bmp"] = "image/bmp";
- mimeTypes["gif"] = "image/gif";
- mimeTypes["jpg"] = "image/jpeg";
- mimeTypes["jpeg"] = "image/jpeg";
- mimeTypes["mpg"] = "video/mpeg";
- mimeTypes["mov"] = "video/quicktime";
- mimeTypes["png"] = "image/png";
- mimeTypes["pdf"] = "application/pdf";
- mimeTypes["ps"] = "application/postscript";
- mimeTypes["tif"] = "image/tiff";
- mimeTypes["tiff"] = "image/tiff";
-
#ifndef _WIN32
evthread_use_pthreads();
#else
@@ -110,12 +90,6 @@ HTTPServer* HTTPServer::getInstance(int port) {
return _instance;
}
-std::string HTTPServer::mimeTypeForExtension(const std::string& ext) {
- if (mimeTypes.find(ext) != mimeTypes.end())
- return mimeTypes[ext];
- return "";
-}
-
/**
* This callback is registered for all HTTP requests
*/
@@ -165,7 +139,10 @@ void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackD
request.data.compound["httpMajor"] = Data(toStr((unsigned short)req->major), Data::VERBATIM);
request.data.compound["httpMinor"] = Data(toStr((unsigned short)req->minor), Data::VERBATIM);
request.data.compound["uri"] = Data(HTTPServer::getBaseURL() + req->uri, Data::VERBATIM);
- request.data.compound["path"] = Data(evhttp_uri_get_path(evhttp_request_get_evhttp_uri(req)), Data::VERBATIM);
+
+ char* pathCStr = evhttp_decode_uri(evhttp_uri_get_path(evhttp_request_get_evhttp_uri(req)));
+ request.data.compound["path"] = Data(pathCStr, Data::VERBATIM);
+ free(pathCStr);
raw << " " << request.data.compound["path"].atom;
const char* query = evhttp_uri_get_query(evhttp_request_get_evhttp_uri(req));
diff --git a/src/uscxml/server/HTTPServer.h b/src/uscxml/server/HTTPServer.h
index d216d5e..3e0d91c 100644
--- a/src/uscxml/server/HTTPServer.h
+++ b/src/uscxml/server/HTTPServer.h
@@ -45,7 +45,6 @@ public:
static std::string getBaseURL();
static void reply(const Reply& reply);
- static std::string mimeTypeForExtension(const std::string& ext);
static bool registerServlet(const std::string& path, HTTPServlet* servlet); ///< Register a servlet, returns false if path is already taken
static void unregisterServlet(HTTPServlet* servlet);