Split off urls.secure for SSL support; reduces deployed image size
parent
f539406ee1
commit
7a2eb1d7b2
|
@ -95,6 +95,8 @@ ARTICLE: "http.client.errors" "HTTP client errors"
|
||||||
ARTICLE: "http.client" "HTTP client"
|
ARTICLE: "http.client" "HTTP client"
|
||||||
"The " { $vocab-link "http.client" } " vocabulary implements an HTTP and HTTPS client on top of " { $link "http" } "."
|
"The " { $vocab-link "http.client" } " vocabulary implements an HTTP and HTTPS client on top of " { $link "http" } "."
|
||||||
$nl
|
$nl
|
||||||
|
"For HTTPS support, you must load the " { $vocab-link "urls.secure" } " vocab first. If you don't load it, HTTPS will not load and images generated by " { $vocab-link "tools.deploy" } " will be smaller as a result."
|
||||||
|
$nl
|
||||||
"There are two primary usage patterns, data retrieval with GET requests and form submission with POST requests:"
|
"There are two primary usage patterns, data retrieval with GET requests and form submission with POST requests:"
|
||||||
{ $subsection "http.client.get" }
|
{ $subsection "http.client.get" }
|
||||||
{ $subsection "http.client.post" }
|
{ $subsection "http.client.post" }
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
! Copyright (C) 2008 Slava Pestov.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
USING: urls urls.private io.sockets io.sockets.secure ;
|
||||||
|
IN: urls.secure
|
||||||
|
|
||||||
|
M: abstract-inet >secure-addr <secure> ;
|
|
@ -2,7 +2,7 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: kernel ascii combinators combinators.short-circuit
|
USING: kernel ascii combinators combinators.short-circuit
|
||||||
sequences splitting fry namespaces make assocs arrays strings
|
sequences splitting fry namespaces make assocs arrays strings
|
||||||
io.sockets io.sockets.secure io.encodings.string
|
io.sockets io.encodings.string
|
||||||
io.encodings.utf8 math math.parser accessors parser
|
io.encodings.utf8 math math.parser accessors parser
|
||||||
strings.parser lexer prettyprint.backend hashtables present
|
strings.parser lexer prettyprint.backend hashtables present
|
||||||
peg.ebnf urls.encoding ;
|
peg.ebnf urls.encoding ;
|
||||||
|
@ -159,6 +159,12 @@ PRIVATE>
|
||||||
: secure-protocol? ( protocol -- ? )
|
: secure-protocol? ( protocol -- ? )
|
||||||
"https" = ;
|
"https" = ;
|
||||||
|
|
||||||
|
<PRIVATE
|
||||||
|
|
||||||
|
GENERIC: >secure-addr ( addrspec -- addrspec' )
|
||||||
|
|
||||||
|
PRIVATE>
|
||||||
|
|
||||||
: url-addr ( url -- addr )
|
: url-addr ( url -- addr )
|
||||||
[
|
[
|
||||||
[ host>> ]
|
[ host>> ]
|
||||||
|
@ -166,7 +172,7 @@ PRIVATE>
|
||||||
[ protocol>> protocol-port ]
|
[ protocol>> protocol-port ]
|
||||||
tri or <inet>
|
tri or <inet>
|
||||||
] [ protocol>> ] bi
|
] [ protocol>> ] bi
|
||||||
secure-protocol? [ <secure> ] when ;
|
secure-protocol? [ >secure-addr ] when ;
|
||||||
|
|
||||||
: ensure-port ( url -- url )
|
: ensure-port ( url -- url )
|
||||||
dup protocol>> '[ _ protocol-port or ] change-port ;
|
dup protocol>> '[ _ protocol-port or ] change-port ;
|
||||||
|
|
Loading…
Reference in New Issue