Version: 4.2.1
5.9 Miscellaneous Utilities
(require web-server/private/util) |
There are a number of other miscellaneous utilities the Web Server needs. They are provided by this module.
5.9.1 Contracts
Contract for non-empty strings.
5.9.2 Lists
(list-prefix? l r) → boolean? |
l : list? |
r : list? |
True if l is a prefix of r.
5.9.3 URLs
(url-replace-path proc u) → url? |
proc : ((listof path/param?) . -> . (listof path/param?)) |
u : url? |
Replaces the URL path of u with proc of the former path.
(url-path->string url-path) → string? |
url-path : (listof path/param?) |
Formats url-path as a string with "/" as a delimiter
and no params.
5.9.4 Paths
(explode-path* p) → (listof path-element?) |
p : path-string? |
Like normalize-path, but does not resolve symlinks.
(path-without-base base p) → (listof path-element?) |
base : path-string? |
p : path-string? |
Returns, as a list, the portion of p after base,
assuming base is a prefix of p.
(directory-part p) → path? |
p : path-string? |
(build-path-unless-absolute base p) → path? |
base : path-string? |
p : path-string? |
Prepends base to p, unless p is absolute.
(strip-prefix-ups p) → (listof path-element?) |
p : (listof path-element?) |
Removes all the prefix ".."s from p.
5.9.5 Exceptions
(network-error s fmt v ) → void |
s : symbol? |
fmt : string? |
v : any/c |
Like error, but throws a exn:fail:network.
(exn->string exn) → string? |
exn : (or/c exn? any/c) |
5.9.6 Strings
(lowercase-symbol! sb) → symbol? |
sb : (or/c string? bytes?) |
Returns sb as a lowercase symbol.
(read/string s) → serializable? |
s : string? |
reads a value from s and returns it.
(write/string v) → string? |
v : serializable? |
writes v to a string and returns it.
5.9.7 Bytes
(bytes-ci=? b1 b2) → boolean? |
b1 : bytes? |
b2 : bytes? |
Compares two bytes case insensitively.
(read/bytes b) → serializable? |
b : bytes? |
reads a value from b and returns it.
(write/bytes v) → bytes? |
v : serializable? |
writes v to a bytes and returns it.