- added support for multiple client threads to ApiServer

- added api client which reads the password from stdin. This allows to login from the webinterface and from the terminal at the same time.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8103 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
electron128 2015-03-31 18:00:40 +00:00
parent 18e29c1e65
commit 73a6ca8af6
13 changed files with 884 additions and 461 deletions

View file

@ -8,7 +8,8 @@
// for filestreamer
#include <retroshare/rsfiles.h>
#include "api/JsonStream.h"
#include "JsonStream.h"
#include "ApiServer.h"
#if MHD_VERSION < 0x00090000
// very old version, probably v0.4.x on old debian/ubuntu
@ -327,8 +328,8 @@ static void sendMessage(MHD_Connection *connection, unsigned int status, std::st
MHD_destroy_response(resp);
}
ApiServerMHD::ApiServerMHD():
mConfigOk(false), mDaemon(0)
ApiServerMHD::ApiServerMHD(ApiServer *server):
mConfigOk(false), mDaemon(0), mApiServer(server)
{
}
@ -394,7 +395,7 @@ bool ApiServerMHD::start()
MHD_OPTION_END);
if(mDaemon)
{
std::cerr << "ApiServerMHD::start() SUCCESS. Started server on port " << ntohs(mListenAddr.sin_port) << ". Serving files from \"" << mRootDir << "\" at /" << std::endl;
std::cerr << "ApiServerMHD::start() SUCCESS. Started server on port " << ntohs(mListenAddr.sin_port) << ". Serving files from \"" << mRootDir << "\" at " << STATIC_FILES_ENTRY_PATH << std::endl;
return true;
}
else
@ -480,7 +481,7 @@ int ApiServerMHD::accessHandlerCallback(MHD_Connection *connection,
if(strstr(url, API_ENTRY_PATH) == url)
{
// create a new handler and store it in con_cls
MHDHandlerBase* handler = new MHDApiHandler(&mApiServer);
MHDHandlerBase* handler = new MHDApiHandler(mApiServer);
*con_cls = (void*) handler;
return handler->handleRequest(connection, url, method, version, upload_data, upload_data_size);
}