From 90eaffe40cb2e068794842a498076f21db135f33 Mon Sep 17 00:00:00 2001
From: Slava Pestov
Date: Mon, 29 Sep 2008 22:16:55 -0500
Subject: [PATCH 1/6] Fix help lint
---
basis/urls/encoding/encoding-docs.factor | 6 +++---
basis/urls/encoding/encoding.factor | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/basis/urls/encoding/encoding-docs.factor b/basis/urls/encoding/encoding-docs.factor
index 5ba94ea1bc..f8b435441f 100644
--- a/basis/urls/encoding/encoding-docs.factor
+++ b/basis/urls/encoding/encoding-docs.factor
@@ -19,10 +19,10 @@ HELP: assoc>query
{ $notes "This word is used by the implementation of " { $link "urls" } ". It is also used by the HTTP client to encode POST requests." }
{ $examples
{ $example
- "USING: io urls ;"
+ "USING: io urls.encoding ;"
"{ { \"from\" \"Lead\" } { \"to\" \"Gold, please\" } }"
"assoc>query print"
- "from=Lead&to=Gold%2c+please"
+ "from=Lead&to=Gold%2c%20please"
}
} ;
@@ -32,7 +32,7 @@ HELP: query>assoc
{ $notes "This word is used by the implementation of " { $link "urls" } ". It is also used by the HTTP server to parse POST requests." }
{ $examples
{ $unchecked-example
- "USING: prettyprint urls ;"
+ "USING: prettyprint urls.encoding ;"
"\"gender=female&agefrom=22&ageto=28&location=Omaha+NE\""
"query>assoc ."
<" H{
diff --git a/basis/urls/encoding/encoding.factor b/basis/urls/encoding/encoding.factor
index a4519c99b0..fa882609a5 100644
--- a/basis/urls/encoding/encoding.factor
+++ b/basis/urls/encoding/encoding.factor
@@ -2,8 +2,8 @@
! See http://factorcode.org/license.txt for BSD license.
USING: kernel ascii combinators combinators.short-circuit
sequences splitting fry namespaces make assocs arrays strings
-io.sockets io.sockets.secure io.encodings.string
-io.encodings.utf8 math math.parser accessors hashtables present ;
+io.encodings.string io.encodings.utf8 math math.parser accessors
+hashtables present ;
IN: urls.encoding
: url-quotable? ( ch -- ? )
From 4b219373a5b4ed1fc7ca82fde1c8d36f2965cde8 Mon Sep 17 00:00:00 2001
From: Slava Pestov
Date: Mon, 29 Sep 2008 22:33:06 -0500
Subject: [PATCH 2/6] Tweaks
---
basis/furnace/actions/actions.factor | 2 +-
extra/webapps/help/help.factor | 2 +-
extra/websites/concatenative/concatenative.factor | 5 ++---
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/basis/furnace/actions/actions.factor b/basis/furnace/actions/actions.factor
index 2a63489299..7505b3c612 100755
--- a/basis/furnace/actions/actions.factor
+++ b/basis/furnace/actions/actions.factor
@@ -79,7 +79,7 @@ TUPLE: action rest authorize init display validate submit ;
: revalidate-url ( -- url/f )
revalidate-url-key param
- dup [ >url [ same-host? ] keep and ] when ;
+ dup [ >url ensure-port [ same-host? ] keep and ] when ;
: validation-failed ( -- * )
post-request? revalidate-url and [
diff --git a/extra/webapps/help/help.factor b/extra/webapps/help/help.factor
index e9b6a48634..c209fe222e 100644
--- a/extra/webapps/help/help.factor
+++ b/extra/webapps/help/help.factor
@@ -13,7 +13,7 @@ TUPLE: help-webapp < dispatcher ;
[
{
- { "search" [ 2 v-min-length 50 v-max-length v-one-line ] }
+ { "search" [ 1 v-min-length 50 v-max-length v-one-line ] }
} validate-params
help-dir set-current-directory
diff --git a/extra/websites/concatenative/concatenative.factor b/extra/websites/concatenative/concatenative.factor
index 72eb483066..0af8eb31d7 100644
--- a/extra/websites/concatenative/concatenative.factor
+++ b/extra/websites/concatenative/concatenative.factor
@@ -77,10 +77,9 @@ SYMBOL: dh-file
"password" key-password set-global
common-configuration
- "pastebin" add-responder
- "planet" add-responder
+ "pastebin" add-responder
+ "planet" add-responder
"/tmp/docs/" "docs" add-responder
-
main-responder set-global ;
From e84dec38ef2c40f185368f7c9790503d89013e87 Mon Sep 17 00:00:00 2001
From: Slava Pestov
Date: Mon, 29 Sep 2008 22:39:53 -0500
Subject: [PATCH 3/6] Doc fixes
---
basis/locals/locals-docs.factor | 2 +-
core/syntax/syntax-docs.factor | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/basis/locals/locals-docs.factor b/basis/locals/locals-docs.factor
index 748c206cc0..3dfc17c081 100644
--- a/basis/locals/locals-docs.factor
+++ b/basis/locals/locals-docs.factor
@@ -65,7 +65,7 @@ HELP: [wlet
HELP: ::
{ $syntax ":: word ( bindings... -- outputs... ) body... ;" }
-{ $description "Defines a word with named inputs; it reads stack values into bindings from left to right, then executes the body with those bindings in lexical scope. Any " { $link POSTPONE: [| } ", " { $link POSTPONE: [let } " or " { $link POSTPONE: [wlet } " forms used in the body of the word definition are automatically closure-converted." }
+{ $description "Defines a word with named inputs; it reads stack values into bindings from left to right, then executes the body with those bindings in lexical scope." }
{ $notes "The output names do not affect the word's behavior, however the compiler attempts to check the stack effect as with other definitions." }
{ $examples "See " { $link POSTPONE: [| } ", " { $link POSTPONE: [let } " and " { $link POSTPONE: [wlet } "." } ;
diff --git a/core/syntax/syntax-docs.factor b/core/syntax/syntax-docs.factor
index 905cd87903..2b7de36d56 100755
--- a/core/syntax/syntax-docs.factor
+++ b/core/syntax/syntax-docs.factor
@@ -573,12 +573,12 @@ $nl
} ;
HELP: initial:
-{ $syntax "TUPLE: ... { \"slot\" initial: value } ... ;" }
+{ $syntax "TUPLE: ... { slot initial: value } ... ;" }
{ $values { "slot" "a slot name" } { "value" "any literal" } }
{ $description "Specifies an initial value for a tuple slot." } ;
HELP: read-only
-{ $syntax "TUPLE: ... { \"slot\" read-only } ... ;" }
+{ $syntax "TUPLE: ... { slot read-only } ... ;" }
{ $values { "slot" "a slot name" } }
{ $description "Defines a tuple slot to be read-only. If a tuple has read-only slots, instances of the tuple should only be created by calling " { $link boa } ", instead of " { $link new } ". Using " { $link boa } " is the only way to set the value of a read-only slot." } ;
From a5f9e0eb23ff01c94a51da57e557bcd94fbf2f92 Mon Sep 17 00:00:00 2001
From: Slava Pestov
Date: Mon, 29 Sep 2008 22:40:00 -0500
Subject: [PATCH 4/6] Template tweak
---
extra/webapps/help/search.xml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/extra/webapps/help/search.xml b/extra/webapps/help/search.xml
index 8335725ce5..324dc028e1 100644
--- a/extra/webapps/help/search.xml
+++ b/extra/webapps/help/search.xml
@@ -23,10 +23,10 @@
This is the Factor
documentation, generated offline from a
- load-everything
image. The Factor UI also
- includes a documentation browser tool.
+ load-everything
image. If you want, you can also browse the
+ documentation from within the Factor UI.
- You may search article titles below.
+ You may search article titles below; for example, try searching for "HTTP".
From 304e069af22a835009481855c9352bbfd0f375ce Mon Sep 17 00:00:00 2001
From: Slava Pestov
Date: Mon, 29 Sep 2008 22:40:41 -0500
Subject: [PATCH 5/6] Template tweak
---
extra/webapps/help/search.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/extra/webapps/help/search.xml b/extra/webapps/help/search.xml
index 324dc028e1..e5fa5d3901 100644
--- a/extra/webapps/help/search.xml
+++ b/extra/webapps/help/search.xml
@@ -24,7 +24,7 @@
This is the Factor
documentation, generated offline from a
load-everything
image. If you want, you can also browse the
- documentation from within the Factor UI.
+ documentation from within the Factor UI.
You may search article titles below; for example, try searching for "HTTP".
From 81bd2eb175824fba470ea11a235b8173080db48e Mon Sep 17 00:00:00 2001
From: Slava Pestov
Date: Mon, 29 Sep 2008 22:54:10 -0500
Subject: [PATCH 6/6] Remove raw-query stuff, its a pain
---
basis/urls/urls-tests.factor | 5 -----
basis/urls/urls.factor | 22 +++++++++++-----------
2 files changed, 11 insertions(+), 16 deletions(-)
diff --git a/basis/urls/urls-tests.factor b/basis/urls/urls-tests.factor
index c98802657b..cac206bf3c 100644
--- a/basis/urls/urls-tests.factor
+++ b/basis/urls/urls-tests.factor
@@ -10,7 +10,6 @@ arrays kernel assocs present accessors ;
{ host "www.apple.com" }
{ port 1234 }
{ path "/a/path" }
- { raw-query "a=b" }
{ query H{ { "a" "b" } } }
{ anchor "foo" }
}
@@ -21,7 +20,6 @@ arrays kernel assocs present accessors ;
{ protocol "http" }
{ host "www.apple.com" }
{ path "/a/path" }
- { raw-query "a=b" }
{ query H{ { "a" "b" } } }
{ anchor "foo" }
}
@@ -59,7 +57,6 @@ arrays kernel assocs present accessors ;
{
T{ url
{ path "bar" }
- { raw-query "a=b" }
{ query H{ { "a" "b" } } }
}
"bar?a=b"
@@ -213,7 +210,6 @@ urls [
T{ url
{ protocol "http" }
{ host "localhost" }
- { raw-query "foo=bar" }
{ query H{ { "foo" "bar" } } }
{ path "/" }
}
@@ -224,7 +220,6 @@ urls [
T{ url
{ protocol "http" }
{ host "localhost" }
- { raw-query "foo=bar" }
{ query H{ { "foo" "bar" } } }
{ path "/" }
}
diff --git a/basis/urls/urls.factor b/basis/urls/urls.factor
index fb56e274da..5cc8c9693b 100644
--- a/basis/urls/urls.factor
+++ b/basis/urls/urls.factor
@@ -8,7 +8,7 @@ strings.parser lexer prettyprint.backend hashtables present
peg.ebnf urls.encoding ;
IN: urls
-TUPLE: url protocol username password host port path raw-query query anchor ;
+TUPLE: url protocol username password host port path query anchor ;
: ( -- url ) url new ;
@@ -47,7 +47,7 @@ protocol = [a-z]+ => [[ url-decode ]]
username = [^/:@#?]+ => [[ url-decode ]]
password = [^/:@#?]+ => [[ url-decode ]]
pathname = [^#?]+ => [[ url-decode ]]
-query = [^#]+ => [[ >string ]]
+query = [^#]+ => [[ query>assoc ]]
anchor = .+ => [[ url-decode ]]
hostname = [^/#?]+ => [[ url-decode ]]
@@ -80,7 +80,7 @@ M: string >url
] [ f f f f f ] if*
]
[ second ] ! pathname
- [ third dup query>assoc ] ! query
+ [ third ] ! query
[ fourth ] ! anchor
} cleave url boa
dup host>> [ [ "/" or ] change-path ] when ;
@@ -139,14 +139,14 @@ PRIVATE>
: derive-url ( base url -- url' )
[ clone ] dip over {
- [ [ protocol>> ] either? >>protocol ]
- [ [ username>> ] either? >>username ]
- [ [ password>> ] either? >>password ]
- [ [ host>> ] either? >>host ]
- [ [ port>> ] either? >>port ]
- [ [ path>> ] bi@ swap url-append-path >>path ]
- [ [ query>> ] either? >>query ]
- [ [ anchor>> ] either? >>anchor ]
+ [ [ protocol>> ] either? >>protocol ]
+ [ [ username>> ] either? >>username ]
+ [ [ password>> ] either? >>password ]
+ [ [ host>> ] either? >>host ]
+ [ [ port>> ] either? >>port ]
+ [ [ path>> ] bi@ swap url-append-path >>path ]
+ [ [ query>> ] either? >>query ]
+ [ [ anchor>> ] either? >>anchor ]
} 2cleave ;
: relative-url ( url -- url' )