Skip to content
Snippets Groups Projects
Commit d1cefd56 authored by Sergey Linev's avatar Sergey Linev
Browse files

[http] use THttpServer::Process() method with shared_ptr

Deprecate old signature, but keep support for a while
parent bffba246
No related branches found
No related tags found
No related merge requests found
......@@ -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"
......
......@@ -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
///
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment