Jun 16th update

This commit is contained in:
noam
2023-01-17 11:34:09 +02:00
parent 90bcc544a2
commit ad04b8d063
168 changed files with 64034 additions and 932 deletions

View File

@@ -16,7 +16,6 @@
#include <unistd.h>
#include <sstream>
#include <sys/socket.h>
#include <boost/algorithm/string.hpp>
#include "debug.h"
@@ -35,6 +34,18 @@ RestConn::~RestConn()
{
}
static bool
compareStringCaseInsensitive(const string &s1, const string &s2)
{
if (s1.size() != s2.size()) return false;
for (size_t index = 0; index < s1.size(); ++index) {
if (tolower(s1[index]) != tolower(s2[index])) return false;
}
return true;
}
void
RestConn::parseConn() const
{
@@ -69,7 +80,7 @@ RestConn::parseConn() const
os.str(line);
string head, data;
os >> head >> data;
if (boost::iequals(head, "Content-Length:")) {
if (compareStringCaseInsensitive(head, "Content-Length:")) {
try {
len = stoi(data, nullptr);
} catch (...) {