From c255811b037cc204d7e7cf6ea4ddc94408c01edc Mon Sep 17 00:00:00 2001 From: Sergey Linev Date: Thu, 13 Apr 2017 13:01:42 +0200 Subject: [PATCH 1/2] http: increase websocket timeout to 300 s One also can configure websocket timeout when creating THttpServer --- net/http/src/TCivetweb.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/net/http/src/TCivetweb.cxx b/net/http/src/TCivetweb.cxx index 06fb2887617d7..d55d32a878a96 100644 --- a/net/http/src/TCivetweb.cxx +++ b/net/http/src/TCivetweb.cxx @@ -360,6 +360,7 @@ Int_t TCivetweb::ProcessLog(const char *message) /// top=name - configure top name, visible in the web browser /// auth_file=filename - authentication file name, created with htdigets utility /// auth_domain=domain - authentication domain +/// websocket_timeout=tm - set web sockets timeout in seconds (default 300) /// loopback - bind specified port to loopback 127.0.0.1 address /// debug - enable debug mode, server always returns html page with request info @@ -369,8 +370,7 @@ Bool_t TCivetweb::Create(const char *args) memset(fCallbacks, 0, sizeof(struct mg_callbacks)); //((struct mg_callbacks *) fCallbacks)->begin_request = begin_request_handler; ((struct mg_callbacks *)fCallbacks)->log_message = log_message_handler; - TString sport = "8080"; - TString num_threads = "5"; + TString sport = "8080", num_threads = "5", websocket_timeout = "300000"; TString auth_file, auth_domain, log_file; // extract arguments @@ -404,6 +404,9 @@ Bool_t TCivetweb::Create(const char *args) const char *adomain = url.GetValueFromOptions("auth_domain"); if (adomain != 0) auth_domain = adomain; + Int_t wtmout = url.GetIntValueFromOptions("websocket_timeout"); + if (wtmout>0) websocket_timeout.Format("%d", wtmout*1000); + if (url.HasOption("debug")) fDebug = kTRUE; if (url.HasOption("loopback") && (sport.Index(":") == kNPOS)) sport = TString("127.0.0.1:") + sport; @@ -420,6 +423,8 @@ Bool_t TCivetweb::Create(const char *args) options[op++] = sport.Data(); options[op++] = "num_threads"; options[op++] = num_threads.Data(); + options[op++] = "websocket_timeout_ms"; + options[op++] = websocket_timeout.Data(); if ((auth_file.Length() > 0) && (auth_domain.Length() > 0)) { options[op++] = "global_auth_file"; From cda4ea797aa8a85b935ebbacfc12cae0e8cbae85 Mon Sep 17 00:00:00 2001 From: Sergey Linev Date: Thu, 13 Apr 2017 13:45:45 +0200 Subject: [PATCH 2/2] http: travis formatting --- net/http/src/TCivetweb.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/http/src/TCivetweb.cxx b/net/http/src/TCivetweb.cxx index d55d32a878a96..ab8c7b7c8e20b 100644 --- a/net/http/src/TCivetweb.cxx +++ b/net/http/src/TCivetweb.cxx @@ -405,7 +405,7 @@ Bool_t TCivetweb::Create(const char *args) if (adomain != 0) auth_domain = adomain; Int_t wtmout = url.GetIntValueFromOptions("websocket_timeout"); - if (wtmout>0) websocket_timeout.Format("%d", wtmout*1000); + if (wtmout > 0) websocket_timeout.Format("%d", wtmout * 1000); if (url.HasOption("debug")) fDebug = kTRUE;