net/sendurl: improve docs on encoding in send-url
and other functions
This commit is contained in:
parent
d1525edf62
commit
6d572864d2
|
@ -31,10 +31,12 @@ On Unix, @racket[send-url] uses a user-preference, or when none is
|
||||||
set, it will look for a known browser. See the description of
|
set, it will look for a known browser. See the description of
|
||||||
@racket[external-browser] for details.
|
@racket[external-browser] for details.
|
||||||
|
|
||||||
The @racket[url] string is usually escaped to avoid dangerous shell
|
If @racket[escape?] is true, then @racket[str] is escaped (by UTF-8
|
||||||
characters (quotations, dollar signs, backslashes, and non-ASCII). Note
|
encoding followed by ``%'' encoding) to avoid dangerous shell
|
||||||
that it is a good idea to encode URLs before passing them to this
|
characters: single quotes, double quotes, backquotes, dollar signs,
|
||||||
function.
|
backslashes, non-ASCII characters, and non-graphic characters. Note
|
||||||
|
that escaping does not affect already-encoded characters in
|
||||||
|
@racket[str].
|
||||||
|
|
||||||
On all platforms, @racket[external-browser] parameter can be set to a
|
On all platforms, @racket[external-browser] parameter can be set to a
|
||||||
procedure to override the above behavior --- the procedure will be
|
procedure to override the above behavior --- the procedure will be
|
||||||
|
@ -45,12 +47,16 @@ called with the @racket[url] string.}
|
||||||
[#:query query (or/c string? false/c) #f])
|
[#:query query (or/c string? false/c) #f])
|
||||||
void?]{
|
void?]{
|
||||||
|
|
||||||
Similar to @racket[send-url], but accepts a path to a file to be
|
Similar to @racket[send-url] (with @racket[#:escape? #t]), but accepts
|
||||||
displayed by the browser. Use this function when you want to display
|
a path to a file to be displayed by the browser, along with optional
|
||||||
a local file: it takes care of the peculiarities of constructing the
|
@racket[fragment] (with no leading @litchar{#}) and @racket[query]
|
||||||
correct @litchar{file://} URL, and uses @racket[send-url] to display
|
(with no leading @litchar{?}) strings. Use @racket[send-url/file] to
|
||||||
the file. If you need to use an anchor fragment or a query string,
|
display a local file, since it takes care of the peculiarities of
|
||||||
use the corresponding keyword arguments.}
|
constructing the correct @litchar{file://} URL.
|
||||||
|
|
||||||
|
The @racket[path], @racket[fragment], and @racket[query] arguments are
|
||||||
|
all encoded in the same way as a path provided to @racket[send-url],
|
||||||
|
which means that already-encoded characters are used as-is.}
|
||||||
|
|
||||||
@defproc[(send-url/contents [contents string?] [separate-window? any/c #t]
|
@defproc[(send-url/contents [contents string?] [separate-window? any/c #t]
|
||||||
[#:fragment fragment (or/c string? false/c) #f]
|
[#:fragment fragment (or/c string? false/c) #f]
|
||||||
|
@ -59,15 +65,17 @@ use the corresponding keyword arguments.}
|
||||||
void?]{
|
void?]{
|
||||||
|
|
||||||
Similar to @racket[send-url/file], but it consumes the contents of a
|
Similar to @racket[send-url/file], but it consumes the contents of a
|
||||||
page to show, and displayes it from a temporary file.
|
page to show and displays it from a temporary file.
|
||||||
|
|
||||||
If @racket[delete-at] is a number, the temporary file is removed after
|
When @racket[send-url/content] is called, it scans old generated files
|
||||||
this many seconds. The deletion happens in a thread, so if racket
|
(this happens randomly, not on every call) and removes them to avoid
|
||||||
exits before that it will not happen --- when this function is called
|
cluttering the temporary directory. If the @racket[#:delete-at]
|
||||||
it scans old generated files (this happens randomly, not on every
|
argument is a number, then the temporary file is more eagerly removed
|
||||||
call) and removes them to avoid cluttering the temporary directory.
|
after the specified number of seconds; the deletion happens in a
|
||||||
If @racket[delete-at] is @racket[#f], no delayed deletion happens, but
|
thread, so if Racket exits earlier, the deletion will not happen. If
|
||||||
old temporary files are still deleted as described above.}
|
the @racket[#:delete-at] argument is @racket[#f], no eager deletion
|
||||||
|
happens, but old temporary files are still deleted as described
|
||||||
|
above.}
|
||||||
|
|
||||||
@defparam[external-browser cmd browser-preference?]{
|
@defparam[external-browser cmd browser-preference?]{
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user