Remove QueryString
QueryString is an error-prone library that was
leftover from crow. Replace it with boost::url,
a header only library based and written by the
one of the authors of boost beast.
Tested: Verified logging paging still worked
as expected
Change-Id: I47c225089aa7d0f7d2299142f91806294f879381
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp
index d3ed416..4d9d4d9 100644
--- a/redfish-core/lib/event_service.hpp
+++ b/redfish-core/lib/event_service.hpp
@@ -471,13 +471,16 @@
subValue->protocol = "Redfish";
subValue->retryPolicy = "TerminateAfterRetries";
- char* filters = req.urlParams.get("$filter");
- if (filters == nullptr)
+ boost::urls::url_view::params_type::iterator it =
+ req.urlParams.find("$filter");
+ if (it == req.urlParams.end())
{
subValue->eventFormatType = "Event";
}
+
else
{
+ std::string filters = it->value();
// Reading from query params.
bool status = readSSEQueryParams(
filters, subValue->eventFormatType, subValue->registryMsgIds,
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index c4d4e89..b572bbf 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -198,12 +198,14 @@
static bool getSkipParam(crow::Response& res, const crow::Request& req,
uint64_t& skip)
{
- char* skipParam = req.urlParams.get("$skip");
- if (skipParam != nullptr)
+ boost::urls::url_view::params_type::iterator it =
+ req.urlParams.find("$skip");
+ if (it != req.urlParams.end())
{
+ std::string skipParam = it->value();
char* ptr = nullptr;
- skip = std::strtoul(skipParam, &ptr, 10);
- if (*skipParam == '\0' || *ptr != '\0')
+ skip = std::strtoul(skipParam.c_str(), &ptr, 10);
+ if (skipParam.empty() || *ptr != '\0')
{
messages::queryParameterValueTypeError(res, std::string(skipParam),
@@ -218,12 +220,14 @@
static bool getTopParam(crow::Response& res, const crow::Request& req,
uint64_t& top)
{
- char* topParam = req.urlParams.get("$top");
- if (topParam != nullptr)
+ boost::urls::url_view::params_type::iterator it =
+ req.urlParams.find("$top");
+ if (it != req.urlParams.end())
{
+ std::string topParam = it->value();
char* ptr = nullptr;
- top = std::strtoul(topParam, &ptr, 10);
- if (*topParam == '\0' || *ptr != '\0')
+ top = std::strtoul(topParam.c_str(), &ptr, 10);
+ if (topParam.empty() || *ptr != '\0')
{
messages::queryParameterValueTypeError(res, std::string(topParam),
"$top");