Prepare for boost::url upgrade

The new boost URL now interops properly with std::string_view, which is
great, and cleans up a bunch of mediocre code to convert one to another.
It has also been pulled into boost-proper, so we no longer need a
boost-url dependency that's separate.

Unfortunately, boost url makes these improvements by changing
boost::string_view for boost::urls::const_string, which causes us to
have some compile errors on the missing type.

The bulk of these changes fall into a couple categories, and have to be
executed in one commit.
string() is replaced with buffer() on the url and url_view types
boost::string_view is replaced by std::string_view for many times, in
many cases removing a temporary that we had in the code previously.

Tested: Code compiles with boost 1.81.0 beta.
Redfish service validator passes.
Pretty good unit test coverage for URL-specific use cases.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I8d3dc89b53d1cc390887fe53605d4867f75f76fd
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
index 7f3b43a..6f1e91b 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
@@ -519,7 +519,7 @@
         {
             if (std::find(metricReportDefinitions.begin(),
                           metricReportDefinitions.end(),
-                          mrdUri.string()) == metricReportDefinitions.end())
+                          mrdUri.buffer()) == metricReportDefinitions.end())
             {
                 return;
             }
diff --git a/redfish-core/include/redfish_aggregator.hpp b/redfish-core/include/redfish_aggregator.hpp
index 99da8ee..8170b64 100644
--- a/redfish-core/include/redfish_aggregator.hpp
+++ b/redfish-core/include/redfish_aggregator.hpp
@@ -312,7 +312,7 @@
                     BMCWEB_LOG_ERROR << "Port value out of range";
                     return;
                 }
-                url.set_port(static_cast<uint16_t>(*propVal));
+                url.set_port(std::to_string(static_cast<uint16_t>(*propVal)));
             }
 
             else if (prop.first == "AuthType")
@@ -435,8 +435,7 @@
         }
 
         // We didn't recognize the prefix and need to return a 404
-        boost::urls::string_value name = req.urlView.segments().back();
-        std::string_view nameStr(name.data(), name.size());
+        std::string_view nameStr = req.urlView.segments().back();
         messages::resourceNotFound(asyncResp->res, "", nameStr);
     }
 
@@ -461,9 +460,7 @@
             // don't need to write an error code
             if (isCollection == AggregationType::Resource)
             {
-                boost::urls::string_value name =
-                    sharedReq->urlView.segments().back();
-                std::string_view nameStr(name.data(), name.size());
+                std::string_view nameStr = sharedReq->urlView.segments().back();
                 messages::resourceNotFound(asyncResp->res, "", nameStr);
             }
             return;
diff --git a/redfish-core/include/utils/collection.hpp b/redfish-core/include/utils/collection.hpp
index 97f622d..f117302 100644
--- a/redfish-core/include/utils/collection.hpp
+++ b/redfish-core/include/utils/collection.hpp
@@ -29,7 +29,7 @@
                          const char* subtree = "/xyz/openbmc_project/inventory")
 {
     BMCWEB_LOG_DEBUG << "Get collection members for: "
-                     << collectionPath.string();
+                     << collectionPath.buffer();
     crow::connections::systemBus->async_method_call(
         [collectionPath, aResp{std::move(aResp)}](
             const boost::system::error_code ec,
diff --git a/redfish-core/include/utils/query_param.hpp b/redfish-core/include/utils/query_param.hpp
index fec5384..bfe1001 100644
--- a/redfish-core/include/utils/query_param.hpp
+++ b/redfish-core/include/utils/query_param.hpp
@@ -16,7 +16,6 @@
 #include <boost/beast/http/status.hpp>
 #include <boost/beast/http/verb.hpp>
 #include <boost/url/params_view.hpp>
-#include <boost/url/string.hpp>
 #include <nlohmann/json.hpp>
 
 #include <algorithm>
@@ -374,80 +373,78 @@
     return true;
 }
 
-inline std::optional<Query>
-    parseParameters(const boost::urls::params_view& urlParams,
-                    crow::Response& res)
+inline std::optional<Query> parseParameters(boost::urls::params_view urlParams,
+                                            crow::Response& res)
 {
     Query ret;
     for (const boost::urls::params_view::value_type& it : urlParams)
     {
-        std::string_view key(it.key.data(), it.key.size());
-        std::string_view value(it.value.data(), it.value.size());
-        if (key == "only")
+        if (it.key == "only")
         {
             if (!it.value.empty())
             {
-                messages::queryParameterValueFormatError(res, value, key);
+                messages::queryParameterValueFormatError(res, it.value, it.key);
                 return std::nullopt;
             }
             ret.isOnly = true;
         }
-        else if (key == "$expand" && bmcwebInsecureEnableQueryParams)
+        else if (it.key == "$expand" && bmcwebInsecureEnableQueryParams)
         {
-            if (!getExpandType(value, ret))
+            if (!getExpandType(it.value, ret))
             {
-                messages::queryParameterValueFormatError(res, value, key);
+                messages::queryParameterValueFormatError(res, it.value, it.key);
                 return std::nullopt;
             }
         }
-        else if (key == "$top")
+        else if (it.key == "$top")
         {
-            QueryError topRet = getTopParam(value, ret);
+            QueryError topRet = getTopParam(it.value, ret);
             if (topRet == QueryError::ValueFormat)
             {
-                messages::queryParameterValueFormatError(res, value, key);
+                messages::queryParameterValueFormatError(res, it.value, it.key);
                 return std::nullopt;
             }
             if (topRet == QueryError::OutOfRange)
             {
                 messages::queryParameterOutOfRange(
-                    res, value, "$top", "0-" + std::to_string(Query::maxTop));
+                    res, it.value, "$top",
+                    "0-" + std::to_string(Query::maxTop));
                 return std::nullopt;
             }
         }
-        else if (key == "$skip")
+        else if (it.key == "$skip")
         {
-            QueryError topRet = getSkipParam(value, ret);
+            QueryError topRet = getSkipParam(it.value, ret);
             if (topRet == QueryError::ValueFormat)
             {
-                messages::queryParameterValueFormatError(res, value, key);
+                messages::queryParameterValueFormatError(res, it.value, it.key);
                 return std::nullopt;
             }
             if (topRet == QueryError::OutOfRange)
             {
                 messages::queryParameterOutOfRange(
-                    res, value, key,
+                    res, it.value, it.key,
                     "0-" + std::to_string(std::numeric_limits<size_t>::max()));
                 return std::nullopt;
             }
         }
-        else if (key == "$select")
+        else if (it.key == "$select")
         {
-            if (!getSelectParam(value, ret))
+            if (!getSelectParam(it.value, ret))
             {
-                messages::queryParameterValueFormatError(res, value, key);
+                messages::queryParameterValueFormatError(res, it.value, it.key);
                 return std::nullopt;
             }
         }
         else
         {
             // Intentionally ignore other errors Redfish spec, 7.3.1
-            if (key.starts_with("$"))
+            if (it.key.starts_with("$"))
             {
                 // Services shall return... The HTTP 501 Not Implemented
                 // status code for any unsupported query parameters that
                 // start with $ .
-                messages::queryParameterValueFormatError(res, value, key);
+                messages::queryParameterValueFormatError(res, it.value, it.key);
                 res.result(boost::beast::http::status::not_implemented);
                 return std::nullopt;
             }