SNAP Library 4.1, User Reference  2018-07-26 16:30:42
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
http.cpp
Go to the documentation of this file.
1 // Http-General
3 
4 // general strings
5 const TStr THttp::HttpStr="http";
6 const TStr THttp::SlashStr="/";
7 const TStr THttp::ColonStr=":";
8 
9 // fields names
10 const TStr THttp::ContTypeFldNm="Content-Type";
11 const TStr THttp::ContLenFldNm="Content-Length";
12 const TStr THttp::HostFldNm="Host";
13 const TStr THttp::AcceptRangesFldNm="Accept-Ranges";
14 const TStr THttp::CacheCtrlFldNm="Cache-Control";
15 const TStr THttp::AcceptFldNm="Accept";
16 const TStr THttp::SrvFldNm="Server";
17 const TStr THttp::ConnFldNm="Connection";
18 const TStr THttp::FetchIdFldNm="FetchId";
19 const TStr THttp::LocFldNm="Location";
20 const TStr THttp::SetCookieFldNm="Set-Cookie";
21 const TStr THttp::CookieFldNm="Cookie";
22 
23 // content-type field-values
24 const TStr THttp::TextFldVal="text/";
25 const TStr THttp::TextPlainFldVal="text/plain";
26 const TStr THttp::TextHtmlFldVal="text/html";
27 const TStr THttp::TextXmlFldVal="text/xml";
28 const TStr THttp::TextWmlFldVal="text/vnd.wap.wml";
29 const TStr THttp::TextJavaScriptFldVal="text/javascript";
30 const TStr THttp::TextCssFldVal="text/css";
31 const TStr THttp::ImageIcoFldVal="image/x-icon";
32 const TStr THttp::ImagePngFldVal="image/png";
33 const TStr THttp::ImageGifFldVal="image/gif";
34 const TStr THttp::ImageJpgFldVal="image/jpg";
35 const TStr THttp::AppOctetFldVal="application/octet-stream";
36 const TStr THttp::AppSoapXmlFldVal="application/soap+xml";
37 const TStr THttp::AppW3FormFldVal="application/x-www-form-urlencoded";
38 const TStr THttp::AppJSonFldVal = "application/json";
39 const TStr THttp::ConnKeepAliveFldVal="keep-alive";
40 
41 // file extensions
42 bool THttp::IsHtmlFExt(const TStr& FExt){
43  TStr UcFExt=FExt.GetUc();
44  return ((UcFExt==TFile::HtmlFExt.GetUc())||(UcFExt==TFile::HtmFExt.GetUc()));
45 }
46 
47 bool THttp::IsGifFExt(const TStr& FExt){
48  return (FExt.GetUc()==TFile::GifFExt.GetUc());
49 }
50 
51 // port number
52 const int THttp::DfPortN=80;
53 
54 // status codes
55 const int THttp::OkStatusCd=200;
56 const int THttp::RedirStatusCd=300;
57 const int THttp::BadRqStatusCd=400;
58 const int THttp::ErrStatusCd=400;
59 const int THttp::ErrNotFoundStatusCd=404;
60 const int THttp::InternalErrStatusCd=500;
61 
62 TStr THttp::GetReasonPhrase(const int& StatusCd){
63  switch (StatusCd){
64  case 200: return "OK";
65  case 201: return "Created";
66  case 202: return "Accepted";
67  case 204: return "No Content";
68  case 300: return "Multiple Choices";
69  case 301: return "Moved Permanently";
70  case 302: return "Moved Temporarily";
71  case 304: return "Not Modified";
72  case 400: return "Bad Request";
73  case 401: return "Unauthorized";
74  case 403: return "Forbidden";
75  case 404: return "Not Found";
76  case 500: return "Internal Server Error";
77  case 501: return "Not Implemented";
78  case 502: return "Bad Gateway";
79  case 503: return "Service Unavailable";
80  default: return TStr("Unknown Status Code ")+TInt::GetStr(StatusCd);
81  }
82 }
83 
84 // method names
85 const TStr THttp::GetMethodNm="GET";
86 const TStr THttp::HeadMethodNm="HEAD";
87 const TStr THttp::PostMethodNm="POST";
88 const TStr THttp::UndefMethodNm="UndefinedMethod";
89 
91 // Http-Chars
93 
94 class THttpChDef{
95 private:
98  void SetLcCh(const TStr& Str);
99  void SetChTy(const THttpChTy& ChTy, const char& Ch);
100  void SetChTy(const THttpChTy& ChTy, const TStr& Str);
101 public:
102  THttpChDef();
103 
104  THttpChDef& operator=(const THttpChDef&){Fail; return *this;}
105 
106  int GetChTy(const char& Ch){return ChTyV[Ch-TCh::Mn];}
107  bool IsAlpha(const char& Ch){return ChTyV[Ch-TCh::Mn]==int(hpctAlpha);}
108  bool IsDigit(const char& Ch){return ChTyV[Ch-TCh::Mn]==int(hpctDigit);}
109  bool IsCtl(const char& Ch){return ChTyV[Ch-TCh::Mn]==int(hpctCtl);}
110  bool IsLws(const char& Ch){
111  return (Ch==' ')||(Ch==TCh::TabCh)||(Ch==TCh::CrCh)||(Ch==TCh::LfCh);}
112  bool IsText(const char& Ch){return !IsCtl(Ch)||IsLws(Ch);}
113  bool IsSpec(const char& Ch){
114  return (ChTyV[Ch-TCh::Mn]==int(hpctSpec))||(Ch==9)||(Ch==32);}
115  bool IsCr(const char& Ch){return Ch==13;}
116  bool IsLf(const char& Ch){return Ch==10;}
117  bool IsSp(const char& Ch){return Ch==32;}
118  bool IsHt(const char& Ch){return Ch==9;}
119  bool IsDQuote(const char& Ch){return Ch=='"';}
120 
121  char GetLcCh(const char& Ch){return LcChV[Ch-TCh::Mn];}
122  TStr GetLcStr(const TStr& Str);
123 };
124 
125 void THttpChDef::SetChTy(const THttpChTy& ChTy, const char& Ch){
126  IAssert(ChTyV[Ch-TCh::Mn]==int(hpctUndef)); ChTyV[Ch-TCh::Mn]=TInt(ChTy);}
127 
128 void THttpChDef::SetChTy(const THttpChTy& ChTy, const TStr& Str){
129  for (int ChN=0; ChN<Str.Len(); ChN++){SetChTy(ChTy, Str[ChN]);}}
130 
131 void THttpChDef::SetLcCh(const TStr& Str){
132  for (int ChN=1; ChN<Str.Len(); ChN++){LcChV[Str[ChN]-TCh::Mn]=TCh(Str[0]);}}
133 
135  ChTyV(TCh::Vals), LcChV(TCh::Vals){
136 
137  // Character-Types
139  SetChTy(hpctAlpha, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
140  SetChTy(hpctAlpha, "abcdefghijklmnopqrstuvwxyz");
141  SetChTy(hpctDigit, "0123456789");
142  for (char Ch=0; Ch<=31; Ch++){SetChTy(hpctCtl, Ch);}
143  SetChTy(hpctCtl, 127);
144  SetChTy(hpctSpec, "()<>@,;:\\\"/[]?={}"); // +char(9)+char(32)
145 
146  // Lower-Case
147  {for (int Ch=TCh::Mn; Ch<=TCh::Mx; Ch++){LcChV[Ch-TCh::Mn]=TCh(char(Ch));}}
148  SetLcCh("aA"); SetLcCh("bB"); SetLcCh("cC"); SetLcCh("dD"); SetLcCh("eE");
149  SetLcCh("fF"); SetLcCh("gG"); SetLcCh("hH"); SetLcCh("iI"); SetLcCh("jJ");
150  SetLcCh("kK"); SetLcCh("lL"); SetLcCh("mM"); SetLcCh("nN"); SetLcCh("oO");
151  SetLcCh("pP"); SetLcCh("qQ"); SetLcCh("rR"); SetLcCh("sS"); SetLcCh("tT");
152  SetLcCh("uU"); SetLcCh("vV"); SetLcCh("wW"); SetLcCh("xX"); SetLcCh("yY");
153  SetLcCh("zZ");
154 }
155 
157  TChA LcStr;
158  for (int ChN=0; ChN<Str.Len(); ChN++){LcStr+=GetLcCh(Str[ChN]);}
159  return LcStr;
160 }
161 
163 // Http-Exception
164 typedef enum {
169 
170 class THttpEx{
171 private:
173 public:
174  THttpEx(const THttpExCd& _HttpExCd): HttpExCd(_HttpExCd){}
175 };
176 
178 // Http-Lexical
179 class THttpLx{
180 private:
183  //TChA ChStack;
185  char Ch;
186  bool AtEof;
188 public:
189  THttpLx(const PSIn& _SIn):
190  SIn(_SIn), EofChPrS(), Ch(' '), AtEof(false), SfMem(50000){
191  GetFirstCh();}
192 
193  THttpLx& operator=(const THttpLx&){Fail; return *this;}
194 
195  // basic
196  bool Eof(){return AtEof;}
197  int Len(){return EofChPrS.Len()+SIn->Len();}
198  char GetFirstCh();
199  char GetCh();
200  void GetRest();
201  void PutCh(const char& _Ch){
202  EofChPrS.Push(TBoolChPr(AtEof, Ch)); Ch=_Ch; AtEof=false; SfMem.Pop();}
203  void ClrMemSf(){SfMem.Clr();}
204  TMem& GetMemSf(){return SfMem;}
205 
206  // http request
208  PUrl GetUrl();
209  TStr GetUrlStr();
210  // http response
211  bool IsRespStatusLn();
213  // spacing
214  void GetWs();
215  bool IsLws();
216  void GetLws();
217  bool IsCrLf();
218  void GetCrLf();
219  // tokens
220  void GetPeriod();
221  TStr GetToken(const TStr& ExpectStr=TStr());
222  TStr GetSpec(const TStr& ExpectStr=TStr());
223  int GetInt(const int& RqPlaces=-1);
224  TStr GetFldVal();
225 
226  static TStr GetNrStr(const TStr& Str){return ChDef.GetLcStr(Str);}
227 };
229 
231  if (SIn->Eof()){
232  if (AtEof){throw THttpEx(heUnexpectedEof);}
233  AtEof=true; return 0;
234  } else {
235  Ch=SIn->GetCh(); return Ch;
236  }
237 }
238 
240  if (EofChPrS.Empty()){
241  if (SIn->Eof()){
242  if (AtEof){throw THttpEx(heUnexpectedEof);}
243  AtEof=true; SfMem+=Ch; Ch=TCh::NullCh; return Ch;
244  } else {
245  SfMem+=Ch; Ch=SIn->GetCh(); return Ch;
246  }
247  } else {
248  SfMem+=Ch;
250  return Ch;
251  }
252 }
253 
255  while ((!SIn->Eof())&&(!EofChPrS.Empty())){GetCh();}
256  if (!SIn->Eof()){SfMem+=Ch;}
257  TMem RestMem; TMem::LoadMem(SIn, RestMem);
258  SfMem+=RestMem;
259 }
260 
262  TChA MethodNm;
263  while (!Eof() && ChDef.IsAlpha(Ch)){
264  MethodNm+=Ch; GetCh();}
265  THttpRqMethod Method=hrmUndef;
266  if (MethodNm==THttp::GetMethodNm){Method=hrmGet;}
267  else if (MethodNm==THttp::HeadMethodNm){Method=hrmHead;}
268  else if (MethodNm==THttp::PostMethodNm){Method=hrmPost;}
269  if (Method==hrmUndef){throw THttpEx(heMethodNmExpected);}
270  return Method;
271 }
272 
274  TChA UrlChA;
275  while ((!Eof())&&(!ChDef.IsSp(Ch))){
276  UrlChA+=Ch; GetCh();}
277  if (UrlChA.Empty()){
278  throw THttpEx(heUrlEmpty);}
279  static TStr LocalBaseUrlStr="http://localhost/";
280  PUrl Url=PUrl(new TUrl(UrlChA, LocalBaseUrlStr));
281  if (!Url->IsOk()){
282  throw THttpEx(heBadUrl);}
283  return Url;
284 }
285 
287  TChA UrlChA;
288  while ((!Eof())&&(!ChDef.IsSp(Ch))){
289  UrlChA+=Ch; GetCh();}
290  if (UrlChA.Empty()){
291  throw THttpEx(heUrlEmpty);}
292  return UrlChA;
293 }
294 
296  static const TChA MouldChA="http/N.N NNN ";
297  TChA TestChA(MouldChA);
298  int TestLen=TestChA.Len();
299  if (1+Len()<TestLen){return false;}
300  TestChA.PutCh(0, ChDef.GetLcCh(Ch));
301  {for (int ChN=1; ChN<TestLen; ChN++){
302  TestChA.PutCh(ChN, ChDef.GetLcCh(GetCh()));}}
303  {for (int ChN=1; ChN<TestLen; ChN++){
304  PutCh(TestChA[TestLen-ChN-1]);}}
305  {for (int ChN=0; ChN<MouldChA.Len(); ChN++){
306  if (MouldChA[ChN]=='N'){
307  if (!ChDef.IsDigit(TestChA[ChN])){return false;}
308  } else {
309  if (MouldChA[ChN]!=TestChA[ChN]){return false;}
310  }
311  }}
312  return true;
313 }
314 
316  GetLws();
317  TChA RPStr;
318  while (!Eof()&&ChDef.IsText(Ch)&&(Ch!=TCh::CrCh)&&(Ch!=TCh::LfCh)){
319  RPStr+=Ch; GetCh();}
320  return RPStr;
321 }
322 
324  while (!Eof()&&((Ch==' ')||(Ch==TCh::TabCh))){GetCh();}
325 }
326 
328  if ((Ch==' ')||(Ch==TCh::TabCh)){
329  return true;
330  } else
331  if (Ch==TCh::CrCh){
332  GetCh();
333  if (Ch==TCh::LfCh){
334  GetCh(); bool Ok=(Ch==' ')||(Ch==TCh::TabCh);
335  PutCh(TCh::LfCh); PutCh(TCh::CrCh); return Ok;
336  } else {
337  PutCh(TCh::CrCh); return false;
338  }
339  } else
340  if (Ch==TCh::LfCh){
341  GetCh(); bool Ok=(Ch==' ')||(Ch==TCh::TabCh);
342  PutCh(TCh::LfCh); return Ok;
343  } else {
344  return false;
345  }
346 }
347 
349  forever {
350  while ((Ch==' ')||(Ch==TCh::TabCh)){GetCh();}
351  if (Ch==TCh::CrCh){
352  GetCh();
353  if (Ch==TCh::LfCh){
354  GetCh();
355  if ((Ch==' ')||(Ch==TCh::TabCh)){GetCh();}
356  else {PutCh(TCh::LfCh); PutCh(TCh::CrCh); break;}
357  } else {
358  PutCh(TCh::CrCh); break;
359  }
360  } else
361  if (Ch==TCh::LfCh){
362  GetCh();
363  if ((Ch==' ')||(Ch==TCh::TabCh)){GetCh();}
364  else {PutCh(TCh::LfCh); break;}
365  } else {
366  break;
367  }
368  }
369 }
370 
372  if (Ch==TCh::CrCh){
373  GetCh(); bool Ok=(Ch==TCh::LfCh); PutCh(TCh::CrCh); return Ok;
374  } else
375  if (Ch==TCh::LfCh){
376  return true;
377  } else {
378  return false;
379  }
380 }
381 
383  if (Ch==TCh::CrCh){
384  GetCh();
385  if (Ch==TCh::LfCh){GetCh();} else {throw THttpEx(heCrLfExpected);}
386  } else
387  if (Ch==TCh::LfCh){
388  GetCh();
389  } else {
390  throw THttpEx(heCrLfExpected);
391  }
392 }
393 
395  GetWs();
396  if (Ch!='.'){throw THttpEx(hePeriodExpected);}
397  GetCh();
398 }
399 
400 TStr THttpLx::GetToken(const TStr& ExpectStr){
401  GetLws();
402  TChA TokenStr;
403  while (!Eof() && !ChDef.IsCtl(Ch) && !ChDef.IsSpec(Ch)){
404  TokenStr+=Ch; GetCh();}
405  if (TokenStr.Empty()){throw THttpEx(heTokenExpected);}
406  if (!ExpectStr.Empty()){
407  if (GetNrStr(ExpectStr)!=GetNrStr(TokenStr)){
408  throw THttpEx(heInvalidToken);}
409  }
410  return TokenStr;
411 }
412 
413 TStr THttpLx::GetSpec(const TStr& ExpectStr){
414  GetLws();
415  if (!ChDef.IsSpec(Ch)){throw THttpEx(heTSpecExpected);}
416  TStr SpecStr(Ch); GetCh();
417  if (!ExpectStr.Empty()){
418  if (ExpectStr!=SpecStr){throw THttpEx(heInvalidTSpec);}}
419  return SpecStr;
420 }
421 
422 int THttpLx::GetInt(const int& RqPlaces){
423  GetLws();
424  if (!ChDef.IsDigit(Ch)){throw THttpEx(heNumExpected);}
425  int Int=0; int CurPlaces=0;
426  do {Int=Int*10+Ch-'0'; CurPlaces++; GetCh();
427  } while ((CurPlaces<RqPlaces)&&(ChDef.IsDigit(Ch)));
428  if (RqPlaces!=-1){
429  if (CurPlaces!=RqPlaces){throw THttpEx(heInvalidNumPlaces);}}
430  return Int;
431 }
432 
434  TChA FldValStr;
435  do {
436  GetLws();
437  while (!Eof()&&ChDef.IsText(Ch)&&(Ch!=TCh::CrCh)&&(Ch!=TCh::LfCh)){
438  FldValStr+=Ch; GetCh();}
439  if (IsLws()){FldValStr+=' ';}
440  } while (IsLws());
441  return FldValStr;
442 }
443 
445 // Http-Character-Returner
448  int Chs, ChN;
450 public:
451  THttpChRet(const PSIn& _SIn, const THttpExCd& _HttpExCd):
452  SIn(_SIn), Chs(SIn->Len()), ChN(0), HttpExCd(_HttpExCd){}
453  THttpChRet& operator=(const THttpChRet&){Fail; return *this;}
454  bool Eof(){return ChN==Chs;}
455  char GetCh(){
456  if (ChN>=Chs){throw THttpEx(HttpExCd);}
457  ChN++; return SIn->GetCh();}
458 };
459 
461 // Http-Request
462 void THttpRq::ParseSearch(const TStr& SearchStr){
463  PSIn SIn=TStrIn::New(SearchStr);
464  THttpChRet ChRet(SIn, heBadSearchStr);
465  try {
466  // check empty search string
467  if (ChRet.Eof()){return;}
468  // require '?' at the beginning
469  if (ChRet.GetCh()!='?'){
470  throw THttpEx(heBadSearchStr);}
471  // parse key=val{&...} pairs
472  TChA KeyNm; TChA ValStr;
473  while (!ChRet.Eof()){
474  char Ch; KeyNm.Clr(); ValStr.Clr();
475  // key
476  while ((Ch=ChRet.GetCh())!='='){
477  switch (Ch){
478  case '%':{
479  char Ch1=ChRet.GetCh();
480  if (!TCh::IsHex(Ch1)) { throw THttpEx(heBadSearchStr); }
481  char Ch2=ChRet.GetCh();
482  if (!TCh::IsHex(Ch2)) { throw THttpEx(heBadSearchStr); }
483  KeyNm.AddCh(char(16*TCh::GetHex(Ch1)+TCh::GetHex(Ch2)));} break;
484  case '+': KeyNm.AddCh(' '); break;
485  case '&': throw THttpEx(heBadSearchStr);
486  default: KeyNm.AddCh(Ch);
487  }
488  }
489  // equals
490  if (Ch!='='){
491  throw THttpEx(heBadSearchStr);}
492  // value
493  while ((!ChRet.Eof())&&((Ch=ChRet.GetCh())!='&')){
494  switch (Ch){
495  case '%':{
496  char Ch1=ChRet.GetCh();
497  if (!TCh::IsHex(Ch1)) { throw THttpEx(heBadSearchStr); }
498  char Ch2=ChRet.GetCh();
499  if (!TCh::IsHex(Ch2)) { throw THttpEx(heBadSearchStr); }
500  ValStr.AddCh(char(16*TCh::GetHex(Ch1)+TCh::GetHex(Ch2)));} break;
501  case '+': ValStr.AddCh(' '); break;
502  case '&': throw THttpEx(heBadSearchStr);
503  default: ValStr.AddCh(Ch);
504  }
505  }
506  // save key-value pair
507  UrlEnv->AddToKeyVal(KeyNm, ValStr);
508  }
509  }
510  catch (const THttpEx&){Ok=false;}
511 }
512 
513 void THttpRq::ParseHttpRq(const PSIn& SIn){
514  THttpLx Lx(SIn);
515  // initial status
516  Ok=false;
517  CompleteP=false;
518  // request-line
519  Method=Lx.GetRqMethod();
520  Lx.GetWs();
521  //Url=Lx.GetUrl();
522  TStr UrlStr=Lx.GetUrlStr();
523  Lx.GetWs();
524  Lx.GetToken(THttp::HttpStr); Lx.GetSpec(THttp::SlashStr);
525  MajorVerN=Lx.GetInt(1); Lx.GetPeriod(); MinorVerN=Lx.GetInt(1);
526  Lx.GetCrLf();
527  // header fields & values
528  while ((!Lx.Eof())&&(!Lx.IsCrLf())){
529  TStr FldNm=Lx.GetToken(); Lx.GetSpec(THttp::ColonStr);
530  TStr FldVal=Lx.GetFldVal();
531  Lx.GetCrLf();
532  TStr NrFldNm=THttpLx::GetNrStr(FldNm);
533  FldNmToValH.AddDat(NrFldNm, FldVal);
534  }
535  // separator CrLf
536  if (!Lx.IsCrLf()){return;} // to avoid exceptions
537  Lx.GetCrLf();
538  // header & body strings
539  HdStr=Lx.GetMemSf().GetAsStr();
540  Lx.ClrMemSf();
541  Lx.GetRest();
542  BodyMem=Lx.GetMemSf();
543  // completeness
544  int ContLen=GetFldVal(THttp::ContLenFldNm).GetInt(-1);
545  if (ContLen==-1){
546  // if not content-len is given we assume http-request is ok
547  CompleteP=true;
548  } else {
549  if (ContLen<=BodyMem.Len()){
550  // if we read enough data, we claim completeness
551  CompleteP=true;
552  BodyMem.Trunc(ContLen);
553  } else {
554  // if we read not enough data we claim incompleteness
555  CompleteP=false;
556  }
557  }
558  // url
559  if (CompleteP){
560  const TStr LocalBaseUrlStr="http://localhost/";
561  Url=TUrl::New(UrlStr, LocalBaseUrlStr);
562  if (!Url->IsOk()){
563  throw THttpEx(heBadUrl);}
564  }
565  // search string
566  TStr SearchStr;
567  if (Method==hrmGet){
568  SearchStr=Url->GetSearchStr();
569  } else
570  if ((Method==hrmPost)&&(
571  (!IsFldNm(THttp::ContTypeFldNm))||
572  (GetFldVal(THttp::ContTypeFldNm)==THttp::TextHtmlFldVal)||
573  (GetFldVal(THttp::ContTypeFldNm)==THttp::AppW3FormFldVal))){
574  SearchStr=TStr("?")+BodyMem.GetAsStr();
575  }
576  ParseSearch(SearchStr);
577  // at this point ok=true
578  Ok=true;
579 }
580 
581 THttpRq::THttpRq(const PSIn& SIn):
582  Ok(false), MajorVerN(0), MinorVerN(0), Method(hrmUndef),
583  FldNmToValH(), UrlEnv(TUrlEnv::New()),
584  HdStr(), BodyMem(){
585  try {
586  ParseHttpRq(SIn);
587  }
588  catch (const THttpEx&){Ok=false;}
589 }
590 
592  const THttpRqMethod& _Method, const PUrl& _Url,
593  const TStr& ContTypeFldVal, const TMem& _BodyMem, const int& FetchId):
594  Ok(false),
595  MajorVerN(1), MinorVerN(0),
596  Method(_Method),
597  Url(_Url),
598  FldNmToValH(),
599  UrlEnv(TUrlEnv::New()),
600  HdStr(), BodyMem(_BodyMem){
601  // compose head-http-request
602  TChA HdChA;
603  if (Url->IsOk()){
604  TStr AbsPath=Url->GetPathStr()+Url->GetSearchStr();
605  HdChA+=GetMethodNm(); HdChA+=' '; HdChA+=AbsPath; HdChA+=" HTTP/1.0\r\n";
606  }
607  // add content-type
608  if (!ContTypeFldVal.Empty()){
609  FldNmToValH.AddDat(THttpLx::GetNrStr(THttp::ContTypeFldNm), ContTypeFldVal);
610  HdChA+=THttpLx::GetNrStr(THttp::ContTypeFldNm); HdChA+=": ";
611  HdChA+=ContTypeFldVal; HdChA+="\r\n";
612  }
613  // add host
614  if (Url->IsOk()){
615  TStr HostNm=Url->GetHostNm();
616  FldNmToValH.AddDat(THttpLx::GetNrStr(THttp::HostFldNm), HostNm);
617  HdChA+=THttpLx::GetNrStr(THttp::HostFldNm); HdChA+=": ";
618  HdChA+=HostNm; HdChA+="\r\n";
620  }
621  // add fetch-id
622  if (Url->IsOk()&&(FetchId!=-1)){
623  TStr FetchIdStr=TInt::GetStr(FetchId);
624  FldNmToValH.AddDat(THttpLx::GetNrStr(THttp::FetchIdFldNm), FetchIdStr);
625  HdChA+=THttpLx::GetNrStr(THttp::FetchIdFldNm); HdChA+=": ";
626  HdChA+=FetchIdStr; HdChA+="\r\n";
627  }
628  // finish head-http-request
629  if (Url->IsOk()){
630  HdChA+="\r\n";
631  HdStr=HdChA;
632  }
633  // set http-request ok
634  Ok=true;
635 }
636 
637 const TStr& THttpRq::GetMethodNm() const {
638  switch (Method){
639  case hrmGet: return THttp::GetMethodNm;
640  case hrmHead: return THttp::HeadMethodNm;
641  case hrmPost: return THttp::PostMethodNm;
642  default: return THttp::UndefMethodNm;
643  }
644 }
645 
646 bool THttpRq::IsFldNm(const TStr& FldNm) const {
647  return FldNmToValH.IsKey(THttpLx::GetNrStr(FldNm));
648 }
649 
650 TStr THttpRq::GetFldVal(const TStr& FldNm) const {
651  TStr NrFldNm=THttpLx::GetNrStr(FldNm);
652  if (FldNmToValH.IsKey(NrFldNm)){
653  return FldNmToValH.GetDat(NrFldNm);
654  } else {
655  return TStr();
656  }
657 }
658 
659 bool THttpRq::IsFldVal(const TStr& FldNm, const TStr& FldVal) const {
660  return THttpLx::GetNrStr(FldVal)==THttpLx::GetNrStr(GetFldVal(FldNm));
661 }
662 
663 
664 void THttpRq::AddFldVal(const TStr& FldNm, const TStr& FldVal){
665  TStr NrFldNm=THttpLx::GetNrStr(FldNm);
666  FldNmToValH.AddDat(NrFldNm, FldVal);
667 }
668 
670  return FldNmToValH;
671 }
672 
674  TChA ChA;
675  ChA+=GetMethodNm(); ChA+=' ';
676  ChA+=Url->GetUrlStr(); ChA+=' ';
677  ChA+="HTTP/1.0\r\n";
678  for (int FldN=0; FldN<FldNmToValH.Len(); FldN++){
679  ChA+=FldNmToValH.GetKey(FldN); ChA+=": ";
680  ChA+=FldNmToValH[FldN]; ChA+="\r\n";
681  }
682  if (!BodyMem.Empty()) {
683  ChA+=THttp::ContLenFldNm; ChA+=": ";
684  ChA+=TInt::GetStr(BodyMem.Len()); ChA+="\r\n";
685  }
686  ChA+="\r\n";
687  ChA+=BodyMem.GetAsStr();
688  return ChA;
689 }
690 
692 // Http-Response
693 void THttpResp::AddHdFld(const TStr& FldNm, const TStr& FldVal, TChA& HdChA){
694  TStr NrFldNm=THttpLx::GetNrStr(FldNm);
695  FldNmToValVH.AddDat(NrFldNm).Add(FldVal);
696  HdChA+=FldNm; HdChA+=": "; HdChA+=FldVal; HdChA+="\r\n";
697 }
698 
700  THttpLx Lx(SIn);
701  if (Lx.Eof()){
702  // no content
703  MajorVerN=0; MinorVerN=9; StatusCd=204;
704  HdStr.Clr(); BodyMem.Clr();
705  } else {
706  if (Lx.IsRespStatusLn()){
707  // status-line
708  Lx.GetToken(THttp::HttpStr); Lx.GetSpec(THttp::SlashStr);
709  MajorVerN=Lx.GetInt(1); Lx.GetPeriod(); MinorVerN=Lx.GetInt(1);
710  StatusCd=Lx.GetInt(3);
712  Lx.GetCrLf();
713  // header fields & values
714  while (!Lx.IsCrLf()){
715  TStr FldNm=Lx.GetToken(); Lx.GetSpec(THttp::ColonStr);
716  TStr FldVal=Lx.GetFldVal();
717  Lx.GetCrLf();
718  TStr NrFldNm=THttpLx::GetNrStr(FldNm);
719  FldNmToValVH.AddDat(NrFldNm).Add(FldVal);
720  }
721  // separator CrLf
722  Lx.GetCrLf();
723  // header & body strings
724  HdStr=Lx.GetMemSf().GetAsStr();
725  Lx.ClrMemSf();
726  Lx.GetRest();
727  BodyMem=Lx.GetMemSf();
728  } else {
729  // old fashion format
730  MajorVerN=0; MinorVerN=9; StatusCd=200;
731  HdStr.Clr();
732  Lx.ClrMemSf();
733  Lx.GetRest();
734  BodyMem=Lx.GetMemSf();
735  }
736  }
737  Ok=true;
738 }
739 
740 THttpResp::THttpResp(const int& _StatusCd, const TStr& ContTypeVal,
741  const bool& CacheCtrlP, const PSIn& BodySIn, const TStr LocStr):
742  Ok(true), MajorVerN(1), MinorVerN(0), StatusCd(_StatusCd), ReasonPhrase(),
743  FldNmToValVH(20), HdStr(), BodyMem(){
745  TChA HdChA;
746  // first line
747  HdChA+="HTTP/"; HdChA+=TInt::GetStr(MajorVerN); HdChA+=".";
748  HdChA+=TInt::GetStr(MinorVerN); HdChA+=' ';
749  HdChA+=TInt::GetStr(StatusCd); HdChA+=' ';
750  HdChA+=ReasonPhrase;
751  HdChA+="\r\n";
752  // header fields
753  // server
754  //AddHdFld(THttp::SrvFldNm, "Tralala", HdChA);
755  if (!LocStr.Empty()){
756  AddHdFld("Location", LocStr, HdChA);}
757  if (!BodySIn.Empty()){
758  // content-type
759  AddHdFld(THttp::ContTypeFldNm, ContTypeVal, HdChA);
760  // accept-ranges
761  AddHdFld(THttp::AcceptRangesFldNm, "bytes", HdChA);
762  // content-length
763  TStr ContLenVal=TInt::GetStr(BodySIn->Len());
764  AddHdFld(THttp::ContLenFldNm, ContLenVal, HdChA);
765  // cache-control
766  if (!CacheCtrlP){
767  AddHdFld(THttp::CacheCtrlFldNm, "no-cache", HdChA);}
768  }
769  // header/body separator
770  HdChA+="\r\n";
771  // header/body data
772  HdStr=HdChA;
773  if (!BodySIn.Empty()){
774  TMem::LoadMem(BodySIn, BodyMem);}
775 }
776 
778  Ok(false), MajorVerN(0), MinorVerN(0), StatusCd(-1), ReasonPhrase(),
779  FldNmToValVH(20), HdStr(), BodyMem(){
780  try {
781  ParseHttpResp(SIn);
782  }
783  catch (const THttpEx&){Ok=false;}
784 }
785 
786 bool THttpResp::IsFldNm(const TStr& FldNm) const {
787  return FldNmToValVH.IsKey(THttpLx::GetNrStr(FldNm));
788 }
789 
790 TStr THttpResp::GetFldVal(const TStr& FldNm, const int& ValN) const {
791  TStr NrFldNm=THttpLx::GetNrStr(FldNm);
792  if (FldNmToValVH.IsKey(NrFldNm)){
793  const TStrV& ValV=FldNmToValVH.GetDat(NrFldNm);
794  if (ValV.Len()>0){return ValV[ValN];} else {return TStr();}
795  } else {
796  return TStr();
797  }
798 }
799 
800 void THttpResp::GetFldValV(const TStr& FldNm, TStrV& FldValV) const {
801  TStr NrFldNm=THttpLx::GetNrStr(FldNm);
802  if (FldNmToValVH.IsKey(NrFldNm)){
803  FldValV=FldNmToValVH.GetDat(NrFldNm);
804  } else {
805  FldValV.Clr();
806  }
807 }
808 
809 bool THttpResp::IsFldVal(const TStr& FldNm, const TStr& FldVal) const {
810  return THttpLx::GetNrStr(FldVal)==THttpLx::GetNrStr(GetFldVal(FldNm));
811 }
812 
813 void THttpResp::AddFldVal(const TStr& FldNm, const TStr& FldVal){
814  TStr NrFldNm=THttpLx::GetNrStr(FldNm);
815  FldNmToValVH.AddDat(NrFldNm).Add(FldVal);
816  if (HdStr.IsSuffix("\r\n\r\n")){
817  TChA HdChA=HdStr;
818  HdChA.Pop(); HdChA.Pop();
819  HdChA+=NrFldNm; HdChA+=": "; HdChA+=FldVal;
820  HdChA+="\r\n\r\n";
821  HdStr=HdChA;
822  }
823 }
824 
825 void THttpResp::GetCookieKeyValDmPathQuV(TStrQuV& CookieKeyValDmPathQuV){
826  CookieKeyValDmPathQuV.Clr();
827  TStrV CookieFldValV; GetFldValV(THttp::SetCookieFldNm, CookieFldValV);
828  for (int CookieN=0; CookieN<CookieFldValV.Len(); CookieN++){
829  TStr CookieFldVal=CookieFldValV[CookieN];
830  TStrV KeyValStrV;
831  CookieFldVal.SplitOnAllCh(';', KeyValStrV, true);
832  TStrPrV KeyValPrV; TStr DmNm; TStr PathStr;
833  for (int KeyValStrN=0; KeyValStrN<KeyValStrV.Len(); KeyValStrN++){
834  TStr KeyValStr=KeyValStrV[KeyValStrN];
835  TStr KeyNm; TStr ValStr;
836  if (KeyValStr.IsChIn('=')){
837  KeyValStrV[KeyValStrN].SplitOnCh(KeyNm, '=', ValStr);
838  KeyNm.ToTrunc(); ValStr.ToTrunc();
839  } else {
840  KeyNm=KeyValStr.GetTrunc();
841  }
842  if (KeyNm=="expires"){}
843  else if (KeyNm=="domain"){DmNm=ValStr;}
844  else if (KeyNm=="path"){PathStr=ValStr;}
845  else if (KeyNm=="expires"){}
846  else if (KeyNm=="secure"){}
847  else if (KeyNm=="httponly"){}
848  else if (!KeyNm.Empty()){
849  KeyValPrV.Add(TStrPr(KeyNm, ValStr));
850  }
851  }
852  for (int KeyValPrN=0; KeyValPrN<KeyValPrV.Len(); KeyValPrN++){
853  TStr KeyNm=KeyValPrV[KeyValPrN].Val1;
854  TStr ValStr=KeyValPrV[KeyValPrN].Val2;
855  CookieKeyValDmPathQuV.Add(TStrQu(KeyNm, ValStr, DmNm, PathStr));
856  }
857  }
858 }
859 
861  TMOut MOut(HdStr.Len()+BodyMem.Len());
862  MOut.PutStr(HdStr); MOut.PutMem(BodyMem);
863  return MOut.GetSIn();
864 }
865 
#define IAssert(Cond)
Definition: bd.h:262
TQuad< TStr, TStr, TStr, TStr > TStrQu
Definition: ds.h:262
static bool IsHex(const char &Ch)
Definition: dt.h:1067
int GetInt() const
Definition: dt.h:578
void ParseSearch(const TStr &SearchStr)
Definition: http.cpp:462
bool IsLws(const char &Ch)
Definition: http.cpp:110
TStr ReasonPhrase
Definition: http.h:139
TStr GetFldVal(const TStr &FldNm) const
Definition: http.cpp:650
TStrStrH FldNmToValH
Definition: http.h:74
void GetPeriod()
Definition: http.cpp:394
bool Empty()
Definition: ds.h:2591
static const TStr ContTypeFldNm
Definition: http.h:12
TStr GetStr() const
Definition: dt.h:1197
char Pop()
Definition: dt.h:139
char GetFirstCh()
Definition: http.cpp:230
static const TStr ImageIcoFldVal
Definition: http.h:32
TStr GetAsStr(const char &NewNullCh='\0') const
Definition: dt.cpp:303
int Len() const
Definition: dt.h:487
static const int DfPortN
Definition: http.h:46
const TStrStrH & GetFldValH() const
Definition: http.cpp:669
int MinorVerN
Definition: http.h:137
THttpEx(const THttpExCd &_HttpExCd)
Definition: http.cpp:174
void AddFldVal(const TStr &FldNm, const TStr &FldVal)
Definition: http.cpp:813
TPair< TStr, TStr > TStrPr
Definition: ds.h:107
static const int BadRqStatusCd
Definition: http.h:50
static TStr GetNrStr(const TStr &Str)
Definition: http.cpp:226
char GetCh()
Definition: http.cpp:239
void GetFldValV(const TStr &FldNm, TStrV &FldValV) const
Definition: http.cpp:800
static const TStr GetMethodNm
Definition: http.h:56
TStr GetFldVal(const TStr &FldNm, const int &ValN=0) const
Definition: http.cpp:790
TStrStrVH FldNmToValVH
Definition: http.h:140
Definition: url.h:7
TStr HdStr
Definition: http.h:141
static const TStr GifFExt
Definition: fl.h:645
#define forever
Definition: bd.h:6
static const TStr HttpStr
Definition: http.h:8
PSIn SIn
Definition: http.cpp:182
int Len() const
Definition: dt.h:134
static const TStr HostFldNm
Definition: http.h:14
TVal & Top()
Definition: ds.h:2595
bool Empty() const
Definition: dt.h:260
#define Fail
Definition: bd.h:238
static const int RedirStatusCd
Definition: http.h:49
bool Empty() const
Definition: bd.h:501
TStr GetUc() const
Definition: dt.h:493
static const char NullCh
Definition: dt.h:1033
void PutCh(const int &ChN, const char &Ch)
Definition: dt.h:278
void AddToKeyVal(const TStr &KeyNm, const TStr &ValStr)
Definition: url.h:144
void Clr()
Definition: dt.h:258
void AddCh(const char &Ch, const int &MxLen=-1)
Definition: dt.h:271
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
int Len()
Definition: http.cpp:197
Definition: http.h:65
TStr GetSpec(const TStr &ExpectStr=TStr())
Definition: http.cpp:413
bool IsDigit(const char &Ch)
Definition: http.cpp:108
TStr GetRespReasonPhrase()
Definition: http.cpp:315
bool IsFldNm(const TStr &FldNm) const
Definition: http.cpp:786
THttpRqMethod
Definition: http.h:64
static int GetHex(const char &Ch)
Definition: dt.h:1069
static const TStr HtmlFExt
Definition: fl.h:643
static PUrl New(const TStr &RelUrlStr, const TStr &BaseUrlStr=TStr())
Definition: url.h:25
int Len() const
Definition: dt.h:259
void GetWs()
Definition: http.cpp:323
static const TStr AcceptRangesFldNm
Definition: http.h:15
bool IsOk(const TUrlScheme _Scheme=usUndef) const
Definition: url.h:32
bool Ok
Definition: http.h:69
void GetCrLf()
Definition: http.cpp:382
TBoolChS EofChPrS
Definition: http.cpp:184
bool IsText(const char &Ch)
Definition: http.cpp:112
bool IsLf(const char &Ch)
Definition: http.cpp:116
THttpChDef()
Definition: http.cpp:134
TStr GetUrlStr()
Definition: http.cpp:286
static const TStr ConnFldNm
Definition: http.h:19
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
THttpRqMethod GetRqMethod()
Definition: http.cpp:261
static THttpChDef ChDef
Definition: http.cpp:181
static const TStr TextCssFldVal
Definition: http.h:31
int StatusCd
Definition: http.h:138
static TStr GetReasonPhrase(const int &StatusCd)
Definition: http.cpp:62
void Clr()
Definition: dt.h:486
void ParseHttpResp(const PSIn &SIn)
Definition: http.cpp:699
Definition: http.h:65
bool Eof()
Definition: http.cpp:454
THttpExCd HttpExCd
Definition: http.cpp:449
TPt< TUrl > PUrl
Definition: url.h:7
static const TStr AcceptFldNm
Definition: http.h:17
static const int ErrStatusCd
Definition: http.h:51
static bool IsHtmlFExt(const TStr &FExt)
Definition: http.cpp:42
static bool IsGifFExt(const TStr &FExt)
Definition: http.cpp:47
int ChN
Definition: http.cpp:448
static const TStr TextPlainFldVal
Definition: http.h:26
bool IsDQuote(const char &Ch)
Definition: http.cpp:119
THttpChRet(const PSIn &_SIn, const THttpExCd &_HttpExCd)
Definition: http.cpp:451
static const TStr CookieFldNm
Definition: http.h:23
PUrl GetUrl()
Definition: http.cpp:273
Definition: dt.h:77
PSIn GetSIn() const
Definition: http.cpp:860
static const char Mx
Definition: dt.h:1030
char Ch
Definition: http.cpp:185
static const TStr HeadMethodNm
Definition: http.h:57
static const TStr PostMethodNm
Definition: http.h:58
TStr GetPathStr() const
Definition: url.h:46
static const TStr ColonStr
Definition: http.h:10
Definition: url.h:103
TStr GetToken(const TStr &ExpectStr=TStr())
Definition: http.cpp:400
static const TStr ImageGifFldVal
Definition: http.h:34
void GetRest()
Definition: http.cpp:254
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:1022
TStr GetHostNm() const
Definition: url.h:41
THttpResp(const int &_StatusCd, const TStr &ContTypeVal, const bool &CacheCtrlP, const PSIn &BodySIn, const TStr LocStr)
Definition: http.cpp:740
static const TStr AppOctetFldVal
Definition: http.h:36
bool IsRespStatusLn()
Definition: http.cpp:295
virtual bool Eof()=0
void PutAll(const TVal &Val)
Sets all elements of the vector to value Val.
Definition: ds.h:1229
static const TStr HtmFExt
Definition: fl.h:644
Definition: dt.h:1025
bool CompleteP
Definition: http.h:70
THttpChTy
Definition: http.cpp:92
static const int ErrNotFoundStatusCd
Definition: http.h:52
static const TStr UndefMethodNm
Definition: http.h:59
static const char TabCh
Definition: dt.h:1034
static const char Mn
Definition: dt.h:1029
TStr HdStr
Definition: http.h:76
TPair< TBool, TCh > TBoolChPr
Definition: ds.h:76
bool IsSuffix(const char *Str) const
Definition: dt.cpp:1093
static const TStr CacheCtrlFldNm
Definition: http.h:16
static PSIn New(const TStr &Str)
Definition: dt.h:708
PSIn SIn
Definition: http.cpp:447
static const TStr LocFldNm
Definition: http.h:21
void GetCookieKeyValDmPathQuV(TStrQuV &CookieKeyValDmPathQuV)
Definition: http.cpp:825
void AddFldVal(const TStr &FldNm, const TStr &FldVal)
Definition: http.cpp:664
Definition: http.h:65
THttpLx & operator=(const THttpLx &)
Definition: http.cpp:193
bool IsSp(const char &Ch)
Definition: http.cpp:117
bool Eof()
Definition: http.cpp:196
TStr GetLcStr(const TStr &Str)
Definition: http.cpp:156
static const TStr TextHtmlFldVal
Definition: http.h:27
void ClrMemSf()
Definition: http.cpp:203
TStr GetUrlStr() const
Definition: url.h:36
bool IsFldVal(const TStr &FldNm, const TStr &FldVal) const
Definition: http.cpp:659
void Trunc(const int &_BfL)
Definition: dt.h:136
static const TStr AppJSonFldVal
Definition: http.h:39
static const int OkStatusCd
Definition: http.h:48
int Len()
Definition: ds.h:2594
TMem SfMem
Definition: http.cpp:187
static const TStr ContLenFldNm
Definition: http.h:13
static const TStr SlashStr
Definition: http.h:9
static const TStr TextJavaScriptFldVal
Definition: http.h:30
static const char LfCh
Definition: dt.h:1035
static const TStr TextWmlFldVal
Definition: http.h:29
TStr GetFldVal()
Definition: http.cpp:433
Definition: dt.h:1134
Definition: http.h:65
bool IsAlpha(const char &Ch)
Definition: http.cpp:107
static void LoadMem(const PSIn &SIn, TMem &Mem)
Definition: dt.h:149
int Chs
Definition: http.cpp:448
int MajorVerN
Definition: http.h:137
Definition: http.cpp:92
Definition: fl.h:495
static const TStr TextXmlFldVal
Definition: http.h:28
PUrl Url
Definition: http.h:73
Definition: dt.h:201
TStr GetSearchStr() const
Definition: url.h:49
int MinorVerN
Definition: http.h:71
bool IsCr(const char &Ch)
Definition: http.cpp:115
void Push()
Definition: ds.h:2597
static const TStr ConnKeepAliveFldVal
Definition: http.h:40
TStr GetTrunc() const
Definition: dt.h:506
void GetLws()
Definition: http.cpp:348
char GetLcCh(const char &Ch)
Definition: http.cpp:121
THttpChDef & operator=(const THttpChDef &)
Definition: http.cpp:104
bool Ok
Definition: http.h:136
bool IsFldNm(const TStr &FldNm) const
Definition: http.cpp:646
char GetCh()
Definition: http.cpp:455
void Pop()
Definition: ds.h:2599
TMem BodyMem
Definition: http.h:77
void ParseHttpRq(const PSIn &SIn)
Definition: http.cpp:513
bool IsCtl(const char &Ch)
Definition: http.cpp:109
Definition: dt.h:412
bool Empty() const
Definition: dt.h:488
TMem BodyMem
Definition: http.h:142
TIntV ChTyV
Definition: http.cpp:96
bool IsChIn(const char &Ch) const
Definition: dt.h:553
TStr & ToTrunc()
Definition: dt.cpp:770
void AddHdFld(const TStr &FldNm, const TStr &FldVal, TChA &HdChA)
Definition: http.cpp:693
int PutStr(const char *CStr)
Definition: fl.cpp:117
void SplitOnAllCh(const char &SplitCh, TStrV &StrV, const bool &SkipEmpty=true) const
Definition: dt.cpp:926
static const char CrCh
Definition: dt.h:1036
TChV LcChV
Definition: http.cpp:97
THttpRq(const PSIn &SIn)
Definition: http.cpp:581
bool IsLws()
Definition: http.cpp:327
THttpRqMethod Method
Definition: http.h:72
static const int InternalErrStatusCd
Definition: http.h:53
void SetLcCh(const TStr &Str)
Definition: http.cpp:131
TVal1 Val1
Definition: ds.h:34
int MajorVerN
Definition: http.h:71
TVal2 Val2
Definition: ds.h:35
static const TStr TextFldVal
Definition: http.h:25
static const TStr FetchIdFldNm
Definition: http.h:20
PUrlEnv UrlEnv
Definition: http.h:75
static const TStr AppW3FormFldVal
Definition: http.h:38
int GetChTy(const char &Ch)
Definition: http.cpp:106
TMem & GetMemSf()
Definition: http.cpp:204
TStr GetStr() const
Definition: http.cpp:673
THttpChRet & operator=(const THttpChRet &)
Definition: http.cpp:453
virtual char GetCh()=0
bool Empty() const
Definition: dt.h:135
static const TStr ImagePngFldVal
Definition: http.h:33
void SetChTy(const THttpChTy &ChTy, const char &Ch)
Definition: http.cpp:125
char Pop()
Definition: dt.h:265
bool IsKey(const TKey &Key) const
Definition: hash.h:258
bool IsSpec(const char &Ch)
Definition: http.cpp:113
virtual int Len() const =0
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
bool IsFldVal(const TStr &FldNm, const TStr &FldVal) const
Definition: http.cpp:809
static const TStr SrvFldNm
Definition: http.h:18
THttpLx(const PSIn &_SIn)
Definition: http.cpp:189
int GetInt(const int &RqPlaces=-1)
Definition: http.cpp:422
int Len() const
Definition: hash.h:228
static const TStr ImageJpgFldVal
Definition: http.h:35
bool IsCrLf()
Definition: http.cpp:371
void PutCh(const char &_Ch)
Definition: http.cpp:201
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
THttpExCd
Definition: http.cpp:164
bool IsHt(const char &Ch)
Definition: http.cpp:118
bool AtEof
Definition: http.cpp:186
const TKey & GetKey(const int &KeyId) const
Definition: hash.h:252
const TStr & GetMethodNm() const
Definition: http.cpp:637
static const TStr AppSoapXmlFldVal
Definition: http.h:37
THttpExCd HttpExCd
Definition: http.cpp:172
void Clr(const bool &DoDel=true)
Definition: dt.h:131
static const TStr SetCookieFldNm
Definition: http.h:22