You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (input.empty()) returnfalse; // Input cannot be empty
30
-
31
-
// Remove scheme if present (e.g., "http://")
32
-
if (auto scheme_pos = input.find("://"); scheme_pos != std::string_view::npos) {
33
-
input.remove_prefix(scheme_pos + 3);
34
-
}
35
-
36
-
// Extract path if present
37
-
if (auto path_pos = input.find('/'); path_pos != std::string_view::npos) {
38
-
path = std::string(input.substr(path_pos));
39
-
path += ("/2/ws/hub" + (path.back() == '/' ? 1 : 0)); // I cant be bothered to do anything else so have a conditional assignment combined with C-style pointer arithmetic :>
40
-
input.remove_suffix(input.size() - path_pos);
41
-
} else {
42
-
path = "/2/ws/hub";
43
-
}
44
-
45
-
if (input.empty()) returnfalse;
46
-
47
-
std::string_view port_part;
48
-
49
-
// Check for IPv6 address (e.g., [::1]:8080)
50
-
if (input.front() == '[') {
51
-
auto closing_bracket = input.find(']');
52
-
if (closing_bracket == std::string_view::npos) returnfalse; // Malformed IPv6
0 commit comments