MCPcopy Create free account
hub / github.com/comaps/comaps / ParseHeaders

Function ParseHeaders

libs/platform/http_client_curl.cpp:122–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120using HeadersVector = std::vector<std::pair<std::string, std::string>>;
121
122HeadersVector 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
140bool WriteToFile(std::string const & fileName, std::string const & data)
141{

Callers 1

RunHttpRequestMethod · 0.85

Calls 3

eraseMethod · 0.45
findMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected