diff --git a/basis/http/client/client-docs.factor b/basis/http/client/client-docs.factor index a762d1a5ef..d4f277a7c3 100644 --- a/basis/http/client/client-docs.factor +++ b/basis/http/client/client-docs.factor @@ -95,6 +95,8 @@ ARTICLE: "http.client.errors" "HTTP client errors" ARTICLE: "http.client" "HTTP client" "The " { $vocab-link "http.client" } " vocabulary implements an HTTP and HTTPS client on top of " { $link "http" } "." $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:" { $subsection "http.client.get" } { $subsection "http.client.post" } diff --git a/basis/urls/secure/secure.factor b/basis/urls/secure/secure.factor new file mode 100644 index 0000000000..d2fa55f7f3 --- /dev/null +++ b/basis/urls/secure/secure.factor @@ -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 ; diff --git a/basis/urls/urls.factor b/basis/urls/urls.factor index 5cc8c9693b..30e8c68f9d 100644 --- a/basis/urls/urls.factor +++ b/basis/urls/urls.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: kernel ascii combinators combinators.short-circuit 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 strings.parser lexer prettyprint.backend hashtables present peg.ebnf urls.encoding ; @@ -159,6 +159,12 @@ PRIVATE> : secure-protocol? ( protocol -- ? ) "https" = ; +secure-addr ( addrspec -- addrspec' ) + +PRIVATE> + : url-addr ( url -- addr ) [ [ host>> ] @@ -166,7 +172,7 @@ PRIVATE> [ protocol>> protocol-port ] tri or ] [ protocol>> ] bi - secure-protocol? [ ] when ; + secure-protocol? [ >secure-addr ] when ; : ensure-port ( url -- url ) dup protocol>> '[ _ protocol-port or ] change-port ;