summaryrefslogtreecommitdiffstats
path: root/src/client/HTTPClientReceiver.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-11-09 01:32:38 +0000
committerDavid Robillard <d@drobilla.net>2008-11-09 01:32:38 +0000
commit5d1f579900182f283a1c21ad4e59daf7f035e219 (patch)
treee73066002177cf48a31eef91712aa74839dfc555 /src/client/HTTPClientReceiver.cpp
parent23bb407a4f0db71eb15cbf8bbb8e82e02088a998 (diff)
downloadingen-5d1f579900182f283a1c21ad4e59daf7f035e219.tar.gz
ingen-5d1f579900182f283a1c21ad4e59daf7f035e219.tar.bz2
ingen-5d1f579900182f283a1c21ad4e59daf7f035e219.zip
Move patch to /patch via HTTP to give a place for RESTful access to other things.
Implement HTTP access to plugins. Work towards client being able to use HTTP to connect. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1712 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/client/HTTPClientReceiver.cpp')
-rw-r--r--src/client/HTTPClientReceiver.cpp45
1 files changed, 39 insertions, 6 deletions
diff --git a/src/client/HTTPClientReceiver.cpp b/src/client/HTTPClientReceiver.cpp
index 4773b7ce..5d4a8660 100644
--- a/src/client/HTTPClientReceiver.cpp
+++ b/src/client/HTTPClientReceiver.cpp
@@ -53,11 +53,35 @@ void
HTTPClientReceiver::message_callback(SoupSession* session, SoupMessage* msg, void* ptr)
{
HTTPClientReceiver* me = (HTTPClientReceiver*)ptr;
- cout << "RECEIVED ASYNC MESSAGE: " << msg->response_body->data << endl;
- me->_target->response_ok(0);
- me->_target->enable();
- me->_parser->parse_string(me->_world, me->_target.get(), Glib::ustring(msg->response_body->data),
- Glib::ustring("/"), Glib::ustring(""));
+ //cout << "RECEIVED ASYNC MESSAGE: " << msg->response_body->data << endl;
+ const string path = soup_message_get_uri(msg)->path;
+ if (path == "/") {
+ cout << "RECEIVED ROOT" << endl;
+ me->_target->response_ok(0);
+ me->_target->enable();
+ } else if (path == "/plugins") {
+ cout << "RECIEVED PLUGINS" << endl;
+ if (msg->response_body->data == NULL) {
+ cout << "NO RESPONSE?!" << endl;
+ } else {
+ me->_target->response_ok(0);
+ me->_target->enable();
+ me->_parser->parse_string(me->_world, me->_target.get(),
+ Glib::ustring(msg->response_body->data),
+ Glib::ustring("."), Glib::ustring(""));
+ }
+ } else if (path == "/patch") {
+ cout << "RECEIVED OBJECTS" << endl;
+ if (msg->response_body->data == NULL) {
+ cout << "NO RESPONSE?!" << endl;
+ } else {
+ me->_target->response_ok(0);
+ me->_target->enable();
+ me->_parser->parse_string(me->_world, me->_target.get(),
+ Glib::ustring(msg->response_body->data),
+ Glib::ustring("/patch/"), Glib::ustring(""));
+ }
+ }
}
@@ -75,8 +99,17 @@ HTTPClientReceiver::start(bool dump)
_parser = SharedPtr<Parser>(new_parser());
}
}
+
_session = soup_session_async_new();
- SoupMessage* msg = soup_message_new("GET", _url.c_str());
+ SoupMessage* msg;
+
+ msg = soup_message_new("GET", _url.c_str());
+ soup_session_queue_message (_session, msg, message_callback, this);
+
+ msg = soup_message_new("GET", (_url + "/plugins").c_str());
+ soup_session_queue_message (_session, msg, message_callback, this);
+
+ msg = soup_message_new("GET", (_url + "/patch").c_str());
soup_session_queue_message (_session, msg, message_callback, this);
}