summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/config.cpp1
-rw-r--r--common/setup.cpp5
-rw-r--r--include/config.h2
-rw-r--r--include/setup.h1
-rw-r--r--include/webserver.h1
-rw-r--r--server/server.cpp3
-rw-r--r--server/webserver.cpp6
7 files changed, 19 insertions, 0 deletions
diff --git a/common/config.cpp b/common/config.cpp
index 1c9d0d3..31199a2 100644
--- a/common/config.cpp
+++ b/common/config.cpp
@@ -16,6 +16,7 @@ upnp::cConfig::cConfig()
: enabled(true)
, expertSettings(false)
, webServerPort(0)
+, maxRequestTime(300)
, presentationURL("index.html")
, useLive(false)
, livePort(8008)
diff --git a/common/setup.cpp b/common/setup.cpp
index 52b4600..f3baf76 100644
--- a/common/setup.cpp
+++ b/common/setup.cpp
@@ -36,6 +36,7 @@ void cMenuSetupUPnP::Update(){
Add(new cMenuEditStrItem(tr("Webserver root directory"), webserverRoot, STRING_SIZE));
Add(new cMenuEditIntItem(tr("Webserver port (0=auto)"), &wsport, 0, 65536));
+ Add(new cMenuEditIntItem(tr("Max. request time in seconds (0=auto)"), &wsport, 0, 3600));
Add(new cMenuEditStrItem(tr("Presentation URL"), presentationUrl, STRING_SIZE));
@@ -128,6 +129,7 @@ void cMenuSetupUPnP::Load(){
switchLive = config.useLive;
interfaceIndex = GetIndexOfInterface(config.interface);
wsport = config.webServerPort;
+ mRTime = config.maxRequestTime;
upnpport = config.port;
lvport = config.livePort;
@@ -150,6 +152,7 @@ void cMenuSetupUPnP::Store(){
config.bindToAddress = switchBindAddress?true:false;
config.webServerPort = wsport;
+ config.maxRequestTime = mRTime;
config.port = upnpport;
config.useLive = switchLive?true:false;
@@ -161,6 +164,7 @@ void cMenuSetupUPnP::Store(){
SetupStore("expertSettings", config.expertSettings);
SetupStore("webServerRoot", config.webServerRoot.c_str());
SetupStore("webServerPort", config.webServerPort);
+ SetupStore("maxRequestTime", config.maxRequestTime);
SetupStore("presentationURL", config.presentationURL.c_str());
SetupStore("useLive", config.useLive);
SetupStore("livePort", config.livePort);
@@ -188,6 +192,7 @@ bool cMenuSetupUPnP::SetupParse(const char *name, const char *value, upnp::cConf
else if (strcasecmp(name, "expertSettings")==0) config.expertSettings = atoi(value)?true:false;
else if (strcasecmp(name, "webServerRoot")==0) config.webServerRoot = value;
else if (strcasecmp(name, "webServerPort")==0) config.webServerPort = (uint16_t)atoi(value);
+ else if (strcasecmp(name, "maxRequestTime")==0) config.maxRequestTime = (uint16_t)atoi(value);
else if (strcasecmp(name, "presentationURL")==0) config.presentationURL = value;
else if (strcasecmp(name, "useLive")==0) config.useLive = atoi(value)?true:false;
else if (strcasecmp(name, "livePort")==0) config.livePort = atoi(value);
diff --git a/include/config.h b/include/config.h
index f36491c..faf6e02 100644
--- a/include/config.h
+++ b/include/config.h
@@ -48,6 +48,8 @@ struct cConfig {
*/
uint16_t webServerPort;
+ uint16_t maxRequestTime;
+
/**
* External web server URL
*
diff --git a/include/setup.h b/include/setup.h
index 392c246..7ec94c2 100644
--- a/include/setup.h
+++ b/include/setup.h
@@ -87,6 +87,7 @@ private:
int upnpport;
int wsport;
int lvport;
+ int mRTime;
char webserverRoot[STRING_SIZE];
char presentationUrl[STRING_SIZE];
diff --git a/include/webserver.h b/include/webserver.h
index 02377d7..5e03fbb 100644
--- a/include/webserver.h
+++ b/include/webserver.h
@@ -22,6 +22,7 @@ namespace upnp {
cWebserver(std::string address);
virtual ~cWebserver();
+ void SetMaxRequestTime(unsigned int seconds);
void SetWebserverRootDir(std::string rootDirectory);
void SetPresentationUrl(std::string presentationUrl);
diff --git a/server/server.cpp b/server/server.cpp
index c6795df..1dfe605 100644
--- a/server/server.cpp
+++ b/server/server.cpp
@@ -219,6 +219,9 @@ bool cMediaServer::Initialize(){
if(mCurrentConfiguration.webServerPort)
mWebserver->SetListenerPort(mCurrentConfiguration.webServerPort);
+ if(mCurrentConfiguration.maxRequestTime)
+ mWebserver->SetMaxRequestTime(mCurrentConfiguration.maxRequestTime);
+
if(!mCurrentConfiguration.databaseDir.empty())
mMediaManager->SetDatabaseDir(mCurrentConfiguration.databaseDir);
}
diff --git a/server/webserver.cpp b/server/webserver.cpp
index e9f2615..b293d9b 100644
--- a/server/webserver.cpp
+++ b/server/webserver.cpp
@@ -9,6 +9,7 @@
#include "../upnp.h"
#include <sstream>
#include <tnt/job.h>
+#include <tnt/configurator.h>
namespace upnp {
@@ -93,6 +94,11 @@ void cWebserver::SetListenerPort(uint16_t port){
mListenerPort = port ? port : 7649;
}
+void cWebserver::SetMaxRequestTime(unsigned int seconds){
+ tnt::Configurator config(mApplication);
+ config.setMaxRequestTime(seconds);
+}
+
void cWebserver::SetWebserverRootDir(std::string rootDirectory){
if(mWebserverThread.Active()) return;