Logo ROOT  
Reference Guide
TCivetweb.h
Go to the documentation of this file.
1// Author: Sergey Linev 21/12/2013
2
3/*************************************************************************
4 * Copyright (C) 1995-2022, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11#ifndef ROOT_TCivetweb
12#define ROOT_TCivetweb
13
14#include "THttpEngine.h"
15#include "TString.h"
16
17#include "../civetweb/civetweb.h"
18
19class TCivetweb : public THttpEngine {
20protected:
21 struct mg_context *fCtx{nullptr}; ///<! civetweb context
22 struct mg_callbacks fCallbacks; ///<! call-back table for civetweb webserver
23 TString fTopName; ///<! name of top item
24 Bool_t fDebug{kFALSE}; ///<! debug mode
25 Bool_t fTerminating{kFALSE}; ///<! server doing shutdown and not react on requests
26 Bool_t fOnlySecured{kFALSE}; ///<! if server should run only https protocol
27 Int_t fMaxAge{3600}; ///<! max-age parameter
28 Bool_t fWinSymLinks{kTRUE}; ///<! resolve symbolic links on Windows
29
30 void Terminate() override { fTerminating = kTRUE; }
31
32 Bool_t IsSecured() const { return fOnlySecured; }
33
34public:
35 TCivetweb(Bool_t only_secured = kFALSE);
36 virtual ~TCivetweb();
37
38 Bool_t Create(const char *args) override;
39
40 const char *GetTopName() const { return fTopName.Data(); }
41
42 Bool_t IsDebugMode() const { return fDebug; }
43
44 Bool_t IsTerminating() const { return fTerminating; }
45
46 Bool_t IsWinSymLinks() const { return fWinSymLinks; }
47
48 Int_t ProcessLog(const char *message);
49
50 Int_t GetMaxAge() const { return fMaxAge; }
51};
52
53#endif
bool Bool_t
Definition: RtypesCore.h:63
int Int_t
Definition: RtypesCore.h:45
const Bool_t kFALSE
Definition: RtypesCore.h:101
const Bool_t kTRUE
Definition: RtypesCore.h:100
THttpEngine implementation, based on civetweb embedded server.
Definition: TCivetweb.h:19
struct mg_context * fCtx
! civetweb context
Definition: TCivetweb.h:21
Bool_t fWinSymLinks
! resolve symbolic links on Windows
Definition: TCivetweb.h:28
Bool_t IsTerminating() const
Definition: TCivetweb.h:44
Int_t GetMaxAge() const
Definition: TCivetweb.h:50
const char * GetTopName() const
Definition: TCivetweb.h:40
TCivetweb(Bool_t only_secured=kFALSE)
constructor
Definition: TCivetweb.cxx:451
Int_t fMaxAge
! max-age parameter
Definition: TCivetweb.h:27
Int_t ProcessLog(const char *message)
process civetweb log message, can be used to detect critical errors
Definition: TCivetweb.cxx:469
TString fTopName
! name of top item
Definition: TCivetweb.h:23
Bool_t fOnlySecured
! if server should run only https protocol
Definition: TCivetweb.h:26
Bool_t fTerminating
! server doing shutdown and not react on requests
Definition: TCivetweb.h:25
Bool_t Create(const char *args) override
Creates embedded civetweb server.
Definition: TCivetweb.cxx:507
void Terminate() override
Method called when server want to be terminated.
Definition: TCivetweb.h:30
Bool_t IsSecured() const
Definition: TCivetweb.h:32
Bool_t IsDebugMode() const
Definition: TCivetweb.h:42
virtual ~TCivetweb()
destructor
Definition: TCivetweb.cxx:460
Bool_t IsWinSymLinks() const
Definition: TCivetweb.h:46
Bool_t fDebug
! debug mode
Definition: TCivetweb.h:24
struct mg_callbacks fCallbacks
! call-back table for civetweb webserver
Definition: TCivetweb.h:22
Abstract class for implementing http protocol for THttpServer.
Definition: THttpEngine.h:19
Basic string class.
Definition: TString.h:136
const char * Data() const
Definition: TString.h:369