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)
69 if (name == 0)
return TString();
73 while (curr < buf.
Length() - 2) {
76 if (next ==
kNPOS)
break;
78 if (buf.
Index(name, curr) != curr) {
83 if ((value == 0) && doing_set) {
85 buf.
Remove(curr, next - curr + 2);
90 while ((curr < next) && (buf[curr] !=
':')) curr++;
92 while ((curr < next) && (buf[curr] ==
' ')) curr++;
94 if (value == 0)
return buf(curr, next - curr);
95 buf.
Remove(curr, next - curr);
100 if (value == 0)
return TString();
113 while (curr < buf.
Length() - 2) {
116 if (next ==
kNPOS)
break;
120 Int_t separ = curr + 1;
121 while ((separ < next) && (buf[separ] !=
':')) separ++;
122 return buf(curr, separ - curr);
143 if (data != 0) *(((
char *)data) + length) = 0;
192 if (fullpath == 0)
return;
194 const char *rslash = strrchr(fullpath,
'/');
198 while ((fullpath != rslash) && (*fullpath ==
'/')) fullpath++;
210 if ((name == 0) || (*name == 0))
return TString();
212 if (strcmp(name,
"Content-Type") == 0)
return fContentType;
225 if ((name == 0) || (*name == 0) || (strcmp(name,
"Content-Length") == 0))
return;
227 if (strcmp(name,
"Content-Type") == 0)
238 if (kind == 0) kind =
"HTTP/1.1";
241 hdr.
Form(
"%s 404 Not Found\r\n" 242 "Content-Length: 0\r\n" 243 "Connection: close\r\n\r\n",
246 hdr.
Form(
"%s 200 OK\r\n" 247 "Content-Type: %s\r\n" 248 "Connection: keep-alive\r\n" 249 "Content-Length: %ld\r\n" 263 unsigned long objcrc = R__crc32(0,
NULL, 0);
264 objcrc = R__crc32(objcrc, (
const unsigned char *)objbuf, objlen);
267 Int_t buflen = 10 + objlen + 8;
268 if (buflen < 512) buflen = 512;
270 void *buffer =
malloc(buflen);
272 char *bufcur = (
char *)buffer;
288 memcpy(dummy, bufcur - 6, 6);
291 unsigned long ziplen = R__memcompress(bufcur - 6, objlen + 6, objbuf, objlen);
293 memcpy(bufcur - 6, dummy, 6);
295 bufcur += (ziplen - 6);
298 *bufcur++ = objcrc & 0xff;
299 *bufcur++ = (objcrc >> 8) & 0xff;
300 *bufcur++ = (objcrc >> 16) & 0xff;
301 *bufcur++ = (objcrc >> 24) & 0xff;
304 *bufcur++ = objlen & 0xff;
305 *bufcur++ = (objlen >> 8) & 0xff;
306 *bufcur++ = (objlen >> 16) & 0xff;
307 *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 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...
void SetPostData(void *data, Long_t length)
set data, posted with the request buffer should be allocated with malloc(length+1) call...
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
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