io.sockets.secure: add ssl-supported? hook, and make furnace.auth and twitter vocabs use it. This makes furnace work on Windows
parent
36785f4625
commit
b10897334c
|
@ -1,9 +1,9 @@
|
||||||
! Copyright (c) 2008 Slava Pestov
|
! Copyright (c) 2008, 2010 Slava Pestov
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors assocs namespaces kernel sequences sets
|
USING: accessors assocs namespaces kernel sequences sets
|
||||||
destructors combinators fry logging
|
destructors combinators fry logging io.encodings.utf8
|
||||||
io.encodings.utf8 io.encodings.string io.binary random
|
io.encodings.string io.binary io.sockets.secure random checksums
|
||||||
checksums checksums.sha urls
|
checksums.sha urls
|
||||||
html.forms
|
html.forms
|
||||||
http.server
|
http.server
|
||||||
http.server.filters
|
http.server.filters
|
||||||
|
@ -79,7 +79,7 @@ GENERIC: logged-in-username ( realm -- username )
|
||||||
swap >>default
|
swap >>default
|
||||||
users-in-db >>users
|
users-in-db >>users
|
||||||
sha-256 >>checksum
|
sha-256 >>checksum
|
||||||
t >>secure ; inline
|
ssl-supported? >>secure ; inline
|
||||||
|
|
||||||
: users ( -- provider )
|
: users ( -- provider )
|
||||||
realm get users>> ;
|
realm get users>> ;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2008 Slava Pestov.
|
! Copyright (C) 2008, 2010 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: kernel accessors combinators namespaces fry urls urls.secure
|
USING: kernel accessors combinators namespaces fry urls http
|
||||||
http http.server http.server.redirection http.server.responses
|
http.server http.server.redirection http.server.responses
|
||||||
http.server.remapping http.server.filters furnace.utilities ;
|
http.server.remapping http.server.filters furnace.utilities ;
|
||||||
IN: furnace.redirection
|
IN: furnace.redirection
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ 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 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
|
$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:"
|
||||||
{ $subsections
|
{ $subsections
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
! Copyright (C) 2008 Slava Pestov.
|
! Copyright (C) 2008, 2010 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors kernel namespaces continuations destructors io
|
USING: accessors kernel namespaces continuations destructors io
|
||||||
debugger io.sockets io.sockets.private sequences summary
|
debugger io.sockets io.sockets.private sequences summary
|
||||||
|
@ -11,6 +11,10 @@ SYMBOL: secure-socket-timeout
|
||||||
|
|
||||||
SYMBOL: secure-socket-backend
|
SYMBOL: secure-socket-backend
|
||||||
|
|
||||||
|
HOOK: ssl-supported? secure-socket-backend ( -- ? )
|
||||||
|
|
||||||
|
M: object ssl-supported? f ;
|
||||||
|
|
||||||
SINGLETONS: SSLv2 SSLv23 SSLv3 TLSv1 ;
|
SINGLETONS: SSLv2 SSLv23 SSLv3 TLSv1 ;
|
||||||
|
|
||||||
TUPLE: secure-config
|
TUPLE: secure-config
|
||||||
|
|
|
@ -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.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors unix byte-arrays kernel sequences namespaces
|
USING: accessors unix byte-arrays kernel sequences namespaces
|
||||||
math math.order combinators init alien alien.c-types
|
math math.order combinators init alien alien.c-types
|
||||||
|
@ -11,6 +11,8 @@ unix.ffi ;
|
||||||
FROM: io.ports => shutdown ;
|
FROM: io.ports => shutdown ;
|
||||||
IN: io.sockets.secure.unix
|
IN: io.sockets.secure.unix
|
||||||
|
|
||||||
|
M: openssl ssl-supported? t ;
|
||||||
|
|
||||||
M: ssl-handle handle-fd file>> handle-fd ;
|
M: ssl-handle handle-fd file>> handle-fd ;
|
||||||
|
|
||||||
: syscall-error ( r -- * )
|
: syscall-error ( r -- * )
|
||||||
|
|
|
@ -187,3 +187,4 @@ SYNTAX: URL" lexer get skip-blank parse-string >url suffix! ;
|
||||||
USE: vocabs.loader
|
USE: vocabs.loader
|
||||||
|
|
||||||
{ "urls" "prettyprint" } "urls.prettyprint" require-when
|
{ "urls" "prettyprint" } "urls.prettyprint" require-when
|
||||||
|
{ "urls" "io.sockets.secure" } "urls.secure" require-when
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors assocs combinators hashtables http
|
USING: accessors assocs combinators hashtables http
|
||||||
http.client json.reader kernel macros namespaces sequences
|
http.client json.reader kernel macros namespaces sequences
|
||||||
urls.secure fry oauth urls system ;
|
io.sockets.secure fry oauth urls ;
|
||||||
IN: twitter
|
IN: twitter
|
||||||
|
|
||||||
! Configuration
|
! Configuration
|
||||||
|
@ -20,9 +20,8 @@ twitter-source [ "factor" ] initialize
|
||||||
] with-scope ; inline
|
] with-scope ; inline
|
||||||
|
|
||||||
: twitter-url ( string -- string' )
|
: twitter-url ( string -- string' )
|
||||||
os windows?
|
ssl-supported?
|
||||||
"http://twitter.com/"
|
"https://twitter.com/" "http://twitter.com/" ? prepend ;
|
||||||
"https://twitter.com/" ? prepend ;
|
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue