fix(I2PControl): use boost::iequals for RFC-compliant Content-Length parsing

Use case-insensitive comparison via boost::iequals to handle all
Content-Length header variations per RFC 2616.
This commit is contained in:
Łukasz Jerciński
2025-11-25 18:26:17 +01:00
parent 86ddc033e5
commit e4365e5aeb
+3 -6
View File
@@ -15,6 +15,7 @@
// Use global placeholders from boost introduced when local_time.hpp is loaded
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
#include <boost/property_tree/json_parser.hpp>
#include <boost/algorithm/string.hpp>
#include "FS.h"
#include "Log.h"
@@ -247,12 +248,8 @@ namespace client
{
std::getline(ss, header);
auto colon = header.find (':');
if (colon != std::string::npos)
{
auto name = header.substr (0, colon);
if (name == "Content-Length" || name == "content-length")
contentLength = std::stoi (header.substr (colon + 1));
}
if (colon != std::string::npos && boost::iequals (header.substr (0, colon), "Content-Length"))
contentLength = std::stoi (header.substr (colon + 1));
}
if (ss.eof ())
{