| 120 | using HeadersVector = std::vector<std::pair<std::string, std::string>>; |
| 121 | |
| 122 | HeadersVector ParseHeaders(std::string const & raw) |
| 123 | { |
| 124 | std::istringstream stream(raw); |
| 125 | HeadersVector headers; |
| 126 | std::string line; |
| 127 | while (getline(stream, line)) |
| 128 | { |
| 129 | auto const cr = line.rfind('\r'); |
| 130 | if (cr != std::string::npos) |
| 131 | line.erase(cr); |
| 132 | |
| 133 | auto const delims = line.find(": "); |
| 134 | if (delims != std::string::npos) |
| 135 | headers.emplace_back(line.substr(0, delims), line.substr(delims + 2)); |
| 136 | } |
| 137 | return headers; |
| 138 | } |
| 139 | |
| 140 | bool WriteToFile(std::string const & fileName, std::string const & data) |
| 141 | { |
no test coverage detected