12#ifndef ROOT_THttpCallArg
13#define ROOT_THttpCallArg
19#include <condition_variable>
64 void ReplaceAllinContent(
const std::string &from,
const std::string &to,
bool once =
false);
235 template <
class T,
typename... Args>
238 fWSEngine = std::make_shared<T>(args...);
#define ClassDef(name, id)
std::string fPostData
! data received with post request - text - or binary
Bool_t fNotifyFlag
! indicate that notification called
Bool_t CompressWithGzip()
compress reply data with gzip compression
void Set404()
mark reply as 404 error - page/request not exists or refused
void SetRequestHeader(const char *h)
set full set of request header
void SetJson()
Set content type as "application/json".
UInt_t GetWSId() const
get web-socket id
void SetFileName(const char *f)
set request file name
TString GetHeader(const char *name)
return specified header
void SetFile(const char *filename=nullptr)
indicate that http request should response with file content
std::condition_variable fCond
! condition used to wait for processing
TString fTopName
! top item name
TString GetRequestHeader(const char *name)
get named field from request header
void SetPostData(void *data, Long_t length, Bool_t make_copy=kFALSE)
const char * GetUserName() const
return authenticated user name (0 - when no authentication)
std::shared_ptr< THttpWSEngine > TakeWSEngine()
takeout websocket handle with HTTP call can be done only once
void AddHeader(const char *name, const char *value)
Set name: value pair to reply header Content-Type field handled separately - one should use SetConten...
void SetText()
Set content type as "text/plain".
void SetTextContent(std::string &&txt)
Set content type as "text/plain" and also assigns content After method call argument.
TString GetHeaderName(Int_t number) const
returns field name in header
virtual void HttpReplied()
virtual method to inform object that http request is processed Normally condition is notified and wai...
TString fUserName
! authenticated user name (if any)
void SetUserName(const char *n)
set name of authenticated user
void SetPathName(const char *p)
set request path name
const char * GetTopName() const
returns engine-specific top-name
void ReplaceAllinContent(const std::string &from, const std::string &to, bool once=false)
Replace all occurrences of.
Bool_t IsPostMethod() const
returns kTRUE if post method is used
const void * GetPostData() const
return pointer on posted with request data
void SetTopName(const char *topname)
set engine-specific top-name
const char * GetQuery() const
returns request query (string after ? in request URL)
TString fPathName
! item path
std::shared_ptr< THttpWSEngine > fWSEngine
! web-socket engine, which supplied to run created web socket
void NotifyCondition()
method used to notify condition which waiting when operation will complete Condition notified only if...
void CreateWSEngine(Args... args)
Int_t NumRequestHeader() const
returns number of fields in request header
void SetPathAndFileName(const char *fullpath)
set complete path of requested http element For instance, it could be "/folder/subfolder/get....
TString fContentType
! type of content
Long_t GetContentLength() const
TString fQuery
! additional arguments
void SetMethod(const char *method)
set request method kind like GET or POST
virtual ~THttpCallArg()
destructor
TString CountHeader(const TString &buf, Int_t number=-1111) const
method used to counter number of headers or returns name of specified header
const void * GetContent() const
void SetPostponed()
mark as postponed - reply will not be send to client immediately
void SetBinary()
Set content type as "application/x-binary".
void AddNoCacheHeader()
Set CacheControl http header to disable browser caching.
TString AccessHeader(TString &buf, const char *name, const char *value=nullptr, Bool_t doing_set=kFALSE)
method used to get or set http header in the string buffer Header has following format: field1 : valu...
Bool_t IsContentType(const char *typ) const
void SetXml()
Set content type as "text/xml".
void SetExtraHeader(const char *name, const char *value)
add extra http header value to the reply
Int_t fZipping
! indicate if and when content should be compressed
void SetContent(const char *cont)
Set content as text.
Bool_t IsPostponed() const
void SetWSId(UInt_t id)
set web-socket id
TString fFileName
! file name
UInt_t fWSId
! websocket identifier, used in web-socket related operations
void SetQuery(const char *q)
set request query
TString GetRequestHeaderName(Int_t number) const
returns field name in request header
Int_t NumHeader() const
returns number of fields in header
std::string fContent
! content - text or binary
void SetBinaryContent(std::string &&bin)
Set content type as "application/x-binary" and also assigns content After method call argument.
void SetContentType(const char *typ)
set content type like "text/xml" or "application/json"
virtual void CheckWSPageContent(THttpWSHandler *)
Method used to modify content of web page used by web socket handler.
const char * GetPathName() const
returns path name from request URL
TString fMethod
! request method like GET or POST
void SetEncoding(const char *typ)
Set Content-Encoding header like gzip.
Long_t GetPostDataLength() const
return length of posted with request data
void SetJsonContent(std::string &&json)
Set content type as "application/json" and also assigns content After method call argument.
const char * GetMethod() const
returns request method like GET or POST
Bool_t IsMethod(const char *name) const
returns kTRUE if post method is used
const char * GetContentType() const
const char * GetFileName() const
returns file name from request URL
void AssignWSId()
Assign websocket identifier from the engine.
void SetZipping(Int_t mode=kZipLarge)
void SetXmlContent(std::string &&xml)
Set content type as "text/xml" and also assigns content After method call argument.
std::string FillHttpHeader(const char *header=nullptr)
Fills HTTP header, which can be send at the beggining of reply on the http request.
TString fRequestHeader
! complete header, provided with request
TString fHeader
! response header like ContentEncoding, Cache-Control and so on
Mother of all ROOT objects.
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
Int_t Atoi() const
Return integer value of string.
const char * Data() const