Merge branch 'master' of git://factorcode.org/git/factor

db4
Doug Coleman 2008-05-20 18:26:51 -05:00
commit 72959dc4ee
7 changed files with 22 additions and 12 deletions

View File

@ -630,7 +630,7 @@ HELP: tri*
"The following two lines are equivalent:" "The following two lines are equivalent:"
{ $code { $code
"[ p ] [ q ] [ r ] tri*" "[ p ] [ q ] [ r ] tri*"
">r >r q r> q r> r" ">r >r p r> q r> r"
} }
} ; } ;

View File

@ -17,7 +17,7 @@ tuple-syntax namespaces ;
path: "/index.html" path: "/index.html"
version: "1.1" version: "1.1"
cookies: V{ } cookies: V{ }
header: H{ { "connection" "close" } } header: H{ { "connection" "close" } { "user-agent" "Factor http.client vocabulary" } }
} }
] [ ] [
[ [
@ -35,7 +35,7 @@ tuple-syntax namespaces ;
path: "/index.html" path: "/index.html"
version: "1.1" version: "1.1"
cookies: V{ } cookies: V{ }
header: H{ { "connection" "close" } } header: H{ { "connection" "close" } { "user-agent" "Factor http.client vocabulary" } }
} }
] [ ] [
[ [

View File

@ -4,7 +4,7 @@ USING: assocs http kernel math math.parser namespaces sequences
io io.sockets io.streams.string io.files io.timeouts strings io io.sockets io.streams.string io.files io.timeouts strings
splitting calendar continuations accessors vectors math.order splitting calendar continuations accessors vectors math.order
io.encodings.8-bit io.encodings.binary io.streams.duplex io.encodings.8-bit io.encodings.binary io.streams.duplex
fry debugger inspector ; fry debugger inspector ascii ;
IN: http.client IN: http.client
: max-redirects 10 ; : max-redirects 10 ;
@ -37,8 +37,12 @@ SYMBOL: redirects
PRIVATE> PRIVATE>
: read-chunk-size ( -- n )
read-crlf ";" split1 drop [ blank? ] right-trim
hex> [ "Bad chunk size" throw ] unless* ;
: read-chunks ( -- ) : read-chunks ( -- )
read-crlf ";" split1 drop hex> dup { f 0 } member? read-chunk-size dup zero?
[ drop ] [ read % read-crlf "" assert= read-chunks ] if ; [ drop ] [ read % read-crlf "" assert= read-chunks ] if ;
: read-response-body ( response -- response data ) : read-response-body ( response -- response data )

View File

@ -256,7 +256,8 @@ cookies ;
H{ } clone >>header H{ } clone >>header
H{ } clone >>query H{ } clone >>query
V{ } clone >>cookies V{ } clone >>cookies
"close" "connection" set-header ; "close" "connection" set-header
"Factor http.client vocabulary" "user-agent" set-header ;
: query-param ( request key -- value ) : query-param ( request key -- value )
swap query>> at ; swap query>> at ;

View File

@ -153,13 +153,13 @@ M: openssl-context dispose*
TUPLE: ssl-handle file handle connected disposed ; TUPLE: ssl-handle file handle connected disposed ;
ERROR: no-ssl-context ; ERROR: no-secure-context ;
M: no-ssl-context summary M: no-secure-context summary
drop "SSL operations must be wrapped in calls to with-ssl-context" ; drop "Secure socket operations must be wrapped in calls to with-secure-context" ;
: current-ssl-context ( -- ctx ) : current-ssl-context ( -- ctx )
secure-context get [ no-ssl-context ] unless* ; secure-context get [ no-secure-context ] unless* ;
: <ssl-handle> ( fd -- ssl ) : <ssl-handle> ( fd -- ssl )
current-ssl-context handle>> SSL_new dup ssl-error current-ssl-context handle>> SSL_new dup ssl-error

View File

@ -1,4 +1,4 @@
USING: kernel symbols tools.test parser generic words ; USING: kernel symbols tools.test parser generic words accessors ;
IN: symbols.tests IN: symbols.tests
[ ] [ SYMBOLS: a b c ; ] unit-test [ ] [ SYMBOLS: a b c ; ] unit-test
@ -13,3 +13,8 @@ DEFER: blah
[ f ] [ \ blah generic? ] unit-test [ f ] [ \ blah generic? ] unit-test
[ t ] [ \ blah symbol? ] unit-test [ t ] [ \ blah symbol? ] unit-test
[ "IN: symbols.tests USE: symbols SINGLETONS: blah blah blah ;" eval ]
[ error>> error>> def>> \ blah eq? ]
must-fail-with

View File

@ -10,5 +10,5 @@ IN: symbols
: SINGLETONS: : SINGLETONS:
";" parse-tokens ";" parse-tokens
[ create-class-in dup save-location define-singleton-class ] each ; [ create-class-in define-singleton-class ] each ;
parsing parsing