summaryrefslogtreecommitdiff
path: root/rotord/rotord.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rotord/rotord.cpp')
-rwxr-xr-xrotord/rotord.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/rotord/rotord.cpp b/rotord/rotord.cpp
index b69ea4a..f0bcc0d 100755
--- a/rotord/rotord.cpp
+++ b/rotord/rotord.cpp
@@ -104,6 +104,11 @@ HTTPRequestHandler* RotorRequestHandlerFactory::createRequestHandler(const HTTPS
string content="";
HTTPResponse::HTTPStatus status=HTTPResponse::HTTP_BAD_REQUEST; //by default
+
+ std::string body;
+ std::ostringstream os;
+ os<<request.stream().rdbuf();
+ body=os.str();
/*
@@ -155,6 +160,15 @@ HTTPRequestHandler* RotorRequestHandlerFactory::createRequestHandler(const HTTPS
content="<sID>"+sID+"</sID>\n";
status=HTTPResponse::HTTP_OK;
}
+ if (request.getMethod()=="PUT") { //undocumented manual thread name
+ if (body.size()) {
+ string sID=body;
+ cerr << "Rotor: starting thread "<< sID << endl;
+ manager.start(new Rotor::Render_context(sID));
+ content="<sID>"+sID+"</sID>\n";
+ status=HTTPResponse::HTTP_OK;
+ }
+ }
}
else if (command[0]=="list") {
if (request.getMethod()=="GET") {
@@ -218,17 +232,14 @@ HTTPRequestHandler* RotorRequestHandlerFactory::createRequestHandler(const HTTPS
//some commands need to return error codes
//ie where the audio file isn't found
//on the other hand, some commands need to know state of the renderer?
- std::string s;
- std::ostringstream os;
- os<<request.stream().rdbuf();
- s=os.str();
+
vector<string> sc; //method,id,command1,{command2,}{body}
sc.push_back(request.getMethod());
for (auto& i: command){
sc.push_back(i);
}
- sc.push_back(s);
+ sc.push_back(body);
Rotor::Command_response response=((Poco::AutoPtr<Rotor::Render_context>)task)->session_command(sc);