From 573c1504099f9ba7c155bc0a63b121315392af61 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Fri, 16 Jan 2009 10:17:36 +0100 Subject: [PATCH] inet6 address components cannot be stored as bytes as they are 16 bits long --- basis/io/sockets/sockets-tests.factor | 6 ++++++ basis/io/sockets/sockets.factor | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/basis/io/sockets/sockets-tests.factor b/basis/io/sockets/sockets-tests.factor index 4b95a31512..dc0c698699 100644 --- a/basis/io/sockets/sockets-tests.factor +++ b/basis/io/sockets/sockets-tests.factor @@ -33,6 +33,9 @@ concurrency.promises threads io.streams.string ; [ B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } ] [ "::1" T{ inet6 } inet-pton ] unit-test +[ B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 } ] +[ "::100" T{ inet6 } inet-pton ] unit-test + [ B{ 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2 } ] [ "1::2" T{ inet6 } inet-pton ] unit-test @@ -45,6 +48,9 @@ concurrency.promises threads io.streams.string ; [ "1:2:0:0:0:0:3:4" ] [ B{ 0 1 0 2 0 0 0 0 0 0 0 0 0 3 0 4 } T{ inet6 } inet-ntop ] unit-test +[ "2001:6f8:37a:5:0:0:0:1" ] +[ "2001:6f8:37a:5::1" T{ inet6 } [ inet-pton ] [ inet-ntop ] bi ] unit-test + [ t ] [ "localhost" 80 resolve-host length 1 >= ] unit-test ! Smoke-test UDP diff --git a/basis/io/sockets/sockets.factor b/basis/io/sockets/sockets.factor index 0ef485b74c..8dce527553 100644 --- a/basis/io/sockets/sockets.factor +++ b/basis/io/sockets/sockets.factor @@ -109,7 +109,7 @@ M: invalid-inet6 summary drop "Invalid IPv6 address" ; [ f ] [ ":" split [ hex> [ "Component not a number" throw ] unless* - ] B{ } map-as + ] { } map-as ] if-empty ; : pad-inet6 ( string1 string2 -- seq )