Skip to content

Commit 96de421

Browse files
committed
little speed up
1 parent fa3f672 commit 96de421

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

cSploit/src/org/csploit/android/net/http/RequestParser.java

+10-6
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,6 @@ public class RequestParser
291291

292292

293293
public static String getBaseDomain(String hostname){
294-
String domain = "";
295-
296294
// if hostname is an IP address return that address
297295
if(Patterns.IP_ADDRESS.matcher(hostname).matches())
298296
return hostname;
@@ -313,13 +311,19 @@ public static String getBaseDomain(String hostname){
313311
if ((ihost - itld) == 0 || ihost == 2)
314312
return hostname;
315313

316-
domain = "";
314+
StringBuilder sb = new StringBuilder();
315+
317316
for(i = ihost - itld; i < ihost; i++){
318-
domain += host_parts[i] + ".";
317+
sb.append(host_parts[i]);
318+
if(i < ihost - 1) {
319+
sb.append(".");
320+
}
319321
}
320322

321-
DNSCache.getInstance().addRootDomain(domain.substring(0, domain.length() - 1));
322-
return domain.substring(0, domain.length() - 1);
323+
String domain = sb.toString();
324+
325+
DNSCache.getInstance().addRootDomain(domain);
326+
return domain;
323327
}
324328
}
325329

0 commit comments

Comments
 (0)