summaryrefslogtreecommitdiff
path: root/http
diff options
context:
space:
mode:
Diffstat (limited to 'http')
-rw-r--r--http/http2_connection.hpp1
-rw-r--r--http/http_connection.hpp8
-rw-r--r--http/parsing.hpp17
-rw-r--r--http/server_sent_event.hpp1
4 files changed, 15 insertions, 12 deletions
diff --git a/http/http2_connection.hpp b/http/http2_connection.hpp
index ee3a218807..95d184e67b 100644
--- a/http/http2_connection.hpp
+++ b/http/http2_connection.hpp
@@ -12,7 +12,6 @@
#include "ssl_key_handler.hpp"
#include "utility.hpp"
-#include <boost/algorithm/string/predicate.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/ssl/stream.hpp>
diff --git a/http/http_connection.hpp b/http/http_connection.hpp
index 7ea0ac6d01..196dc5fa73 100644
--- a/http/http_connection.hpp
+++ b/http/http_connection.hpp
@@ -10,9 +10,9 @@
#include "logging.hpp"
#include "mutual_tls.hpp"
#include "ssl_key_handler.hpp"
+#include "str_utility.hpp"
#include "utility.hpp"
-#include <boost/algorithm/string/predicate.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/ssl/stream.hpp>
@@ -288,10 +288,10 @@ class Connection :
bool isSse =
isContentTypeAllowed(req->getHeaderValue("Accept"),
http_helpers::ContentType::EventStream, false);
+ std::string_view upgradeType(
+ thisReq.getHeaderValue(boost::beast::http::field::upgrade));
if ((thisReq.isUpgrade() &&
- boost::iequals(
- thisReq.getHeaderValue(boost::beast::http::field::upgrade),
- "websocket")) ||
+ bmcweb::asciiIEquals(upgradeType, "websocket")) ||
isSse)
{
asyncResp->res.setCompleteRequestHandler(
diff --git a/http/parsing.hpp b/http/parsing.hpp
index 839b51cae1..9a19baf452 100644
--- a/http/parsing.hpp
+++ b/http/parsing.hpp
@@ -2,10 +2,12 @@
#include "http/http_request.hpp"
#include "logging.hpp"
+#include "str_utility.hpp"
-#include <boost/algorithm/string/predicate.hpp>
#include <nlohmann/json.hpp>
+#include <algorithm>
+#include <cctype>
#include <string_view>
enum class JsonParseResult
@@ -15,14 +17,17 @@ enum class JsonParseResult
Success,
};
+inline bool isJsonContentType(std::string_view contentType)
+{
+ return bmcweb::asciiIEquals(contentType, "application/json") ||
+ bmcweb::asciiIEquals(contentType, "application/json; charset=utf-8");
+}
+
inline JsonParseResult parseRequestAsJson(const crow::Request& req,
nlohmann::json& jsonOut)
{
- std::string_view contentType =
- req.getHeaderValue(boost::beast::http::field::content_type);
-
- if (!boost::iequals(contentType, "application/json") &&
- !boost::iequals(contentType, "application/json; charset=utf-8"))
+ if (!isJsonContentType(
+ req.getHeaderValue(boost::beast::http::field::content_type)))
{
BMCWEB_LOG_WARNING("Failed to parse content type on request");
#ifndef BMCWEB_INSECURE_IGNORE_CONTENT_TYPE
diff --git a/http/server_sent_event.hpp b/http/server_sent_event.hpp
index 49002f60db..f4ad21a69f 100644
--- a/http/server_sent_event.hpp
+++ b/http/server_sent_event.hpp
@@ -3,7 +3,6 @@
#include "http_request.hpp"
#include "http_response.hpp"
-#include <boost/algorithm/string/predicate.hpp>
#include <boost/asio/buffer.hpp>
#include <boost/asio/steady_timer.hpp>
#include <boost/beast/core/multi_buffer.hpp>