arturobernalg commented on code in PR #388:
URL:
https://github.com/apache/httpcomponents-core/pull/388#discussion_r1102728702
##########
httpcore5/src/main/java/org/apache/hc/core5/net/InetAddressUtils.java:
##########
@@ -139,7 +152,32 @@ public static boolean isIPv6HexCompressedAddress(final
String input) {
* @return true if the input parameter is a valid standard or compressed
IPv6 address
*/
public static boolean isIPv6Address(final String input) {
- return isIPv6StdAddress(input) || isIPv6HexCompressedAddress(input);
+ final int index = input.indexOf(SCOPE_ID_DELIMITER);
+ if (index == -1) {
+ return isIPv6StdAddress(input) ||
isIPv6HexCompressedAddress(input);
+ } else {
+ return isIPv6ScopedAddress(input);
+ }
+ }
+
+ /**
+ * Determines whether the given string represents a valid scoped IPv6
address.
+ * A scoped IPv6 address includes a scope identifier (e.g.
"fe80::1ff:fe23:4567:890a%eth2").
+ *
+ * @param input the string to be tested
+ * @return {@code true} if the string represents a valid scoped IPv6
address, {@code false} otherwise
+ */
+ private static boolean isIPv6ScopedAddress(final String input) {
+ final int index = input.indexOf(SCOPE_ID_DELIMITER);
Review Comment:
hi @ok2c
Yes. sound logical.
TY
--
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]