33 :
TObject(), fTopName(), fMethod(), fPathName(), fFileName(), fUserName(), fQuery(), fPostData(0),
34 fPostDataLength(0), fWSHandle(0), fWSId(0), fContentType(), fRequestHeader(), fHeader(), fContent(), fZipping(0),
35 fBinData(0), fBinDataLength(0), fNotifyFlag(
kFALSE)
74 while (curr < buf.
Length() - 2) {
80 if (buf.
Index(name, curr) != curr) {
85 if ((value == 0) && doing_set) {
87 buf.
Remove(curr, next - curr + 2);
92 while ((curr < next) && (buf[curr] !=
':')) curr++;
94 while ((curr < next) && (buf[curr] ==
' ')) curr++;
97 return buf(curr, next - curr);
98 buf.
Remove(curr, next - curr);
117 while (curr < buf.
Length() - 2) {
125 Int_t separ = curr + 1;
126 while ((separ < next) && (buf[separ] !=
':')) separ++;
127 return buf(curr, separ - curr);
157 if (make_copy && data && length) {
158 void *newdata =
malloc(length + 1);
159 memcpy(newdata, data, length);
164 *(((
char *)data) + length) = 0;
219 const char *rslash = strrchr(fullpath,
'/');
223 while ((fullpath != rslash) && (*fullpath ==
'/')) fullpath++;
236 if ((name == 0) || (*name == 0))
239 if (strcmp(name,
"Content-Type") == 0)
241 if (strcmp(name,
"Content-Length") == 0)
254 if ((name == 0) || (*name == 0) || (strcmp(name,
"Content-Length") == 0))
257 if (strcmp(name,
"Content-Type") == 0)
272 hdr.
Form(
"%s 404 Not Found\r\n" 273 "Content-Length: 0\r\n" 274 "Connection: close\r\n\r\n",
277 hdr.
Form(
"%s 200 OK\r\n" 278 "Content-Type: %s\r\n" 279 "Connection: keep-alive\r\n" 280 "Content-Length: %ld\r\n" 294 unsigned long objcrc = R__crc32(0, NULL, 0);
295 objcrc = R__crc32(objcrc, (
const unsigned char *)objbuf, objlen);
298 Int_t buflen = 10 + objlen + 8;
302 void *buffer =
malloc(buflen);
304 char *bufcur = (
char *)buffer;
320 memcpy(dummy, bufcur - 6, 6);
323 unsigned long ziplen = R__memcompress(bufcur - 6, objlen + 6, objbuf, objlen);
325 memcpy(bufcur - 6, dummy, 6);
327 bufcur += (ziplen - 6);
330 *bufcur++ = objcrc & 0xff;
331 *bufcur++ = (objcrc >> 8) & 0xff;
332 *bufcur++ = (objcrc >> 16) & 0xff;
333 *bufcur++ = (objcrc >> 24) & 0xff;
336 *bufcur++ = objlen & 0xff;
337 *bufcur++ = (objlen >> 8) & 0xff;
338 *bufcur++ = (objlen >> 16) & 0xff;
339 *bufcur++ = (objlen >> 24) & 0xff;
void SetWSHandle(TNamed *handle)
assign websocket handle with HTTP call
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
void * fBinData
! binary data, assigned with http call
TString & Insert(Ssiz_t pos, const char *s)
void SetContentType(const char *typ)
set content type like "text/xml" or "application/json"
TString CountHeader(const TString &buf, Int_t number=-1111) const
method used to counter number of headers or returns name of specified header
void SetPostData(void *data, Long_t length, Bool_t make_copy=kFALSE)
set data, posted with the request buffer should be allocated with malloc(length+1) call...
void SetEncoding(const char *typ)
Set Content-Encoding header like gzip.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
The TNamed class is the base class for all named ROOT classes.
void SetPathAndFileName(const char *fullpath)
set complete path of requested http element For instance, it could be "/folder/subfolder/get.bin" Here "/folder/subfolder/" is element path and "get.bin" requested file.
TString fContentType
! type of content
void Clear()
Clear string without changing its capacity.
TString fPathName
! item path
TString & Append(const char *cs)
TNamed * fWSHandle
! web-socket handle, derived from TNamed class
virtual void HttpReplied()
virtual method to inform object that http request is processed Normally condition is notified and wai...
Long_t fPostDataLength
! length of binary data
Long_t fBinDataLength
! length of binary data
void SetBinData(void *data, Long_t length)
set binary data, which will be returned as reply body
Bool_t fNotifyFlag
! indicate that notification called
TString AccessHeader(TString &buf, const char *name, const char *value=0, Bool_t doing_set=kFALSE)
method used to get or set http header in the string buffer Header has following format: field1 : valu...
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
void * fPostData
! binary data received with post request
Bool_t IsPostponed() const
const void * GetContent() const
TString & Remove(Ssiz_t pos)
std::condition_variable fCond
! condition used to wait for processing
TString fHeader
! response header like ContentEncoding, Cache-Control and so on
static RooMathCoreReg dummy
const char * GetContentType() const
THttpCallArg()
constructor
void NotifyCondition()
method used to notify condition which waiting when operation will complete Condition notified only if...
TNamed * TakeWSHandle()
takeout websocket handle with HTTP call can be done only once
Mother of all ROOT objects.
TString fContent
! text content (if any)
void AddHeader(const char *name, const char *value)
Set name: value pair to reply header Content-Type field handled separately - one should use SetConten...
~THttpCallArg()
destructor
TString fFileName
! file name
Bool_t CompressWithGzip()
compress reply data with gzip compression
TString GetHeader(const char *name)
return specified header
void FillHttpHeader(TString &buf, const char *header=0)
fill HTTP header
const char * Data() const
Long_t GetContentLength() const