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
|
#lang scribble/doc
|
||||||
@(require "common.ss")
|
@(require "common.ss")
|
||||||
|
|
||||||
@title{@bold{Net}: PLT Networking Libraries}
|
@title{@bold{Net}: Racket Networking Libraries}
|
||||||
|
|
||||||
@table-of-contents[]
|
@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
|
Under Mac OS X, @scheme[send-url] runs @exec{osascript} to start the
|
||||||
user's chosen browser.
|
user's chosen browser.
|
||||||
|
|
||||||
Under Unix, @scheme[send-url] uses the value of the
|
Under Unix, @scheme[send-url] uses a user-preference, or when none is
|
||||||
@scheme[external-browser] parameter to select a browser.
|
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
|
The @scheme[url] string is usually escaped to avoid dangerous shell
|
||||||
characters (quotations, dollar signs, backslashes, and non-ASCII).
|
characters (quotations, dollar signs, backslashes, and non-ASCII). Note
|
||||||
Note that it is a good idea to encode URLs before passing them to this
|
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
|
function.
|
||||||
in shell quotes: URLs can still hold characters like @litchar{#},
|
|
||||||
@litchar{?}, and @litchar{&}, so the @scheme[external-browser] should
|
On all platforms, @scheme[external-browser] parameter can be set to a
|
||||||
use quotations.}
|
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]
|
@defproc[(send-url/file [path path-string?] [separate-window? any/c #t]
|
||||||
[#:fragment fragment (or/c string? false/c) #f]
|
[#: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?]{
|
@defparam[external-browser cmd browser-preference?]{
|
||||||
|
|
||||||
A parameter that, under Unix, determines the browser started
|
A parameter that can hold a procedure to override how a browser is
|
||||||
@scheme[send-url].
|
started, or @scheme[#f] to use the default platform-dependent command.
|
||||||
|
|
||||||
The parameter is initialized to the value of the
|
Under Unix, the command that is used depends on the
|
||||||
@scheme['external-browser] preference.
|
@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
|
Note that the URL is encoded to make it work inside shell double-quotes:
|
||||||
@scheme[unix-browser-list], @scheme[#f] to indicate that the
|
URLs can still hold characters like @litchar{#}, @litchar{?}, and
|
||||||
preference is unset, or a pair of strings. If the preference is
|
@litchar{&}, so if the @scheme[external-browser] is set to a pair of
|
||||||
unset, @scheme[send-url] uses the first of the browsers from
|
prefix/suffix strings, they should use double quotes around the url.
|
||||||
@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.
|
|
||||||
|
|
||||||
If the preferred or default browser can't be launched,
|
If the preferred or default browser can't be launched,
|
||||||
@scheme[send-url] fails. See @scheme[get-preference] and
|
@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
|
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
|
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
|
@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"].
|
@scheme[path] field with only the string @scheme["a"].
|
||||||
|
|
||||||
When a @scheme["file"] URL is represented by a @scheme[url] structure,
|
When a @scheme["file"] URL is represented by a @scheme[url] structure,
|
||||||
|
|
|
@ -79,6 +79,17 @@
|
||||||
(cookie-error-test (RC cookie:add-domain "bad domain.com"))
|
(cookie-error-test (RC cookie:add-domain "bad domain.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)))
|
(test do (tests)))
|
|
@ -2,7 +2,7 @@
|
||||||
(require net/base64 net/qp tests/eli-tester)
|
(require net/base64 net/qp tests/eli-tester)
|
||||||
|
|
||||||
(define tricky-strings
|
(define tricky-strings
|
||||||
(let ([dir (collection-path "tests" "mzscheme")])
|
(let ([dir (collection-path "tests" "racket")])
|
||||||
(list (make-bytes 200 32)
|
(list (make-bytes 200 32)
|
||||||
(make-bytes 200 9)
|
(make-bytes 200 9)
|
||||||
(make-bytes 200 (char->integer #\x))
|
(make-bytes 200 (char->integer #\x))
|
||||||
|
@ -12,12 +12,12 @@
|
||||||
(make-bytes 204 (char->integer #\x))
|
(make-bytes 204 (char->integer #\x))
|
||||||
(list->bytes (for/list ([i (in-range 256)]) i))
|
(list->bytes (for/list ([i (in-range 256)]) i))
|
||||||
;; Something that doesn't end with a LF:
|
;; 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)))
|
(lambda () (read-bytes 500)))
|
||||||
#"xxx")
|
#"xxx")
|
||||||
;; CRLF:
|
;; CRLF:
|
||||||
(regexp-replace #rx#"\r?\n"
|
(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)))
|
(lambda () (read-bytes 500)))
|
||||||
#"\r\n"))))
|
#"\r\n"))))
|
||||||
|
|
||||||
|
@ -55,13 +55,13 @@
|
||||||
(open-input-bytes tricky-string)
|
(open-input-bytes tricky-string)
|
||||||
line-rx max-w))
|
line-rx max-w))
|
||||||
tricky-strings)
|
tricky-strings)
|
||||||
(let* ([dir (collection-path "tests" "mzscheme")]
|
(let* ([dir (collection-path "tests" "racket")]
|
||||||
[files (filter-map
|
[files (filter-map
|
||||||
(lambda (f)
|
(lambda (f)
|
||||||
;; check 1/4 of the files, randomly
|
;; check 1/4 of the files, randomly
|
||||||
(let ([p (build-path dir f)])
|
(let ([p (build-path dir f)])
|
||||||
(and (zero? (random 4))
|
(and (zero? (random 4))
|
||||||
(not (regexp-match #rx"^flat.*\\.ss$"
|
(not (regexp-match #rx"^flat.*\\.rktl$"
|
||||||
(path-element->string f)))
|
(path-element->string f)))
|
||||||
(file-exists? p)
|
(file-exists? p)
|
||||||
p)))
|
p)))
|
|
@ -228,8 +228,8 @@
|
||||||
"HTTP://ROBBY@WWW.DRSCHEME.ORG:80/INDEX.HTML;XXX?T=P#YYY")
|
"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"))
|
=> #("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)
|
(test-s->u #("mailto" #f #f #f #f (#("robby@racket-lang.org")) () #f)
|
||||||
"mailto:robby@plt-scheme.org")
|
"mailto:robby@racket-lang.org")
|
||||||
|
|
||||||
(test (string->url/vec "http://www.drscheme.org?bar=馨慧")
|
(test (string->url/vec "http://www.drscheme.org?bar=馨慧")
|
||||||
#("http" #f "www.drscheme.org" #f #f () ((bar . "馨慧")) #f))
|
#("http" #f "www.drscheme.org" #f #f () ((bar . "馨慧")) #f))
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
(load-relative "loadtest.ss")
|
(load-relative "loadtest.rktl")
|
||||||
|
|
||||||
(Section 'net)
|
(Section 'net)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user