This PR solves: https://tracker.ceph.com/issues/52738
It is solved by making changes to rgw_url.cc
A test is also added to check it's working.
Signed-off-by: Kalpesh Pandya <kapandya@redhat.com>
const std::string schema_re = "([[:alpha:]]+:\\/\\/)";
const std::string user_pass_re = "(([^:\\s]+):([^@\\s]+)@)?";
const std::string host_port_re = "([[:alnum:].:-]+)";
- const std::string path_re = "(/[[:print:]]+)?";
+ const std::string path_re = "(/[[:print:]]*)?";
}
bool parse_url_authority(const std::string& url, std::string& host, std::string& user, std::string& password) {
EXPECT_STREQ(host.c_str(), "example.com");
}
+TEST(TestURL, SimpleAuthority_1)
+{
+ std::string host;
+ std::string user;
+ std::string password;
+ const std::string url = "http://example.com/";
+ ASSERT_TRUE(parse_url_authority(url, host, user, password));
+ ASSERT_TRUE(user.empty());
+ ASSERT_TRUE(password.empty());
+ EXPECT_STREQ(host.c_str(), "example.com");
+}
+
TEST(TestURL, IPAuthority)
{
std::string host;