From e4365e5aebf201283a8f80290925df7e37985043 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Jerci=C5=84ski?= Date: Tue, 25 Nov 2025 18:26:17 +0100 Subject: [PATCH] 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. --- daemon/I2PControl.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/daemon/I2PControl.cpp b/daemon/I2PControl.cpp index c24c6eb2..95badb8a 100644 --- a/daemon/I2PControl.cpp +++ b/daemon/I2PControl.cpp @@ -15,6 +15,7 @@ // Use global placeholders from boost introduced when local_time.hpp is loaded #define BOOST_BIND_GLOBAL_PLACEHOLDERS #include +#include #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 ()) {