dxbjavid commented on code in PR #876:
URL: 
https://github.com/apache/httpcomponents-client/pull/876#discussion_r3840809818


##########
httpclient5/src/main/java/org/apache/hc/client5/http/psl/PublicSuffixMatcher.java:
##########
@@ -249,7 +249,15 @@ public boolean verify(final String domain) {
          if (domain == null) {
              return false;
          }
-         return verifyInternal(domain.startsWith(".") ? domain.substring(1) : 
domain);
+         // Normalise here so that verifyInternal can assume its input is 
already lowercase and in
+         // Unicode form. The rules are held that way, so an ACE-encoded 
(xn--) or mixed-case public
+         // suffix has to be decoded first, mirroring getDomainRoot; otherwise 
it fails to match a
+         // rule and is mistaken for a registrable domain.
+         String normalized = DnsUtils.normalize(domain.startsWith(".") ? 
domain.substring(1) : domain);

Review Comment:
   good call, switched to normalizeUnicode. it also drops the fragile 
contains("xn-") guard and handles the IllegalArgumentException from toUnicode 
for us, so it is a bit tidier than the getDomainRoot version.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to