mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2026-08-27 22:35:02 +00:00
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:
@@ -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 ())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user