MCPcopy Create free account
hub / github.com/SFML/SFML / parseFields

Method parseFields

src/SFML/Network/Http.cpp:271–291  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

269
270////////////////////////////////////////////////////////////
271void Http::Response::parseFields(std::istream& in)
272{
273 std::string line;
274 while (std::getline(in, line) && (line.size() > 2))
275 {
276 const std::string::size_type pos = line.find(": ");
277 if (pos != std::string::npos)
278 {
279 // Extract the field name and its value
280 const std::string field = line.substr(0, pos);
281 std::string value = line.substr(pos + 2);
282
283 // Remove any trailing \r
284 if (!value.empty() && (*value.rbegin() == '\r'))
285 value.erase(value.size() - 1);
286
287 // Add the field
288 m_fields[toLower(field)] = value;
289 }
290 }
291}
292
293
294////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 3

toLowerFunction · 0.85
findMethod · 0.80
eraseMethod · 0.80

Tested by

no test coverage detected