diff --git a/basis/furnace/auth/auth.factor b/basis/furnace/auth/auth.factor index 2acb09919d..7cd2a890ee 100644 --- a/basis/furnace/auth/auth.factor +++ b/basis/furnace/auth/auth.factor @@ -1,9 +1,9 @@ -! Copyright (c) 2008 Slava Pestov +! Copyright (c) 2008, 2010 Slava Pestov ! See http://factorcode.org/license.txt for BSD license. USING: accessors assocs namespaces kernel sequences sets -destructors combinators fry logging -io.encodings.utf8 io.encodings.string io.binary random -checksums checksums.sha urls +destructors combinators fry logging io.encodings.utf8 +io.encodings.string io.binary io.sockets.secure random checksums +checksums.sha urls html.forms http.server http.server.filters @@ -79,7 +79,7 @@ GENERIC: logged-in-username ( realm -- username ) swap >>default users-in-db >>users sha-256 >>checksum - t >>secure ; inline + ssl-supported? >>secure ; inline : users ( -- provider ) realm get users>> ; diff --git a/basis/furnace/redirection/redirection.factor b/basis/furnace/redirection/redirection.factor index ff81d73f7f..29bb505142 100644 --- a/basis/furnace/redirection/redirection.factor +++ b/basis/furnace/redirection/redirection.factor @@ -1,7 +1,7 @@ -! Copyright (C) 2008 Slava Pestov. +! Copyright (C) 2008, 2010 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel accessors combinators namespaces fry urls urls.secure -http http.server http.server.redirection http.server.responses +USING: kernel accessors combinators namespaces fry urls http +http.server http.server.redirection http.server.responses http.server.remapping http.server.filters furnace.utilities ; IN: furnace.redirection diff --git a/basis/http/client/client-docs.factor b/basis/http/client/client-docs.factor index 04077fc2f7..757f07483c 100644 --- a/basis/http/client/client-docs.factor +++ b/basis/http/client/client-docs.factor @@ -129,7 +129,7 @@ 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 need HTTPS support, don't load " { $vocab-link "urls.secure" } "; this will reduce the size of images generated by " { $vocab-link "tools.deploy" } "." +"For HTTPS support, you must load the " { $vocab-link "io.sockets.secure" } " vocab first. If you don't need HTTPS support, don't load " { $vocab-link "io.sockets.secure" } "; this will reduce the size of images generated by " { $vocab-link "tools.deploy" } "." $nl "There are two primary usage patterns, data retrieval with GET requests and form submission with POST requests:" { $subsections diff --git a/basis/io/sockets/secure/secure.factor b/basis/io/sockets/secure/secure.factor index fbbea7c4c3..92403a58cb 100644 --- a/basis/io/sockets/secure/secure.factor +++ b/basis/io/sockets/secure/secure.factor @@ -1,4 +1,4 @@ -! Copyright (C) 2008 Slava Pestov. +! Copyright (C) 2008, 2010 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: accessors kernel namespaces continuations destructors io debugger io.sockets io.sockets.private sequences summary @@ -11,6 +11,10 @@ SYMBOL: secure-socket-timeout SYMBOL: secure-socket-backend +HOOK: ssl-supported? secure-socket-backend ( -- ? ) + +M: object ssl-supported? f ; + SINGLETONS: SSLv2 SSLv23 SSLv3 TLSv1 ; TUPLE: secure-config diff --git a/basis/io/sockets/secure/unix/unix.factor b/basis/io/sockets/secure/unix/unix.factor index 8fe9facc0c..c856ef2bc8 100644 --- a/basis/io/sockets/secure/unix/unix.factor +++ b/basis/io/sockets/secure/unix/unix.factor @@ -1,4 +1,4 @@ -! Copyright (C) 2007, 2008, Slava Pestov, Elie CHAFTARI. +! Copyright (C) 2007, 2010, Slava Pestov, Elie CHAFTARI. ! See http://factorcode.org/license.txt for BSD license. USING: accessors unix byte-arrays kernel sequences namespaces math math.order combinators init alien alien.c-types @@ -11,6 +11,8 @@ unix.ffi ; FROM: io.ports => shutdown ; IN: io.sockets.secure.unix +M: openssl ssl-supported? t ; + M: ssl-handle handle-fd file>> handle-fd ; : syscall-error ( r -- * ) diff --git a/basis/urls/urls.factor b/basis/urls/urls.factor index 7b2d2a4975..19aea0fdac 100644 --- a/basis/urls/urls.factor +++ b/basis/urls/urls.factor @@ -187,3 +187,4 @@ SYNTAX: URL" lexer get skip-blank parse-string >url suffix! ; USE: vocabs.loader { "urls" "prettyprint" } "urls.prettyprint" require-when +{ "urls" "io.sockets.secure" } "urls.secure" require-when diff --git a/extra/twitter/twitter.factor b/extra/twitter/twitter.factor index 9236cc9504..81a676ec24 100644 --- a/extra/twitter/twitter.factor +++ b/extra/twitter/twitter.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: accessors assocs combinators hashtables http http.client json.reader kernel macros namespaces sequences -urls.secure fry oauth urls system ; +io.sockets.secure fry oauth urls ; IN: twitter ! Configuration @@ -20,9 +20,8 @@ twitter-source [ "factor" ] initialize ] with-scope ; inline : twitter-url ( string -- string' ) - os windows? - "http://twitter.com/" - "https://twitter.com/" ? prepend ; + ssl-supported? + "https://twitter.com/" "http://twitter.com/" ? prepend ; PRIVATE>