diff --git a/net/http/inc/THttpServer.h b/net/http/inc/THttpServer.h index 4c93075960aa1a7780e7ced5167b95bead654235..44b764a44209e47bb57e827b9db3b31eaea569a2 100644 --- a/net/http/inc/THttpServer.h +++ b/net/http/inc/THttpServer.h @@ -38,6 +38,7 @@ protected: Long_t fMainThrdId{0}; ///<! id of the thread for processing requests Bool_t fOwnThread{kFALSE}; ///<! true when specialized thread allocated for processing requests std::thread fThrd; ///<! own thread + Bool_t fOldProcessSignature{kFALSE}; ///<! flag used to detect usage of old signature of Process() method TString fJSROOTSYS; ///<! location of local JSROOT files TString fTopName{"ROOT"}; ///<! name of top folder, default - "ROOT" diff --git a/net/http/src/THttpServer.cxx b/net/http/src/THttpServer.cxx index 98a795381dac4a8c47cac6580e1e6d5c44129797..ee7ff2d4bb9ce3f7b939d507627d9ece175a50ba 100644 --- a/net/http/src/THttpServer.cxx +++ b/net/http/src/THttpServer.cxx @@ -706,23 +706,19 @@ void THttpServer::ProcessRequest(std::shared_ptr<THttpCallArg> arg) { if (fTerminated) { arg->Set404(); - } else if ((arg->fFileName == "root.websocket") || (arg->fFileName == "root.longpoll")) { - ExecuteWS(arg); - } else { - ProcessRequest(arg.get()); + return; } -} -//////////////////////////////////////////////////////////////////////////////// -/// \deprecated One should use signature with std::shared_ptr -/// Process single http request -/// Depending from requested path and filename different actions will be performed. -/// In most cases information is provided by TRootSniffer class + if ((arg->fFileName == "root.websocket") || (arg->fFileName == "root.longpoll")) { + ExecuteWS(arg); + return; + } -void THttpServer::ProcessRequest(THttpCallArg *arg) -{ - if (fTerminated) { - arg->Set404(); + // this is just to support old Process(), should be deprecated after 6.20 + fOldProcessSignature = kTRUE; + ProcessRequest(arg.get()); + if (fOldProcessSignature) { + Error("ProcessRequest", "Deprecated signature is used, please used std::shared_ptr<THttpCallArg>"); return; } @@ -944,7 +940,7 @@ void THttpServer::ProcessRequest(THttpCallArg *arg) arg->SetContentType(GetMimeType(filename.Data())); } else { // miss request, user may process - MissedRequest(arg); + MissedRequest(arg.get()); } if (arg->Is404()) @@ -968,6 +964,14 @@ void THttpServer::ProcessRequest(THttpCallArg *arg) arg->AddHeader("Access-Control-Allow-Origin", GetCors()); } +//////////////////////////////////////////////////////////////////////////////// +/// \deprecated One should use signature with std::shared_ptr + +void THttpServer::ProcessRequest(THttpCallArg *) +{ + fOldProcessSignature = kFALSE; +} + //////////////////////////////////////////////////////////////////////////////// /// Register object in folders hierarchy ///