79 while (curr < buf.
Length()-2) {
82 if (next ==
kNPOS)
break;
84 if (buf.
Index(name, curr) != curr) {
89 if ((value==0) && doing_set) {
91 buf.
Remove(curr, next-curr+2);
96 while ((curr < next) && (buf[curr] !=
':')) curr++;
98 while ((curr < next) && (buf[curr] ==
' ')) curr++;
100 if (value==0)
return buf(curr, next-curr);
101 buf.
Remove(curr, next-curr);
106 if (value==0)
return TString();
119 while (curr < buf.
Length()-2) {
122 if (next ==
kNPOS)
break;
126 Int_t separ = curr + 1;
127 while ((separ < next) && (buf[separ] !=
':')) separ++;
128 return buf(curr, separ-curr);
149 if (data!=0) *(((
char*) data) + length) = 0;
198 if (fullpath == 0)
return;
200 const char *rslash = strrchr(fullpath,
'/');
204 while ((fullpath != rslash) && (*fullpath ==
'/')) fullpath++;
216 if ((name == 0) || (*name == 0))
return TString();
218 if (strcmp(name,
"Content-Type") == 0)
return fContentType;
231 if ((name == 0) || (*name == 0) || (strcmp(name,
"Content-Length") == 0))
return;
233 if (strcmp(name,
"Content-Type") == 0)
244 if (kind == 0) kind =
"HTTP/1.1";
247 hdr.
Form(
"%s 404 Not Found\r\n" 248 "Content-Length: 0\r\n" 249 "Connection: close\r\n\r\n", kind);
251 hdr.
Form(
"%s 200 OK\r\n" 252 "Content-Type: %s\r\n" 253 "Connection: keep-alive\r\n" 254 "Content-Length: %ld\r\n" 271 unsigned long objcrc = R__crc32(0,
NULL, 0);
272 objcrc = R__crc32(objcrc, (
const unsigned char *) objbuf, objlen);
275 Int_t buflen = 10 + objlen + 8;
276 if (buflen < 512) buflen = 512;
278 void *buffer =
malloc(buflen);
280 char *bufcur = (
char *) buffer;
296 memcpy(dummy, bufcur - 6, 6);
299 unsigned long ziplen = R__memcompress(bufcur - 6, objlen + 6, objbuf, objlen);
301 memcpy(bufcur - 6, dummy, 6);
303 bufcur += (ziplen - 6);
305 *bufcur++ = objcrc & 0xff;
306 *bufcur++ = (objcrc >> 8) & 0xff;
307 *bufcur++ = (objcrc >> 16) & 0xff;
308 *bufcur++ = (objcrc >> 24) & 0xff;
310 *bufcur++ = objlen & 0xff;
311 *bufcur++ = (objlen >> 8) & 0xff;
312 *bufcur++ = (objlen >> 16) & 0xff;
313 *bufcur++ = (objlen >> 24) & 0xff;
void SetWSHandle(TNamed *handle)
assign websocket handle with HTTP call
Long_t GetContentLength() const
void * fBinData
indicate if content should be zipped
TString & Insert(Ssiz_t pos, const char *s)
void SetContentType(const char *typ)
const void * GetContent() const
const char * Data() const
void SetEncoding(const char *typ)
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
condition used to wait for processing
void Clear()
Clear string without changing its capacity.
TString fPathName
request method like GET or POST
TString & Append(const char *cs)
TNamed * fWSHandle
length of binary data
Long_t fPostDataLength
binary data received with post request
Long_t fBinDataLength
binary data, assigned with http call
void SetBinData(void *data, Long_t length)
set binary data, which will be returned as reply body
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
additional arguments
TString & Remove(Ssiz_t pos)
TString CountHeader(const TString &buf, Int_t number=-1111) const
method used to counter number of headers or returns name of specified header
TString fHeader
complete header, provided with request
static RooMathCoreReg dummy
TNamed * TakeWSHandle()
takeout websocket handle with HTTP call can be done only once
Mother of all ROOT objects.
TString fContent
response header like ContentEncoding, Cache-Control and so on
void AddHeader(const char *name, const char *value)
Set name: value pair to reply header Content-Type field handled separately - one should use SetConten...
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
~THttpCallArg()
destructor
TString fFileName
item path
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 * GetContentType() const