summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/HTTPClientSender.cpp11
-rw-r--r--src/engine/HTTPEngineReceiver.cpp18
2 files changed, 18 insertions, 11 deletions
diff --git a/src/engine/HTTPClientSender.cpp b/src/engine/HTTPClientSender.cpp
index 6d91a2c0..83d09b97 100644
--- a/src/engine/HTTPClientSender.cpp
+++ b/src/engine/HTTPClientSender.cpp
@@ -53,13 +53,16 @@ HTTPClientSender::put(const URI& uri,
const Resource::Properties& properties,
Resource::Graph ctx)
{
- const string path = (uri.substr(0, 6) == "path:/") ? uri.substr(6) : uri.str();
- const string full_uri = _url + "/" + path;
+ const std::string request_uri = (Raul::Path::is_path(uri))
+ ? _url + "/patch" + uri.substr(uri.find("/"))
+ : uri.str();
+
Sord::Model model(*_engine.world()->rdf_world());
- for (Resource::Properties::const_iterator i = properties.begin(); i != properties.end(); ++i)
+ for (Resource::Properties::const_iterator i = properties.begin();
+ i != properties.end(); ++i)
model.add_statement(
- Sord::URI(*_engine.world()->rdf_world(), path),
+ Sord::URI(*_engine.world()->rdf_world(), request_uri),
AtomRDF::atom_to_node(model, i->first.str()),
AtomRDF::atom_to_node(model, i->second));
diff --git a/src/engine/HTTPEngineReceiver.cpp b/src/engine/HTTPEngineReceiver.cpp
index b0bf2f4d..910be584 100644
--- a/src/engine/HTTPEngineReceiver.cpp
+++ b/src/engine/HTTPEngineReceiver.cpp
@@ -89,24 +89,25 @@ HTTPEngineReceiver::message_callback(SoupServer* server,
SoupClientContext* client,
void* data)
{
- #if 0
HTTPEngineReceiver* me = (HTTPEngineReceiver*)data;
+ using namespace Ingen::Shared;
+
SharedPtr<Store> store = me->_engine.world()->store();
if (!store) {
- soup_message_set_status (msg, SOUP_STATUS_INTERNAL_SERVER_ERROR);
+ soup_message_set_status(msg, SOUP_STATUS_INTERNAL_SERVER_ERROR);
return;
}
string path = path_str;
- if (path[path.length()-1] == '/') {
+ if (path[path.length() - 1] == '/') {
path = path.substr(0, path.length()-1);
}
SharedPtr<Serialiser> serialiser = me->_engine.world()->serialiser();
- const string base_uri = "path:/";
- const char* mime_type = "text/plain";
+ const string base_uri = "path:/";
+ const char* mime_type = "text/plain";
// Special GET paths
if (msg->method == SOUP_METHOD_GET) {
@@ -121,6 +122,7 @@ HTTPEngineReceiver::message_callback(SoupServer* server,
} else if (msg->method == SOUP_METHOD_GET && path.substr(0, 8) == "/plugins") {
// FIXME: kludge
+ #if 0
me->get("ingen:plugins");
me->_receive_thread->whip();
@@ -131,10 +133,13 @@ HTTPEngineReceiver::message_callback(SoupServer* server,
const string r = serialiser->finish();
soup_message_set_status(msg, SOUP_STATUS_OK);
soup_message_set_response(msg, mime_type, SOUP_MEMORY_COPY, r.c_str(), r.length());
+ #endif
return;
} else if (path.substr(0, 6) == "/patch") {
path = '/' + path.substr(6);
+ if (path.substr(0, 2) == "//")
+ path = path.substr(1);
} else if (path.substr(0, 7) == "/stream") {
HTTPClientSender* client = new HTTPClientSender(me->_engine);
@@ -152,7 +157,7 @@ HTTPEngineReceiver::message_callback(SoupServer* server,
if (!Path::is_valid(path)) {
LOG(error) << "Bad HTTP path: " << path << endl;
- soup_message_set_status (msg, SOUP_STATUS_BAD_REQUEST);
+ soup_message_set_status(msg, SOUP_STATUS_BAD_REQUEST);
const string& err = (boost::format("Bad path: %1%") % path).str();
soup_message_set_response(msg, "text/plain", SOUP_MEMORY_COPY,
err.c_str(), err.length());
@@ -209,7 +214,6 @@ HTTPEngineReceiver::message_callback(SoupServer* server,
} else {
soup_message_set_status(msg, SOUP_STATUS_NOT_IMPLEMENTED);
}
- #endif
}
/** Override the semaphore driven _run method of QueuedEngineInterface