summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md36
-rw-r--r--src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp2
-rw-r--r--src/uscxml/server/HTTPServer.cpp10
3 files changed, 28 insertions, 20 deletions
diff --git a/README.md b/README.md
index 08bd3ff..1dbe133 100644
--- a/README.md
+++ b/README.md
@@ -6,28 +6,28 @@ It runs on <b>Linux</b>, <b>Windows</b> and <b>MacOSX</b>, each 32- as well as 6
There are still a few rough edges though, especially with the plugins and custom extensions.
* <b>Datamodels</b>
- * Full [ECMAScript datamodel](https://github.com/tklab-tud/uscxml/tree/master/src/uscxml/plugins/datamodel/ecmascript) using Google's v8 (and JavaScriptCore on MacOSX and iOS)
- * Simplified support for [Web Storage](http://www.w3.org/TR/2013/REC-webstorage-20130730/) in document.localStorage
- * Support for binary data via [TypedArrays](https://www.khronos.org/registry/typedarray/specs/latest/) (will not throw exceptions yet)
- * Full [NULL datamodel](https://github.com/tklab-tud/uscxml/tree/master/src/uscxml/plugins/datamodel/null) with required <tt>In</tt> predicate
- * Early [Prolog datamodel](https://github.com/tklab-tud/uscxml/tree/master/src/uscxml/plugins/datamodel/prolog/swi) using SWI prolog
- * Rudimentary support for [XPath datamodel](https://github.com/tklab-tud/uscxml/tree/master/src/uscxml/plugins/datamodel/xpath)
+ * Full [ECMAScript datamodel](https://github.com/tklab-tud/uscxml/tree/master/src/uscxml/plugins/datamodel/ecmascript) using Google's v8 (and JavaScriptCore on MacOSX and iOS)
+ * Simplified support for [Web Storage](http://www.w3.org/TR/2013/REC-webstorage-20130730/) in document.localStorage
+ * Support for binary data via [TypedArrays](https://www.khronos.org/registry/typedarray/specs/latest/) (will not throw exceptions yet)
+ * Full [NULL datamodel](https://github.com/tklab-tud/uscxml/tree/master/src/uscxml/plugins/datamodel/null) with required <tt>In</tt> predicate
+ * Early [Prolog datamodel](https://github.com/tklab-tud/uscxml/tree/master/src/uscxml/plugins/datamodel/prolog/swi) using SWI prolog
+ * Rudimentary support for [XPath datamodel](https://github.com/tklab-tud/uscxml/tree/master/src/uscxml/plugins/datamodel/xpath)
* <b>Invokers</b>
- * <tt>scxml</tt>: Invoke a nested scxml interpreter
- * <tt>dirmon</tt>: Watches a directory for changes to files
- * <tt>scenegraph</tt>: Simplified 3D scenegraphs with custom markup
- * <tt>heartbeat</tt>: Periodically sends events
- * <tt>umundo</tt>: Subscribe to channels and publish events
+ * <tt>scxml</tt>: Invoke a nested scxml interpreter
+ * <tt>dirmon</tt>: Watches a directory for changes to files
+ * <tt>scenegraph</tt>: Simplified 3D scenegraphs with custom markup
+ * <tt>heartbeat</tt>: Periodically sends events
+ * <tt>umundo</tt>: Subscribe to channels and publish events
* <b>DOM</b>
- * DOM Core Level 2 + XPath extensions available for ecmascript datamodel
- * Namespace aware to embed custom markup for special invokers
+ * DOM Core Level 2 + XPath extensions available for ecmascript datamodel
+ * Namespace aware to embed custom markup for special invokers
* <b>Communication</b>
- * Features the standard basichttp io-processor
- * Features the required SCXML io-processor
- * <b>No</b> DOM io-processor
- * Can actually respond to HTTP requests with data via &lt;response>
+ * Features the standard basichttp io-processor
+ * Features the required SCXML io-processor
+ * <b>No</b> DOM io-processor
+ * Can actually respond to HTTP requests with data via &lt;response>
* <b>Language Bindings</b>
- * PHP module for apache and cli interpreter
+ * PHP module for apache and cli interpreter
## Test Reports
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();
+ }
}
}