urls: remove unnecessary >secure-addr indirection.

locals-and-roots
John Benediktsson 2016-04-16 17:11:01 -07:00
parent df868fa972
commit 5a3848515e
1 changed files with 4 additions and 15 deletions

View File

@ -168,22 +168,16 @@ PRIVATE>
: secure-protocol? ( protocol -- ? ) : secure-protocol? ( protocol -- ? )
"https" = ; "https" = ;
<PRIVATE
GENERIC# >secure-addr 1 ( addrspec host -- addrspec' )
PRIVATE>
: url-addr ( url -- addr ) : url-addr ( url -- addr )
[ [
[ host>> ] [ host>> ]
[ port>> ] [ port>> ]
[ protocol>> protocol-port ] [ protocol>> protocol-port ]
tri or <inet> tri or <inet>
] ] [
[ host>> ] dup protocol>> secure-protocol?
[ protocol>> ] tri [ host>> <secure> ] [ drop ] if
secure-protocol? [ >secure-addr ] [ drop ] if ; ] bi ;
: set-url-addr ( url addr -- url ) : set-url-addr ( url addr -- url )
[ host>> >>host ] [ port>> >>port ] bi ; [ host>> >>host ] [ port>> >>port ] bi ;
@ -191,11 +185,6 @@ PRIVATE>
: ensure-port ( url -- url' ) : ensure-port ( url -- url' )
clone dup protocol>> '[ _ protocol-port or ] change-port ; clone dup protocol>> '[ _ protocol-port or ] change-port ;
! Secure sockets
UNION: abstract-inet inet inet4 inet6 ;
M: abstract-inet >secure-addr <secure> ;
! Literal syntax ! Literal syntax
SYNTAX: URL" lexer get skip-blank parse-string >url suffix! ; SYNTAX: URL" lexer get skip-blank parse-string >url suffix! ;