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