diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-10-30 16:19:07 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-10-30 16:19:07 (GMT) |
commit | a5ae3c459e098a904ee0092cffab3ec555161cdf (patch) | |
tree | 7e15569f0218a024b5ea3436d7fb966b63aed4d2 /src | |
parent | 3e3c9ff5c1d0f2432283d3380a3410406f84be26 (diff) | |
download | uscxml-a5ae3c459e098a904ee0092cffab3ec555161cdf.zip uscxml-a5ae3c459e098a904ee0092cffab3ec555161cdf.tar.gz uscxml-a5ae3c459e098a904ee0092cffab3ec555161cdf.tar.bz2 |
Process application/xml in http requests and try to fix layout of README.md
Diffstat (limited to 'src')
-rw-r--r-- | src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp | 2 | ||||
-rw-r--r-- | src/uscxml/server/HTTPServer.cpp | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp b/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp index 13c3e40..04cb143 100644 --- a/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp +++ b/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp @@ -199,7 +199,7 @@ void XHTMLInvoker::reply(const SendRequest& req, const HTTPServer::Request& long reply.headers["Content-Type"] = "application/json"; } else if (req.content.length() > 0) { reply.content = req.content; - reply.headers["Content-Type"] = "application/text"; + reply.headers["Content-Type"] = "text/plain"; } if (req.params.find("Content-Type") != req.params.end()) diff --git a/src/uscxml/server/HTTPServer.cpp b/src/uscxml/server/HTTPServer.cpp index efd49a5..15f347c 100644 --- a/src/uscxml/server/HTTPServer.cpp +++ b/src/uscxml/server/HTTPServer.cpp @@ -25,6 +25,7 @@ #endif #include "uscxml/server/HTTPServer.h" +#include "uscxml/NameSpacingParser.h" #include <string> #include <iostream> @@ -364,7 +365,7 @@ void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackD request.data.compound["header"].compound.find("Content-Type") != request.data.compound["header"].compound.end()) { std::string contentType = request.data.compound["header"].compound["Content-Type"].atom; if (false) { - } else if (iequals(contentType, "application/x-www-form-urlencoded")) { + } else if (iequals(contentType.substr(0, 33), "application/x-www-form-urlencoded")) { // this is a form submit std::stringstream ss(request.data.compound["content"].atom); std::string item; @@ -389,6 +390,13 @@ void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackD request.data.compound["content"].atom.clear(); } else if (iequals(contentType.substr(0, 16), "application/json")) { request.data.compound["content"] = Data::fromJSON(request.data.compound["content"].atom); + } else if (iequals(contentType.substr(0, 15), "application/xml")) { + NameSpacingParser parser = NameSpacingParser::fromXML(request.data.compound["content"].atom); + if (parser.errorsReported()) { + LOG(ERROR) << "Cannot parse contents of HTTP request as XML"; + } else { + request.data.compound["content"].node = parser.getDocument().getDocumentElement(); + } } } |