From a2a1a51765cd17bf451a48d80f9475c09d90b12d Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 23 Sep 2008 14:06:36 -0500 Subject: [PATCH 1/3] Fix another bug in same-host? --- basis/furnace/furnace.factor | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/basis/furnace/furnace.factor b/basis/furnace/furnace.factor index 376da79ef2..7285c436bc 100644 --- a/basis/furnace/furnace.factor +++ b/basis/furnace/furnace.factor @@ -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 ) From bb9d24c18a7b624859fb313a3f1ad4821ede4151 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 23 Sep 2008 14:06:49 -0500 Subject: [PATCH 2/3] Fix paste order --- extra/webapps/pastebin/pastebin.factor | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/extra/webapps/pastebin/pastebin.factor b/extra/webapps/pastebin/pastebin.factor index 3aeb21420f..2de31c82e7 100644 --- a/extra/webapps/pastebin/pastebin.factor +++ b/extra/webapps/pastebin/pastebin.factor @@ -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 select-tuples ; + f select-tuples + [ [ date>> ] compare ] sort + reverse ; TUPLE: annotation < entity parent ; @@ -111,7 +113,7 @@ M: annotation entity-url [ pastebin-url ] >>url [ "Factor Pastebin" ] >>title - [ pastes ] >>entries ; + [ pastes ] >>entries ; ! ! ! ! PASTES From d9d5dcc7a622af4aa9ede34707832920aba6776e Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 23 Sep 2008 14:17:02 -0500 Subject: [PATCH 3/3] Fix Safari weirdness --- basis/urls/urls-tests.factor | 2 ++ basis/urls/urls.factor | 28 ++++++++++++++++++---------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/basis/urls/urls-tests.factor b/basis/urls/urls-tests.factor index 7f835b2918..75ee7b6740 100644 --- a/basis/urls/urls-tests.factor +++ b/basis/urls/urls-tests.factor @@ -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 diff --git a/basis/urls/urls.factor b/basis/urls/urls.factor index 488e0a121c..19bae087af 100644 --- a/basis/urls/urls.factor +++ b/basis/urls/urls.factor @@ -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 ; + +> ] [ 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 ] [ protocol>> ] bi secure-protocol? [ ] 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 ;