# HG changeset patch # User František Kučera # Date 1659879111 -7200 # Node ID ad21bff4505112e87311fc5b9efb6736474f9ed7 # Parent 7a9a52e949b959e50a729d27940a57f18b15f79a support IPv6 link local addresses not only in the „host“ option but also in the connection string diff -r 7a9a52e949b9 -r ad21bff45051 src/CLIParser.h --- a/src/CLIParser.h Sun Aug 07 15:09:47 2022 +0200 +++ b/src/CLIParser.h Sun Aug 07 15:31:51 2022 +0200 @@ -85,16 +85,16 @@ // Parse the connection string and convert it to options: if (connectionString.size()) { std::string connectionStringBytes = convertor.to_bytes(connectionString); - std::regex pattern("(tcp|udp|sctp)://(([^:]+)|\\[([0-9a-fA-F:]+)\\]):([0-9]+)|(uds)://(.*)"); - // 1 23 4 5 6 7 + std::regex pattern("(tcp|udp|sctp)://(([^:]+)|\\[([0-9a-fA-F:]+(%[a-zA-Z0-9]+))\\]):([0-9]+)|(uds)://(.*)"); + // 1 23 4 5 6 7 8 std::smatch match; if (std::regex_match(connectionStringBytes, match, pattern)) { setIfMissing(c.options, OPTION_PROTOCOL, match[1], false); - setIfMissing(c.options, OPTION_PROTOCOL, match[6], false); + setIfMissing(c.options, OPTION_PROTOCOL, match[7], false); setIfMissing(c.options, OPTION_HOST, match[3], false); setIfMissing(c.options, OPTION_HOST, match[4], false); - setIfMissing(c.options, OPTION_PORT, match[5], false); - setIfMissing(c.options, OPTION_PATH, match[7], false); + setIfMissing(c.options, OPTION_PORT, match[6], false); + setIfMissing(c.options, OPTION_PATH, match[8], false); if (match[1] == PROTOCOL_TCP) setIfMissing(c.options, OPTION_MODE, MODE_STREAM); } else { throw relpipe::cli::RelpipeCLIException(L"Invalid connection string: " + connectionString, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);