MCPcopy Create free account
hub / github.com/ada-url/ada / get_host

Method get_host

src/url.cpp:641–653  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

639}
640
641[[nodiscard]] std::string url::get_host() const {
642 // If url's host is null, then return the empty string.
643 // If url's port is null, return url's host, serialized.
644 // Return url's host, serialized, followed by U+003A (:) and url's port,
645 // serialized.
646 if (!host.has_value()) {
647 return "";
648 }
649 if (port.has_value()) {
650 return host.value() + ":" + get_port();
651 }
652 return host.value();
653}
654
655[[nodiscard]] std::string url::get_hostname() const {
656 return host.value_or("");

Callers 10

print_partFunction · 0.45
mainFunction · 0.45
ada_get_hostFunction · 0.45
get_originMethod · 0.45
parse_url_implFunction · 0.45
TYPED_TESTFunction · 0.45
TYPED_TESTFunction · 0.45
exercise_url_predicatesFunction · 0.45
LLVMFuzzerTestOneInputFunction · 0.45

Calls 1

has_valueMethod · 0.45

Tested by 2

TYPED_TESTFunction · 0.36
TYPED_TESTFunction · 0.36