io.sockets.secure: add ssl-supported? hook, and make furnace.auth and twitter vocabs use it. This makes furnace work on Windows

db4
Slava Pestov 2010-10-24 15:54:19 -07:00
parent 36785f4625
commit b10897334c
7 changed files with 21 additions and 15 deletions

View File

@ -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>> ;

View 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

View 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

View 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

View 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 -- * )

View 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

View 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>