From 15402d0f02d83804aa09779f6ecf8ea1ac4c872e Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Tue, 5 Nov 2024 16:39:50 -0600 Subject: [PATCH] ip-parser: handle zone-id (by ignoring it for the moment) --- basis/ip-parser/ip-parser-tests.factor | 3 +++ basis/ip-parser/ip-parser.factor | 1 + 2 files changed, 4 insertions(+) diff --git a/basis/ip-parser/ip-parser-tests.factor b/basis/ip-parser/ip-parser-tests.factor index 4944df289d7..5bd89e3746a 100644 --- a/basis/ip-parser/ip-parser-tests.factor +++ b/basis/ip-parser/ip-parser-tests.factor @@ -39,3 +39,6 @@ USING: ip-parser kernel sequences tools.test ; { "1::" } [ 0x10000000000000000000000000000 ipv6-ntoa ] unit-test { 0x10002000000000000000000030004 } [ "1:2::3:4" ipv6-aton ] unit-test { "1:2::3:4" } [ 0x10002000000000000000000030004 ipv6-ntoa ] unit-test + +{ { 65152 0 0 0 29762 6399 65122 31588 } } +[ "fe80::7442:18ff:fe62:7b64%en0" parse-ipv6 ] unit-test diff --git a/basis/ip-parser/ip-parser.factor b/basis/ip-parser/ip-parser.factor index 1d09bf5016c..8441c443f85 100644 --- a/basis/ip-parser/ip-parser.factor +++ b/basis/ip-parser/ip-parser.factor @@ -78,6 +78,7 @@ ERROR: more-than-8-components ; PRIVATE> : parse-ipv6 ( string -- seq ) + "%" split1 drop ! XXX: parse the zone-id "::" split1 [ [ f ] [ split-ipv6 ] if-empty ] bi@ pad-ipv6 ; : ipv6-ntoa ( integer -- ip )