]> gitweb.factorcode.org Git - factor.git/commitdiff
urls: fix set-url-addr to work with inet6.
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 9 Nov 2020 21:08:50 +0000 (13:08 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 9 Nov 2020 21:08:50 +0000 (13:08 -0800)
basis/urls/urls.factor

index b5fae6782448bc72836e3b067fcbfa4fce198a8a..a5234f2c9cde3a1c7e098c61317c93035b22c58d 100644 (file)
@@ -190,7 +190,8 @@ PRIVATE>
     ] bi ;
 
 : set-url-addr ( url addr -- url )
-    [ host>> >>host ] [ port>> >>port ] bi ;
+    [ [ host>> ] [ inet6? ] bi [ "[" "]" surround ] when >>host ]
+    [ port>> >>port ] bi ;
 
 : ensure-port ( url -- url' )
     clone dup protocol>> '[ _ protocol-port or ] change-port ;