You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "arturobernalg (via GitHub)" <gi...@apache.org> on 2023/02/24 21:21:45 UTC

[GitHub] [httpcomponents-core] arturobernalg opened a new pull request, #394: Add support for Internationalized Domain Names (IDN)

arturobernalg opened a new pull request, #394:
URL: https://github.com/apache/httpcomponents-core/pull/394

   Improve IDN support in URI parsing by converting non-ASCII characters to their ASCII-compatible form using the java.net.IDN class. This allows for better interoperability with systems that may not support Unicode characters in domain names. The change was made by adding a conditional statement that checks if the hostname contains non-ASCII characters, and if so, applies the IDN conversion. The existing code uses the Apache Tomcat URI parsing implementation for compatibility and consistency with Tomcat's behavior. This change should have no impact on ASCII-only hostnames.


-- 
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: dev-unsubscribe@hc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] ok2c commented on a diff in pull request #394: Add support for Internationalized Domain Names (IDN)

Posted by "ok2c (via GitHub)" <gi...@apache.org>.
ok2c commented on code in PR #394:
URL: https://github.com/apache/httpcomponents-core/pull/394#discussion_r1117710747


##########
httpcore5/src/main/java/org/apache/hc/core5/util/TextUtils.java:
##########
@@ -141,4 +141,22 @@ public static String toLowerCase(final String s) {
         return s.toLowerCase(Locale.ROOT);
     }
 
+
+    /**
+     * Determines whether the given string contains only ASCII characters.
+     *
+     * @param s the string to check
+     * @return true if the string contains only ASCII characters, false otherwise
+     * @throws IllegalArgumentException if the input string is null
+     * @since 5.3
+     */
+    public static boolean isAllASCII(final String s) {

Review Comment:
   @arturobernalg Please make the new method use `CharSequence` as a parameter instead of `String`.



-- 
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: dev-unsubscribe@hc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] ok2c commented on pull request #394: Add support for Internationalized Domain Names (IDN)

Posted by "ok2c (via GitHub)" <gi...@apache.org>.
ok2c commented on PR #394:
URL: https://github.com/apache/httpcomponents-core/pull/394#issuecomment-1498796044

   @arturobernalg I have to say I did not do a good job reviewing your original change-set. With your changes one could create instances of `Host` class referring to the same IDN host but with and without IDN encoding. That was wrong and could potentially lead to various issues with IDN hostnames. 
   
   I changed the internal representation of the hostname to Unicode and added IDN conversion to those routines that parse hostnames from text or format them back. This way the internal representation is always consistent regardless of the original representation or formatting.
   
   I re-committed your original change-set as 716f64c744d227bca80d8ee6a0a5cc951a5910d9. Please review. This should also make apache/httpcomponents-client#431 unnecessary.


-- 
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: dev-unsubscribe@hc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] arturobernalg commented on pull request #394: Add support for Internationalized Domain Names (IDN)

Posted by "arturobernalg (via GitHub)" <gi...@apache.org>.
arturobernalg commented on PR #394:
URL: https://github.com/apache/httpcomponents-core/pull/394#issuecomment-1444581097

   I just change the branch base to 5.3.x and use CharSequence instead


-- 
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: dev-unsubscribe@hc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] ok2c merged pull request #394: Add support for Internationalized Domain Names (IDN)

Posted by "ok2c (via GitHub)" <gi...@apache.org>.
ok2c merged PR #394:
URL: https://github.com/apache/httpcomponents-core/pull/394


-- 
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: dev-unsubscribe@hc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] arturobernalg commented on a diff in pull request #394: Add support for Internationalized Domain Names (IDN)

Posted by "arturobernalg (via GitHub)" <gi...@apache.org>.
arturobernalg commented on code in PR #394:
URL: https://github.com/apache/httpcomponents-core/pull/394#discussion_r1117720198


##########
httpcore5/src/main/java/org/apache/hc/core5/util/TextUtils.java:
##########
@@ -141,4 +141,22 @@ public static String toLowerCase(final String s) {
         return s.toLowerCase(Locale.ROOT);
     }
 
+
+    /**
+     * Determines whether the given string contains only ASCII characters.
+     *
+     * @param s the string to check
+     * @return true if the string contains only ASCII characters, false otherwise
+     * @throws IllegalArgumentException if the input string is null
+     * @since 5.3
+     */
+    public static boolean isAllASCII(final String s) {

Review Comment:
   done.



-- 
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: dev-unsubscribe@hc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] arturobernalg commented on pull request #394: Add support for Internationalized Domain Names (IDN)

Posted by "arturobernalg (via GitHub)" <gi...@apache.org>.
arturobernalg commented on PR #394:
URL: https://github.com/apache/httpcomponents-core/pull/394#issuecomment-1499577069

   @ok2c 
   I need to digest everything, but it seems that you are correct.


-- 
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: dev-unsubscribe@hc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org