mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-10 11:28:27 +01:00
fixed mapping
This commit is contained in:
parent
4d2b535b04
commit
d8f24b442b
1 changed files with 17 additions and 14 deletions
29
I2CP.cpp
29
I2CP.cpp
|
@ -276,22 +276,25 @@ namespace client
|
|||
size_t offset = 0;
|
||||
while (offset < len)
|
||||
{
|
||||
auto semicolon = (const uint8_t *)memchr (buf + offset, ';', len - offset);
|
||||
if (semicolon)
|
||||
std::string param = ExtractString (buf + offset, len - offset);
|
||||
offset += param.length ();
|
||||
if (buf[offset] != '=')
|
||||
{
|
||||
auto l = semicolon - buf - offset + 1;
|
||||
auto equal = (const uint8_t *)memchr (buf + offset, '=', l);
|
||||
if (equal)
|
||||
{
|
||||
auto l1 = equal - buf - offset + 1;
|
||||
mapping.insert (std::make_pair (std::string ((const char *)(buf + offset), l1 -1),
|
||||
std::string ((const char *)(buf + offset + l1), l - l1 - 2)));
|
||||
}
|
||||
offset += l;
|
||||
}
|
||||
else
|
||||
LogPrint (eLogWarning, "I2CP: Unexpected character ", buf[offset], " instead '=' after ", param);
|
||||
break;
|
||||
}
|
||||
offset++;
|
||||
|
||||
std::string value = ExtractString (buf + offset, len - offset);
|
||||
offset += value.length ();
|
||||
if (buf[offset] != ';')
|
||||
{
|
||||
LogPrint (eLogWarning, "I2CP: Unexpected character ", buf[offset], " instead ';' after ", value);
|
||||
break;
|
||||
}
|
||||
offset++;
|
||||
mapping.insert (std::make_pair (param, value));
|
||||
}
|
||||
}
|
||||
|
||||
void I2CPSession::GetDateMessageHandler (const uint8_t * buf, size_t len)
|
||||
|
|
Loading…
Add table
Reference in a new issue