History

send port along with domain hostname lookup

Stephen Birarda committed 11 years ago

Commit 087ac1d1 parent 45881da1 file · +10 −9Browse files

Showing the changes to libraries/networking/src/AddressManager.cpp (1 of 1 file). Show all

Unified · Split

libraries/networking/src/AddressManager.cpp+10−9
@@ -107,7 +107,8 @@ bool AddressManager::handleUrl(const QUrl& lookupUrl) { · 106 unmodified lines
107 if (!handleUsername(lookupUrl.authority())) {107 if (!handleUsername(lookupUrl.authority())) {
108 // we're assuming this is either a network address or global place name108 // we're assuming this is either a network address or global place name
109 // check if it is a network address first109 // 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 // wasn't an address - lookup the place name112 // wasn't an address - lookup the place name
112 attemptPlaceNameLookup(lookupUrl.host());113 attemptPlaceNameLookup(lookupUrl.host());
113 }114 }
@@ -246,24 +247,24 @@ bool AddressManager::handleNetworkAddress(const QString& lookupString) { · 132 unmodified lines
246 const QString HOSTNAME_REGEX_STRING = "^((?:[A-Z0-9]|[A-Z0-9][A-Z0-9\\-]{0,61}[A-Z0-9])"247 const QString HOSTNAME_REGEX_STRING = "^((?:[A-Z0-9]|[A-Z0-9][A-Z0-9\\-]{0,61}[A-Z0-9])"
247 "(?:\\.(?:[A-Z0-9]|[A-Z0-9][A-Z0-9\\-]{0,61}[A-Z0-9]))+|localhost)(:{1}\\d{1,5})?$";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 if (ipAddressRegex.indexIn(lookupString) != -1) {
252 QString domainHostname = hostnameRegex.cap(0);253 QString domainIPString = ipAddressRegex.cap(0);
253 254
254 emit lookupResultsFinished();255 emit lookupResultsFinished();
255 setDomainHostnameAndName(domainHostname);256 setDomainHostnameAndName(domainIPString);
256 257
257 return true;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 if (hostnameRegex.indexIn(lookupString) != -1) {
263 QString domainIPString = ipAddressRegex.cap(0);264 QString domainHostname = hostnameRegex.cap(0);
264 265
265 emit lookupResultsFinished();266 emit lookupResultsFinished();
266 setDomainHostnameAndName(domainIPString);267 setDomainHostnameAndName(domainHostname);
267 268
268 return true;269 return true;
269 }270 }