mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
* HTTP.cpp : fix parse_header_line (#501)
This commit is contained in:
parent
2e1a9a8df9
commit
43a90d7b98
2 changed files with 8 additions and 2 deletions
3
HTTP.cpp
3
HTTP.cpp
|
@ -45,9 +45,10 @@ namespace http {
|
|||
bool parse_header_line(const std::string & line, std::map<std::string, std::string> & headers) {
|
||||
std::size_t pos = 0;
|
||||
std::size_t len = 2; /* strlen(": ") */
|
||||
std::size_t max = line.length();
|
||||
if ((pos = line.find(": ", pos)) == std::string::npos)
|
||||
return false;
|
||||
while (isspace(line.at(pos + len)))
|
||||
while ((pos + len) < max && isspace(line.at(pos + len)))
|
||||
len++;
|
||||
std::string name = line.substr(0, pos);
|
||||
std::string value = line.substr(pos + len);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue