MCPcopy Create free account
hub / github.com/SpartanJ/eepp / parseFields

Method parseFields

src/eepp/network/http.cpp:597–615  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

595}
596
597void Http::Response::parseFields( std::istream& in ) {
598 std::string line;
599 while ( std::getline( in, line ) && ( line.size() > 2 ) ) {
600 std::string::size_type pos = line.find( ": " );
601
602 if ( pos != std::string::npos ) {
603 // Extract the field name and its value
604 std::string field = line.substr( 0, pos );
605 std::string value = line.substr( pos + 2 );
606
607 // Remove any trailing \r
608 if ( !value.empty() && ( *value.rbegin() == '\r' ) )
609 value.erase( value.size() - 1 );
610
611 // Add the field
612 mFields[String::toLower( field )] = value;
613 }
614 }
615}
616
617static Http::Pool sGlobalHttpPool = Http::Pool();
618

Callers 1

downloadRequestMethod · 0.80

Calls 6

substrMethod · 0.80
rbeginMethod · 0.80
sizeMethod · 0.45
findMethod · 0.45
emptyMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected