Auto load urls.secure when needed

db4
Sankaranarayanan Viswanathan 2015-10-28 21:13:51 -04:00 committed by John Benediktsson
parent c773ce6463
commit bb7740091e
2 changed files with 5 additions and 2 deletions

View File

@ -4,7 +4,7 @@
USING: accessors arrays assocs combinators fry hashtables USING: accessors arrays assocs combinators fry hashtables
io.pathnames io.sockets kernel lexer make math.parser io.pathnames io.sockets kernel lexer make math.parser
namespaces peg.ebnf present sequences splitting strings namespaces peg.ebnf present sequences splitting strings
strings.parser urls.encoding vocabs.loader ; strings.parser urls.encoding vocabs vocabs.loader ;
IN: urls IN: urls
@ -187,7 +187,7 @@ PRIVATE>
[ protocol>> protocol-port ] [ protocol>> protocol-port ]
tri or <inet> tri or <inet>
] [ protocol>> ] bi ] [ protocol>> ] bi
secure-protocol? [ >secure-addr ] when ; secure-protocol? [ "urls.secure" ensure-vocab-loaded >secure-addr ] when ;
: set-url-addr ( url addr -- url ) : set-url-addr ( url addr -- url )
[ host>> >>host ] [ port>> >>port ] bi ; [ host>> >>host ] [ port>> >>port ] bi ;

View File

@ -161,3 +161,6 @@ M: string require ( vocab -- )
: load-vocab ( name -- vocab ) : load-vocab ( name -- vocab )
[ require ] [ lookup-vocab ] bi ; [ require ] [ lookup-vocab ] bi ;
: ensure-vocab-loaded ( name -- )
dup lookup-vocab [ drop ] [ require ] if ;