summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2023-08-01 21:35:53 +0300
committerEd Tanous <ed@tanous.net>2023-08-23 19:55:21 +0300
commita716aa74954617e32a1d2e691d184580402b3eaf (patch)
tree836d67ff00ddb6611e69e7ce51d9f32901ba34e6 /test
parent3544d2a719c8bb7b07f9a39f61a3770ec84b909f (diff)
downloadbmcweb-a716aa74954617e32a1d2e691d184580402b3eaf.tar.xz
Move http client to URL
Type safety is a good thing. In: https://gerrit.openbmc.org/c/openbmc/bmcweb/+/65606 It was found that splitting out the URI into encoded pieces in the early phase removed some information we needed, namely whether or not a URI was ipv6. This commit changes http client such that it passes all the information through, with the correct type, rather than passing in hostname, port, path, and ssl separately. Opportunistically, because a number of log lines are changing, this uses the opportunity to remove a number of calls to std::to_string, and rely on std::format instead. Now that we no longer use custom URI splitting code, the ValidateAndSplitUrl() method can be removed, given that our validation now happens in the URI class. Tested: Aggregation works properly when satellite URIs are queried. Change-Id: I9f605863179af54c5af2719bc5ce9d29cbfffab7 Signed-off-by: Ed Tanous <edtanous@google.com>
Diffstat (limited to 'test')
-rw-r--r--test/http/utility_test.cpp45
1 files changed, 0 insertions, 45 deletions
diff --git a/test/http/utility_test.cpp b/test/http/utility_test.cpp
index 0ebba0bebe..cf83410707 100644
--- a/test/http/utility_test.cpp
+++ b/test/http/utility_test.cpp
@@ -140,51 +140,6 @@ TEST(Utility, readUrlSegments)
EXPECT_TRUE(readUrlSegments(*parsed, OrMorePaths()));
}
-TEST(Utility, ValidateAndSplitUrlPositive)
-{
- std::string host;
- std::string urlProto;
- uint16_t port = 0;
- std::string path;
- ASSERT_TRUE(validateAndSplitUrl("https://foo.com:18080/bar", urlProto, host,
- port, path));
- EXPECT_EQ(host, "foo.com");
- EXPECT_EQ(urlProto, "https");
- EXPECT_EQ(port, 18080);
-
- EXPECT_EQ(path, "/bar");
-
- // query string
- ASSERT_TRUE(validateAndSplitUrl("https://foo.com:18080/bar?foobar=1",
- urlProto, host, port, path));
- EXPECT_EQ(path, "/bar?foobar=1");
-
- // fragment
- ASSERT_TRUE(validateAndSplitUrl("https://foo.com:18080/bar#frag", urlProto,
- host, port, path));
- EXPECT_EQ(path, "/bar#frag");
-
- // Missing port
- ASSERT_TRUE(
- validateAndSplitUrl("https://foo.com/bar", urlProto, host, port, path));
- EXPECT_EQ(port, 443);
-
- // Missing path defaults to "/"
- ASSERT_TRUE(
- validateAndSplitUrl("https://foo.com/", urlProto, host, port, path));
- EXPECT_EQ(path, "/");
-
- // If http push eventing is allowed, allow http and pick a default port of
- // 80, if it's not, parse should fail.
- ASSERT_EQ(
- validateAndSplitUrl("http://foo.com/bar", urlProto, host, port, path),
- bmcwebInsecureEnableHttpPushStyleEventing);
- if constexpr (bmcwebInsecureEnableHttpPushStyleEventing)
- {
- EXPECT_EQ(port, 80);
- }
-}
-
TEST(Router, ParameterTagging)
{
EXPECT_EQ(1, getParameterTag("<str>"));