Next round of boost-uri updates

Boost url has changed some APIs again.  This commit updates our URIs to
handle it.  As part of this work, it also removes some of the debug
prints that were put in early on.  These aren't really needed these
days.

This commit invents a temporary #define of NEW_BOOST_URL, so we can get
through the subtree update without a hard dependency on this specific
version of bmcweb.  Ideally boost-url would have some version field, but
unfortunately, it is thusfar unversioned, as the long term intent of the
author is to be included in boost, and would be versioned there.

All the code within the else of the NEW_BOOST_URL flag will be removed
once the subtree update is landed.

Tested:
Added CXXFLAGS:append = " -DNEW_BOOST_URL" to the recipe and checked out
on top of the subtree update, and build succeeded.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ie2064e45efbc4331bdc5a5ddf44d877cde5e13cb
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
index 9333f61..32d819d 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
@@ -31,6 +31,28 @@
 /**
  * @brief Function extracts transfer protocol name from URI.
  */
+#ifdef NEW_BOOST_URL
+inline std::string getTransferProtocolTypeFromUri(const std::string& imageUri)
+{
+    boost::urls::result<boost::urls::url_view> url =
+        boost::urls::parse_uri(boost::string_view(imageUri));
+    if (!url)
+    {
+        return "None";
+    }
+    boost::string_view scheme = url->scheme();
+    if (scheme == "smb")
+    {
+        return "CIFS";
+    }
+    if (scheme == "https")
+    {
+        return "HTTPS";
+    }
+
+    return "None";
+}
+#else
 inline std::string getTransferProtocolTypeFromUri(const std::string& imageUri)
 {
     boost::urls::error_code ec;
@@ -52,6 +74,7 @@
 
     return "None";
 }
+#endif
 
 /**
  * @brief Read all known properties from VM object interfaces
@@ -306,6 +329,34 @@
  * @brief Function extracts transfer protocol type from URI.
  *
  */
+#ifdef NEW_BOOST_URL
+inline std::optional<TransferProtocol>
+    getTransferProtocolFromUri(const std::string& imageUri)
+{
+    boost::urls::result<boost::urls::url_view> url =
+        boost::urls::parse_uri(boost::string_view(imageUri));
+    if (!url)
+    {
+        return {};
+    }
+
+    boost::string_view scheme = url->scheme();
+    if (scheme == "smb")
+    {
+        return TransferProtocol::smb;
+    }
+    if (scheme == "https")
+    {
+        return TransferProtocol::https;
+    }
+    if (!scheme.empty())
+    {
+        return TransferProtocol::invalid;
+    }
+
+    return {};
+}
+#else
 inline std::optional<TransferProtocol>
     getTransferProtocolFromUri(const std::string& imageUri)
 {
@@ -333,6 +384,7 @@
 
     return {};
 }
+#endif
 
 /**
  * @brief Function convert transfer protocol from string param.