File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -320,10 +320,15 @@ static ProxySetting ParseProxyString(const QString& proxy)
320320 if (proxy.isEmpty ()) {
321321 return default_val;
322322 }
323- // contains IP at index 0 and port at index 1
324- QStringList ip_port = GUIUtil::SplitSkipEmptyParts (proxy, " :" );
325- if (ip_port.size () == 2 ) {
326- return {true , ip_port.at (0 ), ip_port.at (1 )};
323+ uint16_t port{0 };
324+ std::string hostname;
325+ if (SplitHostPort (proxy.toStdString (), port, hostname) && port != 0 ) {
326+ // Valid and port within the valid range
327+ // Check if the hostname contains a colon, indicating an IPv6 address
328+ if (hostname.find (' :' ) != std::string::npos) {
329+ hostname = " [" + hostname + " ]" ; // Wrap IPv6 address in brackets
330+ }
331+ return {true , QString::fromStdString (hostname), QString::number (port)};
327332 } else { // Invalid: return default
328333 return default_val;
329334 }
You can’t perform that action at this time.
0 commit comments