diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-03-26 21:17:19 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-03-26 21:17:19 (GMT) |
commit | 405c805f249cacb07f8861d5550abda8f6694d0c (patch) | |
tree | 669743f4b895c063296f0c6799fe698202d34893 /src/uscxml/server | |
parent | 79b8a7941354416f83aae9cb53fbdf7e680beae2 (diff) | |
download | uscxml-405c805f249cacb07f8861d5550abda8f6694d0c.zip uscxml-405c805f249cacb07f8861d5550abda8f6694d0c.tar.gz uscxml-405c805f249cacb07f8861d5550abda8f6694d0c.tar.bz2 |
Various smaller bug-fixes (see details)
- Pass -DPHP_CONFIG=/usr/bin/zts-php-config for custom php-config
- More php bug fixes
- Fixed nasty "parse from string" bug
- Reindented source code
Diffstat (limited to 'src/uscxml/server')
-rw-r--r-- | src/uscxml/server/HTTPServer.cpp | 6 | ||||
-rw-r--r-- | src/uscxml/server/HTTPServer.h | 4 | ||||
-rw-r--r-- | src/uscxml/server/InterpreterServlet.cpp | 12 | ||||
-rw-r--r-- | src/uscxml/server/InterpreterServlet.h | 11 |
4 files changed, 19 insertions, 14 deletions
diff --git a/src/uscxml/server/HTTPServer.cpp b/src/uscxml/server/HTTPServer.cpp index dd06ab7..0d5feee 100644 --- a/src/uscxml/server/HTTPServer.cpp +++ b/src/uscxml/server/HTTPServer.cpp @@ -218,7 +218,7 @@ void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackD request.data.compound["content"] = Data::fromJSON(request.data.compound["content"].atom); } } - + if (callbackData == NULL) { HTTPServer::getInstance()->processByMatchingServlet(request); } else { @@ -237,7 +237,7 @@ void HTTPServer::processByMatchingServlet(const Request& request) { // is the servlet path a prefix of the actual path? std::string servletPath = "/" + servletIter->first; if (boost::iequals(actualPath.substr(0, servletPath.length()), servletPath) && // actual path is a prefix - boost::iequals(actualPath.substr(servletPath.length(), 1), "/")) { // and next character is a '/' + boost::iequals(actualPath.substr(servletPath.length(), 1), "/")) { // and next character is a '/' if (bestPath.length() < servletPath.length()) { // this servlet is a better match bestPath = servletPath; @@ -307,7 +307,7 @@ bool HTTPServer::registerServlet(const std::string& path, HTTPServlet* servlet) if (boost::starts_with(actualPath, "/")) actualPath = actualPath.substr(1); std::string suffixedPath = actualPath; - + // if this servlet allows to adapt the path, do so int i = 2; while(INSTANCE->_servlets.find(suffixedPath) != INSTANCE->_servlets.end()) { diff --git a/src/uscxml/server/HTTPServer.h b/src/uscxml/server/HTTPServer.h index 990d0a7..7356737 100644 --- a/src/uscxml/server/HTTPServer.h +++ b/src/uscxml/server/HTTPServer.h @@ -83,7 +83,9 @@ private: class HTTPServlet { public: virtual void httpRecvRequest(const HTTPServer::Request& request) = 0; - virtual bool canAdaptPath() { return true; } + virtual bool canAdaptPath() { + return true; + } virtual void setURL(const std::string& url) = 0; /// Called by the server with the actual URL }; diff --git a/src/uscxml/server/InterpreterServlet.cpp b/src/uscxml/server/InterpreterServlet.cpp index fb8a6ef..e537275 100644 --- a/src/uscxml/server/InterpreterServlet.cpp +++ b/src/uscxml/server/InterpreterServlet.cpp @@ -2,10 +2,10 @@ #include "uscxml/Interpreter.h" namespace uscxml { - + InterpreterServlet::InterpreterServlet(Interpreter* interpreter) { _interpreter = interpreter; - + std::stringstream path; path << _interpreter->getName(); int i = 2; @@ -19,13 +19,13 @@ InterpreterServlet::InterpreterServlet(Interpreter* interpreter) { void InterpreterServlet::httpRecvRequest(const HTTPServer::Request& req) { tthread::lock_guard<tthread::recursive_mutex> lock(_mutex); - + // evhttp_request_own(req.curlReq); - + _requests[toStr((uintptr_t)req.curlReq)] = req; - + Event event = req; - + event.name = "http." + event.data.compound["type"].atom; event.origin = toStr((uintptr_t)req.curlReq); _interpreter->receive(event); diff --git a/src/uscxml/server/InterpreterServlet.h b/src/uscxml/server/InterpreterServlet.h index 7235466..72f2f67 100644 --- a/src/uscxml/server/InterpreterServlet.h +++ b/src/uscxml/server/InterpreterServlet.h @@ -6,10 +6,11 @@ namespace uscxml { class Interpreter; - + class InterpreterServlet : public HTTPServlet { public: InterpreterServlet(Interpreter* interpreter); + virtual ~InterpreterServlet() {} virtual void httpRecvRequest(const HTTPServer::Request& req); std::string getPath() { @@ -21,7 +22,9 @@ public: void setURL(const std::string& url) { _url = url; } - bool canAdaptPath() { return false; } + bool canAdaptPath() { + return false; + } std::map<std::string, HTTPServer::Request>& getRequests() { return _requests; @@ -32,14 +35,14 @@ public: protected: Interpreter* _interpreter; - + tthread::recursive_mutex _mutex; std::map<std::string, HTTPServer::Request> _requests; std::string _path; std::string _url; }; - + } |