A lot of "plt-scheme.org" -> "racket-lang.org"s.
original commit: a46743211b
This commit is contained in:
commit
12ab929e59
|
@ -1,7 +1,7 @@
|
|||
#lang scribble/doc
|
||||
@(require "common.ss")
|
||||
|
||||
@title{@bold{Net}: PLT Networking Libraries}
|
||||
@title{@bold{Net}: Racket Networking Libraries}
|
||||
|
||||
@table-of-contents[]
|
||||
|
||||
|
|
|
@ -29,16 +29,18 @@ use an intermediate redirecting file due to a bug in IE7.)
|
|||
Under Mac OS X, @scheme[send-url] runs @exec{osascript} to start the
|
||||
user's chosen browser.
|
||||
|
||||
Under Unix, @scheme[send-url] uses the value of the
|
||||
@scheme[external-browser] parameter to select a browser.
|
||||
Under Unix, @scheme[send-url] uses a user-preference, or when none is
|
||||
set, it will look for a known browser. See the description of
|
||||
@scheme[external-browser] for details.
|
||||
|
||||
The @scheme[url] string is usually escaped to avoid dangerous shell
|
||||
characters (quotations, dollar signs, backslashes, and non-ASCII).
|
||||
Note that it is a good idea to encode URLs before passing them to this
|
||||
function. Also note that the encoding is meant to make the URL work
|
||||
in shell quotes: URLs can still hold characters like @litchar{#},
|
||||
@litchar{?}, and @litchar{&}, so the @scheme[external-browser] should
|
||||
use quotations.}
|
||||
characters (quotations, dollar signs, backslashes, and non-ASCII). Note
|
||||
that it is a good idea to encode URLs before passing them to this
|
||||
function.
|
||||
|
||||
On all platforms, @scheme[external-browser] parameter can be set to a
|
||||
procedure to override the above behavior --- the procedure will be
|
||||
called with the @scheme[url] string.}
|
||||
|
||||
@defproc[(send-url/file [path path-string?] [separate-window? any/c #t]
|
||||
[#:fragment fragment (or/c string? false/c) #f]
|
||||
|
@ -71,20 +73,24 @@ old temporary files are still deleted as described above.}
|
|||
|
||||
@defparam[external-browser cmd browser-preference?]{
|
||||
|
||||
A parameter that, under Unix, determines the browser started
|
||||
@scheme[send-url].
|
||||
A parameter that can hold a procedure to override how a browser is
|
||||
started, or @scheme[#f] to use the default platform-dependent command.
|
||||
|
||||
The parameter is initialized to the value of the
|
||||
@scheme['external-browser] preference.
|
||||
Under Unix, the command that is used depends on the
|
||||
@scheme['external-browser] preference. If the preference is unset,
|
||||
@scheme[send-url] uses the first of the browsers from
|
||||
@scheme[unix-browser-list] for which the executable is found.
|
||||
Otherwise, the preference should hold a symbol indicating a known
|
||||
browser (from the @scheme[unix-browser-list]), or it a pair of a prefix
|
||||
and a suffix string that are concatenated around the @scheme[url] string
|
||||
to make up a shell command to run. In addition, the
|
||||
@scheme[external-browser] paremeter can be set to one of these values,
|
||||
and @scheme[send-url] will use it instead of the preference value.
|
||||
|
||||
The parameter value can be any of the symbols in
|
||||
@scheme[unix-browser-list], @scheme[#f] to indicate that the
|
||||
preference is unset, or a pair of strings. If the preference is
|
||||
unset, @scheme[send-url] uses the first of the browsers from
|
||||
@scheme[unix-browser-list] for which the executable is found. If the
|
||||
parameter is a pair of strings, then a command line is constructed by
|
||||
concatenating in order the first string, the URL string, and the
|
||||
second string.
|
||||
Note that the URL is encoded to make it work inside shell double-quotes:
|
||||
URLs can still hold characters like @litchar{#}, @litchar{?}, and
|
||||
@litchar{&}, so if the @scheme[external-browser] is set to a pair of
|
||||
prefix/suffix strings, they should use double quotes around the url.
|
||||
|
||||
If the preferred or default browser can't be launched,
|
||||
@scheme[send-url] fails. See @scheme[get-preference] and
|
||||
|
|
|
@ -69,9 +69,9 @@ adjusts the behavior.
|
|||
|
||||
An empty string at the end of the @scheme[path] list corresponds to a
|
||||
URL that ends in a slash. For example, the result of
|
||||
@scheme[(string->url "http://www.drscheme.org/a/")] has a
|
||||
@scheme[(string->url "http://racket-lang.org/a/")] has a
|
||||
@scheme[path] field with strings @scheme["a"] and @scheme[""], while
|
||||
the result of @scheme[(string->url "http://www.drscheme.org/a")] has a
|
||||
the result of @scheme[(string->url "http://racket-lang.org/a")] has a
|
||||
@scheme[path] field with only the string @scheme["a"].
|
||||
|
||||
When a @scheme["file"] URL is represented by a @scheme[url] structure,
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
(syntax-rules ()
|
||||
[(o/* x) x]
|
||||
[(o/* x f g ...) (f (o/* x g ...))]))
|
||||
|
||||
|
||||
(define (tests)
|
||||
|
||||
|
||||
;; test the most basic functionality
|
||||
(cookie-test (λ (x) x) "a=b; Version=1")
|
||||
|
||||
|
||||
;; test each modifier individually
|
||||
(cookie-test (RC cookie:add-comment "set+a+to+b")
|
||||
"a=b; Comment=set+a+to+b; Version=1")
|
||||
|
@ -54,7 +54,7 @@
|
|||
"a=b; Version=1")
|
||||
(cookie-test (RC cookie:version 12)
|
||||
"a=b; Version=12")
|
||||
|
||||
|
||||
;; test combinations
|
||||
(cookie-test (o (RC cookie:add-comment "set+a+to+b")
|
||||
(RC cookie:add-domain ".example.net"))
|
||||
|
@ -66,7 +66,7 @@
|
|||
(RC cookie:version 10)
|
||||
(RC cookie:add-max-age 20))
|
||||
"a=b; Max-Age=20; Path=\"/whatever/wherever/\"; Version=10")
|
||||
|
||||
|
||||
;; test error cases
|
||||
(let ()
|
||||
(define-syntax cookie-error-test
|
||||
|
@ -78,7 +78,18 @@
|
|||
(cookie-error-test (RC cookie:add-domain "doesntstartwithadot.example.com"))
|
||||
(cookie-error-test (RC cookie:add-domain "bad domain.com"))
|
||||
(cookie-error-test (RC cookie:add-domain ".bad-domain;com")))
|
||||
|
||||
|
||||
; cookie value
|
||||
(test
|
||||
(cookie-value? "value")
|
||||
(cookie-value? "(")
|
||||
(cookie-value? "!")
|
||||
(cookie-value? ")")
|
||||
(cookie-value? ")!")
|
||||
(cookie-value? "(!")
|
||||
(cookie-value? "(!)")
|
||||
(cookie-value? "!)"))
|
||||
|
||||
)
|
||||
|
||||
|
||||
(test do (tests)))
|
|
@ -2,7 +2,7 @@
|
|||
(require net/base64 net/qp tests/eli-tester)
|
||||
|
||||
(define tricky-strings
|
||||
(let ([dir (collection-path "tests" "mzscheme")])
|
||||
(let ([dir (collection-path "tests" "racket")])
|
||||
(list (make-bytes 200 32)
|
||||
(make-bytes 200 9)
|
||||
(make-bytes 200 (char->integer #\x))
|
||||
|
@ -12,12 +12,12 @@
|
|||
(make-bytes 204 (char->integer #\x))
|
||||
(list->bytes (for/list ([i (in-range 256)]) i))
|
||||
;; Something that doesn't end with a LF:
|
||||
(bytes-append (with-input-from-file (build-path dir "net.ss")
|
||||
(bytes-append (with-input-from-file (build-path dir "net.rktl")
|
||||
(lambda () (read-bytes 500)))
|
||||
#"xxx")
|
||||
;; CRLF:
|
||||
(regexp-replace #rx#"\r?\n"
|
||||
(with-input-from-file (build-path dir "net.ss")
|
||||
(with-input-from-file (build-path dir "net.rktl")
|
||||
(lambda () (read-bytes 500)))
|
||||
#"\r\n"))))
|
||||
|
||||
|
@ -55,13 +55,13 @@
|
|||
(open-input-bytes tricky-string)
|
||||
line-rx max-w))
|
||||
tricky-strings)
|
||||
(let* ([dir (collection-path "tests" "mzscheme")]
|
||||
(let* ([dir (collection-path "tests" "racket")]
|
||||
[files (filter-map
|
||||
(lambda (f)
|
||||
;; check 1/4 of the files, randomly
|
||||
(let ([p (build-path dir f)])
|
||||
(and (zero? (random 4))
|
||||
(not (regexp-match #rx"^flat.*\\.ss$"
|
||||
(not (regexp-match #rx"^flat.*\\.rktl$"
|
||||
(path-element->string f)))
|
||||
(file-exists? p)
|
||||
p)))
|
|
@ -228,8 +228,8 @@
|
|||
"HTTP://ROBBY@WWW.DRSCHEME.ORG:80/INDEX.HTML;XXX?T=P#YYY")
|
||||
=> #("http" "ROBBY" "www.drscheme.org" 80 #t (#("INDEX.HTML" "XXX")) ((T . "P")) "YYY"))
|
||||
|
||||
(test-s->u #("mailto" #f #f #f #f (#("robby@plt-scheme.org")) () #f)
|
||||
"mailto:robby@plt-scheme.org")
|
||||
(test-s->u #("mailto" #f #f #f #f (#("robby@racket-lang.org")) () #f)
|
||||
"mailto:robby@racket-lang.org")
|
||||
|
||||
(test (string->url/vec "http://www.drscheme.org?bar=馨慧")
|
||||
#("http" #f "www.drscheme.org" #f #f () ((bar . "馨慧")) #f))
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
(load-relative "loadtest.ss")
|
||||
(load-relative "loadtest.rktl")
|
||||
|
||||
(Section 'net)
|
||||
|
Loading…
Reference in New Issue
Block a user