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
107107 if (!handleUsername(lookupUrl.authority())) {
108108 // we're assuming this is either a network address or global place name
109109 // 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())))) {
111112 // wasn't an address - lookup the place name
112113 attemptPlaceNameLookup(lookupUrl.host());
113114 }
@@ -246,24 +247,24 @@ bool AddressManager::handleNetworkAddress(const QString& lookupString) { · 132 unmodified lines
246247 const QString HOSTNAME_REGEX_STRING = "^((?:[A-Z0-9]|[A-Z0-9][A-Z0-9\\-]{0,61}[A-Z0-9])"
247248 "(?:\\.(?:[A-Z0-9]|[A-Z0-9][A-Z0-9\\-]{0,61}[A-Z0-9]))+|localhost)(:{1}\\d{1,5})?$";
248249
249− QRegExp hostnameRegex(HOSTNAME_REGEX_STRING, Qt::CaseInsensitive);
250+ QRegExp ipAddressRegex(IP_ADDRESS_REGEX_STRING);
250251
251− if (hostnameRegex.indexIn(lookupString) != -1) {
252− QString domainHostname = hostnameRegex.cap(0);
252+ if (ipAddressRegex.indexIn(lookupString) != -1) {
253+ QString domainIPString = ipAddressRegex.cap(0);
253254
254255 emit lookupResultsFinished();
255− setDomainHostnameAndName(domainHostname);
256+ setDomainHostnameAndName(domainIPString);
256257
257258 return true;
258259 }
259260
260− QRegExp ipAddressRegex(IP_ADDRESS_REGEX_STRING);
261+ QRegExp hostnameRegex(HOSTNAME_REGEX_STRING, Qt::CaseInsensitive);
261262
262− if (ipAddressRegex.indexIn(lookupString) != -1) {
263− QString domainIPString = ipAddressRegex.cap(0);
263+ if (hostnameRegex.indexIn(lookupString) != -1) {
264+ QString domainHostname = hostnameRegex.cap(0);
264265
265266 emit lookupResultsFinished();
266− setDomainHostnameAndName(domainIPString);
267+ setDomainHostnameAndName(domainHostname);
267268
268269 return true;
269270 }