]> gitweb.factorcode.org Git - factor.git/commitdiff
io.sockets.secure: add ssl-supported? hook, and make furnace.auth and twitter vocabs...
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sun, 24 Oct 2010 22:54:19 +0000 (15:54 -0700)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sun, 24 Oct 2010 22:54:19 +0000 (15:54 -0700)
basis/furnace/auth/auth.factor
basis/furnace/redirection/redirection.factor
basis/http/client/client-docs.factor
basis/io/sockets/secure/secure.factor
basis/io/sockets/secure/unix/unix.factor
basis/urls/urls.factor
extra/twitter/twitter.factor

index 2acb09919d8aa2a0fd35a3d8a154a7e315dab5bb..7cd2a890eeccba9397743bef48829f1ad24a2833 100644 (file)
@@ -1,9 +1,9 @@
-! Copyright (c) 2008 Slava Pestov\r
+! Copyright (c) 2008, 2010 Slava Pestov\r
 ! See http://factorcode.org/license.txt for BSD license.\r
 USING: accessors assocs namespaces kernel sequences sets\r
-destructors combinators fry logging\r
-io.encodings.utf8 io.encodings.string io.binary random\r
-checksums checksums.sha urls\r
+destructors combinators fry logging io.encodings.utf8\r
+io.encodings.string io.binary io.sockets.secure random checksums\r
+checksums.sha urls\r
 html.forms\r
 http.server\r
 http.server.filters\r
@@ -79,7 +79,7 @@ GENERIC: logged-in-username ( realm -- username )
         swap >>default\r
         users-in-db >>users\r
         sha-256 >>checksum\r
-        t >>secure ; inline\r
+        ssl-supported? >>secure ; inline\r
 \r
 : users ( -- provider )\r
     realm get users>> ;\r
index ff81d73f7f7fd21017a898d59210c800d529e8f6..29bb5051421e5a3b0e049ff84a75d65c98f30230 100644 (file)
@@ -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
 
index 04077fc2f7b0369b4cab6750041a1e57de778f6a..757f07483c8715fc1de12b22e9881612f2b87559 100644 (file)
@@ -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
index fbbea7c4c310ccf3158d2ae5695638ff56494a79..92403a58cb9d1682db45f4c756a069d3d972ee45 100644 (file)
@@ -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
index 8fe9facc0c49fd1f2b1cbe57d795fc56e9eeeef0..c856ef2bc8016bf95a9be85b2042965bc415fab9 100644 (file)
@@ -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 -- * )
index 7b2d2a49754e754a29923b5136877cb5b7beed1a..19aea0fdaca2ec5b059afc5b891531390bf231a5 100644 (file)
@@ -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
index 9236cc9504db965ed715f64362ac143631e00632..81a676ec24589893cc5d26621a16d824733e5048 100644 (file)
@@ -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>