Remove getNthStringFromPath function

This utility function is being removed for several reasons.  First, it
does not verify the full string on URIs and paths, so things like
/foo/bar/baz/valid_id would still pass this check.

Second, it is used for both URIs and dbus paths, both of which we have
better utility functions these days respectively, boost::url for urls
and sdbusplus::message::object_path for dbus paths.  Neither of the two
is escaped properly when this function is used.

Therefore, remove it and replace it with the appropriate alternatives.

The existing URI functions were found to not accept fragments (given
they are rarely used in PATCH).  Add support for fragments to cover the
getNthStringFromPath use cases.

Tested: Redfish service validator passes.

Change-Id: Ibc6755ad69397123d7fef0e0b764042bbb48888b
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/test/http/utility_test.cpp b/test/http/utility_test.cpp
index 1a99d6d..69887e8 100644
--- a/test/http/utility_test.cpp
+++ b/test/http/utility_test.cpp
@@ -108,7 +108,7 @@
 TEST(Utility, readUrlSegments)
 {
     boost::system::result<boost::urls::url_view> parsed =
-        boost::urls::parse_relative_ref("/redfish/v1/Chassis#/Fans/0/Reading");
+        boost::urls::parse_relative_ref("/redfish/v1/Chassis");
 
     EXPECT_TRUE(readUrlSegments(*parsed, "redfish", "v1", "Chassis"));
 
@@ -164,6 +164,19 @@
     EXPECT_TRUE(readUrlSegments(*parsed, OrMorePaths()));
 }
 
+TEST(Utility, readUrlSegmentsManager)
+{
+    boost::urls::url_view url(
+        "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones/Left");
+    std::string managerId;
+    std::string input;
+    EXPECT_TRUE(
+        readUrlSegments(url, "redfish", "v1", "Managers", std::ref(managerId),
+                        "Oem", "OpenBmc", "Fan", "FanZones", std::ref(input)));
+    EXPECT_EQ(managerId, "bmc");
+    EXPECT_EQ(input, "Left");
+}
+
 TEST(Router, ParameterTagging)
 {
     EXPECT_EQ(1, getParameterTag("<str>"));