fork download
  1. std::size_t position = 0;
  2. std::string length {""}, header_name {""}, header_value {""};
  3. bool in_length = true, in_header_name = false, in_header_value = false, in_req_body = false;
  4.  
  5. for(auto it = raw_scgi_netstring.begin(); it != raw_scgi_netstring.end(); ++it)
  6. {
  7. if(*it == ',')
  8. {
  9. in_req_body = true;
  10. in_length = false;
  11. in_header_name = false;
  12. in_header_value = false;
  13.  
  14. // skip to next character
  15. it++;
  16. }
  17. else if(in_length)
  18. {
  19. if(*it == ':')
  20. {
  21. in_length = false;
  22. in_header_name = true;
  23.  
  24. // skip to next character
  25. it++;
  26. }
  27. else
  28. {
  29. length.push_back(raw_scgi_netstring.at(*it));
  30. }
  31. }
  32. else if(in_header_name)
  33. {
  34. if(*it == '\0')
  35. {
  36. in_header_name = false;
  37. in_header_value = true;
  38.  
  39. // skip to next character
  40. it++;
  41. }
  42. else
  43. {
  44.  
  45. }
  46. }
  47. else if(in_header_value)
  48. {
  49. if(*it == '\0')
  50. {
  51. in_header_value = false;
  52. in_header_name = true;
  53.  
  54. // skip to next character
  55. it++;
  56. }
  57. else
  58. {
  59.  
  60. }
  61. }
  62. else if(in_req_body)
  63. {
  64.  
  65. }
  66.  
  67. position++;
  68. }
  69. this->length = std::stoull(length);
  70. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:2: error: ‘size_t’ in namespace ‘std’ does not name a type
  std::size_t position = 0;
  ^
prog.cpp:2:2: error: ‘string’ in namespace ‘std’ does not name a type
  std::string length {""}, header_name {""}, header_value {""};
  ^
prog.cpp:2:25: error: expected unqualified-id before ‘,’ token
  std::string length {""}, header_name {""}, header_value {""};
                         ^
prog.cpp:2:39: error: expected constructor, destructor, or type conversion before ‘{’ token
  std::string length {""}, header_name {""}, header_value {""};
                                       ^
prog.cpp:2:43: error: expected unqualified-id before ‘,’ token
  std::string length {""}, header_name {""}, header_value {""};
                                           ^
prog.cpp:2:58: error: expected constructor, destructor, or type conversion before ‘{’ token
  std::string length {""}, header_name {""}, header_value {""};
                                                          ^
prog.cpp:5:2: error: expected unqualified-id before ‘for’
  for(auto it = raw_scgi_netstring.begin(); it != raw_scgi_netstring.end(); ++it)
  ^
prog.cpp:5:44: error: ‘it’ does not name a type
  for(auto it = raw_scgi_netstring.begin(); it != raw_scgi_netstring.end(); ++it)
                                            ^
prog.cpp:5:76: error: expected unqualified-id before ‘++’ token
  for(auto it = raw_scgi_netstring.begin(); it != raw_scgi_netstring.end(); ++it)
                                                                            ^
stdout
Standard output is empty