221  std::string protocol{};
 
  222  std::string username{};
 
  223  std::string password{};
 
  224  std::string hostname{};
 
  226  std::string pathname{};
 
  227  std::string search{};
 
  232  std::vector inputs{input};
 
  235  if (std::holds_alternative<url_pattern_init>(input)) {
 
  237        "url_pattern::match called with url_pattern_init and base_url_string=",
 
  240    if (base_url_string) {
 
  241      ada_log(
"failed to match because base_url_string was given");
 
  250        protocol, username, password, hostname, port, pathname, search, hash);
 
  253    if (!apply_result.has_value()) {
 
  254      ada_log(
"match returned std::nullopt because process threw");
 
  260    protocol = std::move(apply_result->protocol.value());
 
  264    username = std::move(apply_result->username.value());
 
  268    password = std::move(apply_result->password.value());
 
  272    hostname = std::move(apply_result->hostname.value());
 
  276    port = std::move(apply_result->port.value());
 
  280    pathname = std::move(apply_result->pathname.value());
 
  284    if (apply_result->search->starts_with(
"?")) {
 
  285      search = apply_result->search->substr(1);
 
  287      search = std::move(apply_result->search.value());
 
  293    hash = std::move(apply_result->hash.value());
 
  301    if (base_url_string) {
 
  307        ada_log(
"match returned std::nullopt because failed to parse base_url=",
 
  313      inputs.emplace_back(*base_url_string);
 
  317        base_url.has_value() ? &*base_url : 
nullptr;
 
  325      ada_log(
"match returned std::nullopt because url failed");
 
  352      search = view.starts_with(
"?") ? 
url->
get_search().substr(1) : view;
 
  360      hash = view.starts_with(
"#") ? 
url->
get_hash().substr(1) : view;
 
  366  auto protocol_exec_result =
 
  367      regex_provider::regex_search(protocol, protocol_component.regexp);
 
  369  if (!protocol_exec_result) {
 
  375  auto username_exec_result =
 
  376      regex_provider::regex_search(username, username_component.regexp);
 
  378  if (!username_exec_result) {
 
  384  auto password_exec_result =
 
  385      regex_provider::regex_search(password, password_component.regexp);
 
  387  if (!password_exec_result) {
 
  393  auto hostname_exec_result =
 
  394      regex_provider::regex_search(hostname, hostname_component.regexp);
 
  396  if (!hostname_exec_result) {
 
  402  auto port_exec_result =
 
  403      regex_provider::regex_search(port, port_component.regexp);
 
  405  if (!port_exec_result) {
 
  411  auto pathname_exec_result =
 
  412      regex_provider::regex_search(pathname, pathname_component.regexp);
 
  414  if (!pathname_exec_result) {
 
  420  auto search_exec_result =
 
  421      regex_provider::regex_search(search, search_component.regexp);
 
  423  if (!search_exec_result) {
 
  429  auto hash_exec_result =
 
  430      regex_provider::regex_search(hash, hash_component.regexp);
 
  432  if (!hash_exec_result) {
 
  439  result.inputs = std::move(inputs);
 
  442  result.protocol = protocol_component.create_component_match_result(
 
  443      std::move(protocol), std::move(*protocol_exec_result));
 
  447  result.username = username_component.create_component_match_result(
 
  448      std::move(username), std::move(*username_exec_result));
 
  452  result.password = password_component.create_component_match_result(
 
  453      std::move(password), std::move(*password_exec_result));
 
  457  result.hostname = hostname_component.create_component_match_result(
 
  458      std::move(hostname), std::move(*hostname_exec_result));
 
  462  result.port = port_component.create_component_match_result(
 
  463      std::move(port), std::move(*port_exec_result));
 
  467  result.pathname = pathname_component.create_component_match_result(
 
  468      std::move(pathname), std::move(*pathname_exec_result));
 
  472  result.search = search_component.create_component_match_result(
 
  473      std::move(search), std::move(*search_exec_result));
 
  477  result.hash = hash_component.create_component_match_result(
 
  478      std::move(hash), std::move(*hash_exec_result));
 
 
static tl::expected< url_pattern_init, errors > process(const url_pattern_init &init, process_type type, std::optional< std::string_view > protocol=std::nullopt, std::optional< std::string_view > username=std::nullopt, std::optional< std::string_view > password=std::nullopt, std::optional< std::string_view > hostname=std::nullopt, std::optional< std::string_view > port=std::nullopt, std::optional< std::string_view > pathname=std::nullopt, std::optional< std::string_view > search=std::nullopt, std::optional< std::string_view > hash=std::nullopt)