Showing the changes to libraries/networking/src/AddressManager.cpp (1 of 1 file). Show all
Unified · Split
| @@ -107,7 +107,8 @@ bool AddressManager::handleUrl(const QUrl& lookupUrl) { · 106 unmodified lines | ||
| 107 | 107 | if (!handleUsername(lookupUrl.authority())) { |
| 108 | 108 | // we're assuming this is either a network address or global place name |
| 109 | 109 | // check if it is a network address first |
| 110 | − if (!handleNetworkAddress(lookupUrl.host())) { | |
| 110 | + if (!handleNetworkAddress(lookupUrl.host() | |
| 111 | + + (lookupUrl.port() == -1 ? "" : ":" + QString::number(lookupUrl.port())))) { | |
| 111 | 112 | // wasn't an address - lookup the place name |
| 112 | 113 | attemptPlaceNameLookup(lookupUrl.host()); |
| 113 | 114 | } |
| @@ -246,24 +247,24 @@ bool AddressManager::handleNetworkAddress(const QString& lookupString) { · 132 unmodified lines | ||
| 246 | 247 | const QString HOSTNAME_REGEX_STRING = "^((?:[A-Z0-9]|[A-Z0-9][A-Z0-9\\-]{0,61}[A-Z0-9])" |
| 247 | 248 | "(?:\\.(?:[A-Z0-9]|[A-Z0-9][A-Z0-9\\-]{0,61}[A-Z0-9]))+|localhost)(:{1}\\d{1,5})?$"; |
| 248 | 249 | |
| 249 | − QRegExp hostnameRegex(HOSTNAME_REGEX_STRING, Qt::CaseInsensitive); | |
| 250 | + QRegExp ipAddressRegex(IP_ADDRESS_REGEX_STRING); | |
| 250 | 251 | |
| 251 | − if (hostnameRegex.indexIn(lookupString) != -1) { | |
| 252 | − QString domainHostname = hostnameRegex.cap(0); | |
| 252 | + if (ipAddressRegex.indexIn(lookupString) != -1) { | |
| 253 | + QString domainIPString = ipAddressRegex.cap(0); | |
| 253 | 254 | |
| 254 | 255 | emit lookupResultsFinished(); |
| 255 | − setDomainHostnameAndName(domainHostname); | |
| 256 | + setDomainHostnameAndName(domainIPString); | |
| 256 | 257 | |
| 257 | 258 | return true; |
| 258 | 259 | } |
| 259 | 260 | |
| 260 | − QRegExp ipAddressRegex(IP_ADDRESS_REGEX_STRING); | |
| 261 | + QRegExp hostnameRegex(HOSTNAME_REGEX_STRING, Qt::CaseInsensitive); | |
| 261 | 262 | |
| 262 | − if (ipAddressRegex.indexIn(lookupString) != -1) { | |
| 263 | − QString domainIPString = ipAddressRegex.cap(0); | |
| 263 | + if (hostnameRegex.indexIn(lookupString) != -1) { | |
| 264 | + QString domainHostname = hostnameRegex.cap(0); | |
| 264 | 265 | |
| 265 | 266 | emit lookupResultsFinished(); |
| 266 | − setDomainHostnameAndName(domainIPString); | |
| 267 | + setDomainHostnameAndName(domainHostname); | |
| 267 | 268 | |
| 268 | 269 | return true; |
| 269 | 270 | } |