Merge branch 'master' of git://github.com/slavapestov/factor
commit
d55d996269
|
@ -30,7 +30,6 @@ ephemeral-key-bits ;
|
||||||
secure-config new
|
secure-config new
|
||||||
SSLv23 >>method
|
SSLv23 >>method
|
||||||
1024 >>ephemeral-key-bits
|
1024 >>ephemeral-key-bits
|
||||||
"vocab:openssl/cacert.pem" >>ca-file
|
|
||||||
t >>verify ;
|
t >>verify ;
|
||||||
|
|
||||||
TUPLE: secure-context < disposable config handle ;
|
TUPLE: secure-context < disposable config handle ;
|
||||||
|
|
10908
basis/openssl/cacert.pem
10908
basis/openssl/cacert.pem
File diff suppressed because it is too large
Load Diff
|
@ -205,6 +205,26 @@ urls [
|
||||||
derive-url
|
derive-url
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
|
[
|
||||||
|
T{ url
|
||||||
|
{ protocol "https" }
|
||||||
|
{ host "www.apple.com" }
|
||||||
|
}
|
||||||
|
] [
|
||||||
|
T{ url
|
||||||
|
{ protocol "http" }
|
||||||
|
{ host "www.apple.com" }
|
||||||
|
{ port 80 }
|
||||||
|
}
|
||||||
|
|
||||||
|
T{ url
|
||||||
|
{ protocol "https" }
|
||||||
|
{ host "www.apple.com" }
|
||||||
|
}
|
||||||
|
|
||||||
|
derive-url
|
||||||
|
] unit-test
|
||||||
|
|
||||||
[ "a" ] [
|
[ "a" ] [
|
||||||
<url> "a" "b" set-query-param "b" query-param
|
<url> "a" "b" set-query-param "b" query-param
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
! Copyright (C) 2008, 2010 Slava Pestov.
|
! Copyright (C) 2008, 2011 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: kernel ascii combinators combinators.short-circuit
|
USING: kernel ascii combinators combinators.short-circuit
|
||||||
sequences splitting fry namespaces make assocs arrays strings
|
sequences splitting fry namespaces make assocs arrays strings
|
||||||
|
@ -92,6 +92,14 @@ M: string >url
|
||||||
[ drop f ]
|
[ drop f ]
|
||||||
} case ;
|
} case ;
|
||||||
|
|
||||||
|
: relative-url ( url -- url' )
|
||||||
|
clone
|
||||||
|
f >>protocol
|
||||||
|
f >>host
|
||||||
|
f >>port ;
|
||||||
|
|
||||||
|
: relative-url? ( url -- ? ) protocol>> not ;
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
||||||
: unparse-username-password ( url -- )
|
: unparse-username-password ( url -- )
|
||||||
|
@ -113,8 +121,6 @@ M: string >url
|
||||||
[ path>> "/" head? [ "/" % ] unless ]
|
[ path>> "/" head? [ "/" % ] unless ]
|
||||||
} cleave ;
|
} cleave ;
|
||||||
|
|
||||||
PRIVATE>
|
|
||||||
|
|
||||||
M: url present
|
M: url present
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
@ -125,6 +131,8 @@ M: url present
|
||||||
} cleave
|
} cleave
|
||||||
] "" make ;
|
] "" make ;
|
||||||
|
|
||||||
|
PRIVATE>
|
||||||
|
|
||||||
: url-append-path ( path1 path2 -- path )
|
: url-append-path ( path1 path2 -- path )
|
||||||
{
|
{
|
||||||
{ [ dup "/" head? ] [ nip ] }
|
{ [ dup "/" head? ] [ nip ] }
|
||||||
|
@ -134,6 +142,14 @@ M: url present
|
||||||
[ [ "/" split1-last drop "/" ] dip 3append ]
|
[ [ "/" split1-last drop "/" ] dip 3append ]
|
||||||
} cond ;
|
} cond ;
|
||||||
|
|
||||||
|
<PRIVATE
|
||||||
|
|
||||||
|
: derive-port ( url base -- url' )
|
||||||
|
over relative-url? [ [ port>> ] either? ] [ drop port>> ] if ;
|
||||||
|
|
||||||
|
: derive-path ( url base -- url' )
|
||||||
|
[ path>> ] bi@ swap url-append-path ;
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
: derive-url ( base url -- url' )
|
: derive-url ( base url -- url' )
|
||||||
|
@ -142,20 +158,12 @@ PRIVATE>
|
||||||
[ [ username>> ] either? >>username ]
|
[ [ username>> ] either? >>username ]
|
||||||
[ [ password>> ] either? >>password ]
|
[ [ password>> ] either? >>password ]
|
||||||
[ [ host>> ] either? >>host ]
|
[ [ host>> ] either? >>host ]
|
||||||
[ [ port>> ] either? >>port ]
|
[ derive-port >>port ]
|
||||||
[ [ path>> ] bi@ swap url-append-path >>path ]
|
[ derive-path >>path ]
|
||||||
[ [ query>> ] either? >>query ]
|
[ [ query>> ] either? >>query ]
|
||||||
[ [ anchor>> ] either? >>anchor ]
|
[ [ anchor>> ] either? >>anchor ]
|
||||||
} 2cleave ;
|
} 2cleave ;
|
||||||
|
|
||||||
: relative-url ( url -- url' )
|
|
||||||
clone
|
|
||||||
f >>protocol
|
|
||||||
f >>host
|
|
||||||
f >>port ;
|
|
||||||
|
|
||||||
: relative-url? ( url -- ? ) protocol>> not ;
|
|
||||||
|
|
||||||
! Half-baked stuff follows
|
! Half-baked stuff follows
|
||||||
: secure-protocol? ( protocol -- ? )
|
: secure-protocol? ( protocol -- ? )
|
||||||
"https" = ;
|
"https" = ;
|
||||||
|
|
Loading…
Reference in New Issue