"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "httpclient/src/main/java/org/apache/http/conn/util/PublicSuffixMatcher.java" between
httpcomponents-client-4.5.8-src.tar.gz and httpcomponents-client-4.5.9-src.tar.gz

About: HttpComponents is an Apache project responsible for creating and maintaining a toolset of low level Java components focused on HTTP and associated protocols. Java sources.

PublicSuffixMatcher.java  (httpcomponents-client-4.5.8-src):PublicSuffixMatcher.java  (httpcomponents-client-4.5.9-src)
skipping to change at line 145 skipping to change at line 145
* *
* @since 4.5 * @since 4.5
*/ */
public String getDomainRoot(final String domain, final DomainType expectedTy pe) { public String getDomainRoot(final String domain, final DomainType expectedTy pe) {
if (domain == null) { if (domain == null) {
return null; return null;
} }
if (domain.startsWith(".")) { if (domain.startsWith(".")) {
return null; return null;
} }
String domainName = null; final String normalized = domain.toLowerCase(Locale.ROOT);
String segment = domain.toLowerCase(Locale.ROOT); String segment = normalized;
String result = null;
while (segment != null) { while (segment != null) {
// An exception rule takes priority over any other matching rule. // An exception rule takes priority over any other matching rule.
if (hasException(IDN.toUnicode(segment), expectedType)) { final String key = IDN.toUnicode(segment);
if (hasException(key, expectedType)) {
return segment; return segment;
} }
if (hasRule(key, expectedType)) {
if (hasRule(IDN.toUnicode(segment), expectedType)) { return result;
break;
} }
final int nextdot = segment.indexOf('.'); final int nextdot = segment.indexOf('.');
final String nextSegment = nextdot != -1 ? segment.substring(nextdot + 1) : null; final String nextSegment = nextdot != -1 ? segment.substring(nextdot + 1) : null;
if (nextSegment != null) { if (nextSegment != null) {
if (hasRule("*." + IDN.toUnicode(nextSegment), expectedType)) { if (hasRule("*." + IDN.toUnicode(nextSegment), expectedType)) {
break; return result;
} }
} }
if (nextdot != -1) { result = segment;
domainName = segment;
}
segment = nextSegment; segment = nextSegment;
} }
return domainName; return normalized;
} }
/** /**
* Tests whether the given domain matches any of entry from the public suffi x list. * Tests whether the given domain matches any of entry from the public suffi x list.
*/ */
public boolean matches(final String domain) { public boolean matches(final String domain) {
return matches(domain, null); return matches(domain, null);
} }
/** /**
 End of changes. 7 change blocks. 
12 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)