fix connection string parsing: IPv6 literals without the interface name v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sat, 20 Aug 2022 22:12:25 +0200
branchv_0
changeset 29 97fe991ad2cb
parent 28 f2697551bfd5
child 30 9fcd3ff6bd6e
fix connection string parsing: IPv6 literals without the interface name
src/CLIParser.h
--- a/src/CLIParser.h	Sat Aug 20 01:18:06 2022 +0200
+++ b/src/CLIParser.h	Sat Aug 20 22:12:25 2022 +0200
@@ -85,7 +85,7 @@
 		// 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:]+(%[a-zA-Z0-9]+))\\]):([0-9]+)|(uds)://(.*)");
+			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)) {