diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-04-20 19:28:50 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-04-20 19:28:50 (GMT) |
commit | c1ebae519210cd4d09eb63bde593d48e769ad7ca (patch) | |
tree | 488cfd8056c2e727a7b49882c2f3d46240d00998 /src/uscxml/server | |
parent | 26609f8b8097b21e952835e7064bc938c8542d93 (diff) | |
download | uscxml-c1ebae519210cd4d09eb63bde593d48e769ad7ca.zip uscxml-c1ebae519210cd4d09eb63bde593d48e769ad7ca.tar.gz uscxml-c1ebae519210cd4d09eb63bde593d48e769ad7ca.tar.bz2 |
Support for event.raw and more XPath datamodel refactorings
Diffstat (limited to 'src/uscxml/server')
-rw-r--r-- | src/uscxml/server/HTTPServer.cpp | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/uscxml/server/HTTPServer.cpp b/src/uscxml/server/HTTPServer.cpp index 0d5feee..70b272f 100644 --- a/src/uscxml/server/HTTPServer.cpp +++ b/src/uscxml/server/HTTPServer.cpp @@ -114,10 +114,14 @@ void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackD // evhttp_send_error(req, 404, NULL); // return; + std::stringstream raw; + evhttp_request_own(req); Request request; request.curlReq = req; + + switch (evhttp_request_get_command(req)) { case EVHTTP_REQ_GET: request.data.compound["type"] = Data("get", Data::VERBATIM); @@ -150,6 +154,18 @@ void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackD request.data.compound["type"] = Data("unknown", Data::VERBATIM); break; } + raw << boost::to_upper_copy(request.data.compound["type"].atom); + + request.data.compound["remoteHost"] = Data(req->remote_host, Data::VERBATIM); + request.data.compound["remotePort"] = Data(toStr(req->remote_port), Data::VERBATIM); + 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); + + raw << " " << request.data.compound["path"].atom; + raw << " HTTP/" << request.data.compound["httpMajor"].atom << "." << request.data.compound["httpMinor"].atom; + raw << std::endl; struct evkeyvalq *headers; struct evkeyval *header; @@ -159,14 +175,9 @@ void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackD headers = evhttp_request_get_input_headers(req); for (header = headers->tqh_first; header; header = header->next.tqe_next) { request.data.compound["header"].compound[header->key] = Data(header->value, Data::VERBATIM); + raw << header->key << ": " << header->value << std::endl; } - - request.data.compound["remoteHost"] = Data(req->remote_host, Data::VERBATIM); - request.data.compound["remotePort"] = Data(toStr(req->remote_port), Data::VERBATIM); - 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); + raw << std::endl; // This was used for debugging // if (boost::ends_with(request.data.compound["path"].atom, ".png")) { @@ -207,6 +218,8 @@ void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackD } } + raw << request.data.compound["content"].atom; + // decode content if (request.data.compound.find("content") != request.data.compound.end() && request.data.compound["header"].compound.find("Content-Type") != request.data.compound["header"].compound.end()) { @@ -219,6 +232,8 @@ void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackD } } + request.raw = raw.str(); + if (callbackData == NULL) { HTTPServer::getInstance()->processByMatchingServlet(request); } else { |