Merge branch 'master' of git://factorcode.org/git/factor

db4
Doug Coleman 2008-09-29 22:54:37 -05:00
commit b5664733ed
10 changed files with 26 additions and 32 deletions

View File

@ -79,7 +79,7 @@ TUPLE: action rest authorize init display validate submit ;
: revalidate-url ( -- url/f ) : revalidate-url ( -- url/f )
revalidate-url-key param revalidate-url-key param
dup [ >url [ same-host? ] keep and ] when ; dup [ >url ensure-port [ same-host? ] keep and ] when ;
: validation-failed ( -- * ) : validation-failed ( -- * )
post-request? revalidate-url and [ post-request? revalidate-url and [

View File

@ -65,7 +65,7 @@ HELP: [wlet
HELP: :: HELP: ::
{ $syntax ":: word ( bindings... -- outputs... ) body... ;" } { $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." } { $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 } "." } ; { $examples "See " { $link POSTPONE: [| } ", " { $link POSTPONE: [let } " and " { $link POSTPONE: [wlet } "." } ;

View File

@ -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." } { $notes "This word is used by the implementation of " { $link "urls" } ". It is also used by the HTTP client to encode POST requests." }
{ $examples { $examples
{ $example { $example
"USING: io urls ;" "USING: io urls.encoding ;"
"{ { \"from\" \"Lead\" } { \"to\" \"Gold, please\" } }" "{ { \"from\" \"Lead\" } { \"to\" \"Gold, please\" } }"
"assoc>query print" "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." } { $notes "This word is used by the implementation of " { $link "urls" } ". It is also used by the HTTP server to parse POST requests." }
{ $examples { $examples
{ $unchecked-example { $unchecked-example
"USING: prettyprint urls ;" "USING: prettyprint urls.encoding ;"
"\"gender=female&agefrom=22&ageto=28&location=Omaha+NE\"" "\"gender=female&agefrom=22&ageto=28&location=Omaha+NE\""
"query>assoc ." "query>assoc ."
<" H{ <" H{

View File

@ -2,8 +2,8 @@
! 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
io.sockets io.sockets.secure io.encodings.string io.encodings.string io.encodings.utf8 math math.parser accessors
io.encodings.utf8 math math.parser accessors hashtables present ; hashtables present ;
IN: urls.encoding IN: urls.encoding
: url-quotable? ( ch -- ? ) : url-quotable? ( ch -- ? )

View File

@ -10,7 +10,6 @@ arrays kernel assocs present accessors ;
{ host "www.apple.com" } { host "www.apple.com" }
{ port 1234 } { port 1234 }
{ path "/a/path" } { path "/a/path" }
{ raw-query "a=b" }
{ query H{ { "a" "b" } } } { query H{ { "a" "b" } } }
{ anchor "foo" } { anchor "foo" }
} }
@ -21,7 +20,6 @@ arrays kernel assocs present accessors ;
{ protocol "http" } { protocol "http" }
{ host "www.apple.com" } { host "www.apple.com" }
{ path "/a/path" } { path "/a/path" }
{ raw-query "a=b" }
{ query H{ { "a" "b" } } } { query H{ { "a" "b" } } }
{ anchor "foo" } { anchor "foo" }
} }
@ -59,7 +57,6 @@ arrays kernel assocs present accessors ;
{ {
T{ url T{ url
{ path "bar" } { path "bar" }
{ raw-query "a=b" }
{ query H{ { "a" "b" } } } { query H{ { "a" "b" } } }
} }
"bar?a=b" "bar?a=b"
@ -213,7 +210,6 @@ urls [
T{ url T{ url
{ protocol "http" } { protocol "http" }
{ host "localhost" } { host "localhost" }
{ raw-query "foo=bar" }
{ query H{ { "foo" "bar" } } } { query H{ { "foo" "bar" } } }
{ path "/" } { path "/" }
} }
@ -224,7 +220,6 @@ urls [
T{ url T{ url
{ protocol "http" } { protocol "http" }
{ host "localhost" } { host "localhost" }
{ raw-query "foo=bar" }
{ query H{ { "foo" "bar" } } } { query H{ { "foo" "bar" } } }
{ path "/" } { path "/" }
} }

View File

@ -8,7 +8,7 @@ strings.parser lexer prettyprint.backend hashtables present
peg.ebnf urls.encoding ; peg.ebnf urls.encoding ;
IN: urls 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 ) url new ; : <url> ( -- url ) url new ;
@ -47,7 +47,7 @@ protocol = [a-z]+ => [[ url-decode ]]
username = [^/:@#?]+ => [[ url-decode ]] username = [^/:@#?]+ => [[ url-decode ]]
password = [^/:@#?]+ => [[ url-decode ]] password = [^/:@#?]+ => [[ url-decode ]]
pathname = [^#?]+ => [[ url-decode ]] pathname = [^#?]+ => [[ url-decode ]]
query = [^#]+ => [[ >string ]] query = [^#]+ => [[ query>assoc ]]
anchor = .+ => [[ url-decode ]] anchor = .+ => [[ url-decode ]]
hostname = [^/#?]+ => [[ url-decode ]] hostname = [^/#?]+ => [[ url-decode ]]
@ -80,7 +80,7 @@ M: string >url
] [ f f f f f ] if* ] [ f f f f f ] if*
] ]
[ second ] ! pathname [ second ] ! pathname
[ third dup query>assoc ] ! query [ third ] ! query
[ fourth ] ! anchor [ fourth ] ! anchor
} cleave url boa } cleave url boa
dup host>> [ [ "/" or ] change-path ] when ; dup host>> [ [ "/" or ] change-path ] when ;

View File

@ -573,12 +573,12 @@ $nl
} ; } ;
HELP: initial: HELP: initial:
{ $syntax "TUPLE: ... { \"slot\" initial: value } ... ;" } { $syntax "TUPLE: ... { slot initial: value } ... ;" }
{ $values { "slot" "a slot name" } { "value" "any literal" } } { $values { "slot" "a slot name" } { "value" "any literal" } }
{ $description "Specifies an initial value for a tuple slot." } ; { $description "Specifies an initial value for a tuple slot." } ;
HELP: read-only HELP: read-only
{ $syntax "TUPLE: ... { \"slot\" read-only } ... ;" } { $syntax "TUPLE: ... { slot read-only } ... ;" }
{ $values { "slot" "a slot name" } } { $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." } ; { $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." } ;

View File

@ -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 } validate-params
help-dir set-current-directory help-dir set-current-directory

View File

@ -23,10 +23,10 @@
<p>This is the <a href="http://factorcode.org" target="_top">Factor</a> <p>This is the <a href="http://factorcode.org" target="_top">Factor</a>
documentation, generated offline from a documentation, generated offline from a
<code>load-everything</code> image. The Factor UI also <code>load-everything</code> image. If you want, you can also browse the
includes a documentation browser tool.</p> documentation from within the <a href="http://factorcode.org" target="_top">Factor</a> UI.</p>
<p>You may search article titles below.</p> <p>You may search article titles below; for example, try searching for "HTTP".</p>
<t:form t:action="$help-webapp/search"> <t:form t:action="$help-webapp/search">
<t:field t:name="search" /> <t:field t:name="search" />

View File

@ -77,10 +77,9 @@ SYMBOL: dh-file
"password" key-password set-global "password" key-password set-global
common-configuration common-configuration
<factor-website> <factor-website>
<pastebin> "pastebin" add-responder <pastebin> <factor-boilerplate> "pastebin" add-responder
<planet> "planet" add-responder <planet> <factor-boilerplate> "planet" add-responder
"/tmp/docs/" <help-webapp> "docs" add-responder "/tmp/docs/" <help-webapp> "docs" add-responder
<factor-boilerplate>
<configuration> <configuration>
main-responder set-global ; main-responder set-global ;