summaryrefslogtreecommitdiffstats
path: root/src/uscxml/server/HTTPServer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/uscxml/server/HTTPServer.cpp')
-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();
+ }
}
}