Merge branch 'master' of git://factorcode.org/git/factor
commit
10d2c8ff7c
|
@ -99,8 +99,12 @@ M: object modify-form drop ;
|
||||||
|
|
||||||
: same-host? ( url -- ? )
|
: same-host? ( url -- ? )
|
||||||
dup [
|
dup [
|
||||||
url get
|
url get [
|
||||||
[ [ protocol>> ] [ host>> ] [ port>> ] tri 3array ] bi@ =
|
[ protocol>> ]
|
||||||
|
[ host>> ]
|
||||||
|
[ port>> remap-port ]
|
||||||
|
tri 3array
|
||||||
|
] bi@ =
|
||||||
] when ;
|
] when ;
|
||||||
|
|
||||||
: cookie-client-state ( key request -- value/f )
|
: cookie-client-state ( key request -- value/f )
|
||||||
|
|
|
@ -225,3 +225,5 @@ urls [
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ "foo#3" ] [ URL" foo" clone 3 >>anchor present ] unit-test
|
[ "foo#3" ] [ URL" foo" clone 3 >>anchor present ] unit-test
|
||||||
|
|
||||||
|
[ "http://www.foo.com/" ] [ "http://www.foo.com:80" >url present ] unit-test
|
||||||
|
|
|
@ -155,13 +155,30 @@ M: string >url
|
||||||
% password>> [ ":" % % ] when* "@" %
|
% password>> [ ":" % % ] when* "@" %
|
||||||
] [ 2drop ] if ;
|
] [ 2drop ] if ;
|
||||||
|
|
||||||
|
: protocol-port ( protocol -- port )
|
||||||
|
{
|
||||||
|
{ "http" [ 80 ] }
|
||||||
|
{ "https" [ 443 ] }
|
||||||
|
{ "feed" [ 80 ] }
|
||||||
|
{ "ftp" [ 21 ] }
|
||||||
|
[ drop f ]
|
||||||
|
} case ;
|
||||||
|
|
||||||
|
<PRIVATE
|
||||||
|
|
||||||
|
: url-port ( url -- port/f )
|
||||||
|
[ port>> ] [ port>> ] [ protocol>> protocol-port ] tri =
|
||||||
|
[ drop f ] when ;
|
||||||
|
|
||||||
|
PRIVATE>
|
||||||
|
|
||||||
: unparse-host-part ( url protocol -- )
|
: unparse-host-part ( url protocol -- )
|
||||||
%
|
%
|
||||||
"://" %
|
"://" %
|
||||||
{
|
{
|
||||||
[ unparse-username-password ]
|
[ unparse-username-password ]
|
||||||
[ host>> url-encode % ]
|
[ host>> url-encode % ]
|
||||||
[ port>> [ ":" % # ] when* ]
|
[ url-port [ ":" % # ] when* ]
|
||||||
[ path>> "/" head? [ "/" % ] unless ]
|
[ path>> "/" head? [ "/" % ] unless ]
|
||||||
} cleave ;
|
} cleave ;
|
||||||
|
|
||||||
|
@ -212,15 +229,6 @@ PRIVATE>
|
||||||
[ [ host>> ] [ port>> ] bi <inet> ] [ protocol>> ] bi
|
[ [ host>> ] [ port>> ] bi <inet> ] [ protocol>> ] bi
|
||||||
secure-protocol? [ <secure> ] when ;
|
secure-protocol? [ <secure> ] when ;
|
||||||
|
|
||||||
: protocol-port ( protocol -- port )
|
|
||||||
{
|
|
||||||
{ "http" [ 80 ] }
|
|
||||||
{ "https" [ 443 ] }
|
|
||||||
{ "feed" [ 80 ] }
|
|
||||||
{ "ftp" [ 21 ] }
|
|
||||||
[ drop f ]
|
|
||||||
} case ;
|
|
||||||
|
|
||||||
: ensure-port ( url -- url' )
|
: ensure-port ( url -- url' )
|
||||||
dup protocol>> '[ _ protocol-port or ] change-port ;
|
dup protocol>> '[ _ protocol-port or ] change-port ;
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: namespaces assocs sorting sequences kernel accessors
|
USING: namespaces assocs sorting sequences kernel accessors
|
||||||
hashtables sequences.lib db.types db.tuples db combinators
|
hashtables sequences.lib db.types db.tuples db combinators
|
||||||
calendar calendar.format math.parser syndication urls xml.writer
|
calendar calendar.format math.parser math.order syndication urls
|
||||||
xmode.catalog validators
|
xml.writer xmode.catalog validators
|
||||||
html.forms
|
html.forms
|
||||||
html.components
|
html.components
|
||||||
html.templates.chloe
|
html.templates.chloe
|
||||||
|
@ -58,7 +58,9 @@ TUPLE: paste < entity annotations ;
|
||||||
swap >>id ;
|
swap >>id ;
|
||||||
|
|
||||||
: pastes ( -- pastes )
|
: pastes ( -- pastes )
|
||||||
f <paste> select-tuples ;
|
f <paste> select-tuples
|
||||||
|
[ [ date>> ] compare ] sort
|
||||||
|
reverse ;
|
||||||
|
|
||||||
TUPLE: annotation < entity parent ;
|
TUPLE: annotation < entity parent ;
|
||||||
|
|
||||||
|
@ -111,7 +113,7 @@ M: annotation entity-url
|
||||||
<feed-action>
|
<feed-action>
|
||||||
[ pastebin-url ] >>url
|
[ pastebin-url ] >>url
|
||||||
[ "Factor Pastebin" ] >>title
|
[ "Factor Pastebin" ] >>title
|
||||||
[ pastes <reversed> ] >>entries ;
|
[ pastes ] >>entries ;
|
||||||
|
|
||||||
! ! !
|
! ! !
|
||||||
! PASTES
|
! PASTES
|
||||||
|
|
Loading…
Reference in New Issue