From 421136b2646ff2eff2b80dc01afcba5af9f31fd4 Mon Sep 17 00:00:00 2001 From: orignal Date: Mon, 31 Aug 2026 21:51:30 -0400 Subject: [PATCH] accept both addresses ending with rpc or rpc/. Accept all content type starting with application/json --- libi2pd_client/TorrentsRPC.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libi2pd_client/TorrentsRPC.cpp b/libi2pd_client/TorrentsRPC.cpp index ca4b5158..611d77c4 100644 --- a/libi2pd_client/TorrentsRPC.cpp +++ b/libi2pd_client/TorrentsRPC.cpp @@ -539,7 +539,8 @@ namespace torrents auto tunnel = m_Server.GetTunnel ( {path.data (), path.size ()}); // boost::beast::string_view to std::string_view if (tunnel) { - if (m_Request[boost::beast::http::field::content_type] == "application/json" || + static constexpr std::string_view appjson { "application/json" }; + if (m_Request[boost::beast::http::field::content_type].compare (0, appjson.size (), appjson) || // starts with m_Request[boost::beast::http::field::content_type] == "application/x-www-form-urlencoded") { #ifdef JSON_SUPPORTED @@ -616,7 +617,10 @@ namespace torrents std::string rpcPath ("/"); if (!path.empty ()) rpcPath += std::string (path) + "/"; - rpcPath += "rpc/"; + // insert both pathes rpc and rpc/ + rpcPath += "rpc"; + m_Tunnels.emplace (rpcPath, tunnel); + rpcPath += "/"; m_Tunnels.emplace (rpcPath, tunnel); }