i2p: clean up SAM error logging

SESSION CREATE requests can contain the I2P private key. Keep using the redacted request text in error messages, and avoid echoing raw SAM replies in the generic reply error path.

This keeps the error useful while avoiding logging either the private-key-bearing request or unescaped router-controlled reply bytes. No network behavior change is intended.
This commit is contained in:
takeshikurosawaa
2026-05-15 15:48:33 +03:00
parent ddb94fd3e1
commit b6c3670442

View File

@@ -285,7 +285,7 @@ std::string Session::Reply::Get(const std::string& key) const
const auto& pos = keys.find(key);
if (pos == keys.end() || !pos->second.has_value()) {
throw std::runtime_error(
strprintf("Missing %s= in the reply to \"%s\": \"%s\"", key, request, full));
strprintf("Missing %s= in the reply to \"%s\"", key, request));
}
return pos->second.value();
}
@@ -320,7 +320,7 @@ Session::Reply Session::SendRequestAndGetReply(const Sock& sock,
if (check_result_ok && reply.Get("RESULT") != "OK") {
throw std::runtime_error(
strprintf("Unexpected reply to \"%s\": \"%s\"", request, reply.full));
strprintf("Reply to \"%s\": had a RESULT not equal to OK.", reply.request));
}
return reply;