 
 : url-addr ( url -- addr )
     [
-        [ host>> ]
+        [ host>> ipv6-host drop ]
         [ port>> ]
         [ protocol>> protocol-port ]
         tri or <inet>
     ] [
         dup protocol>> secure-protocol?
-        [ host>> <secure> ] [ drop ] if
+        [ host>> ipv6-host drop <secure> ] [ drop ] if
     ] bi ;
 
 : set-url-addr ( url addr -- url )

    [ port>> ] [ protocol>> protocol-port ] bi over =
    [ drop f ] when ;

: unparse-host-part ( url -- )
    {
        [ unparse-username-password ]
        [ host>> url-encode % ]
        [ url-port [ ":" % # ] when* ]
        [ path>> "/" head? [ "/" % ] unless ]
    } cleave ;

! Copyright (C) 2008, 2011 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.

USING: accessors ascii assocs combinators
combinators.short-circuit fry io.pathnames io.sockets
io.sockets.secure kernel lexer linked-assocs make math
math.parser multiline namespaces peg.ebnf present sequences
sequences.generalizations splitting strings strings.parser
urls.encoding vocabs.loader ;
