summaryrefslogtreecommitdiffstats
path: root/src/uscxml/server
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-10-30 16:19:07 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-10-30 16:19:07 (GMT)
commita5ae3c459e098a904ee0092cffab3ec555161cdf (patch)
tree7e15569f0218a024b5ea3436d7fb966b63aed4d2 /src/uscxml/server
parent3e3c9ff5c1d0f2432283d3380a3410406f84be26 (diff)
downloaduscxml-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/uscxml/server')
-rw-r--r--src/uscxml/server/HTTPServer.cpp10
1 files changed, 9 insertions, 1 deletions
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();
+ }
}
}