5.9 Miscellaneous Utilities

► |  | Web Server: HTTP Server

1 | Dispatching Server
2 | Dispatchers
3 | Launching Servers
4 | Web Servers
5 | Internal APIs
6 | Troubleshooting and Tips
| Index

▼ | 5 | Internal APIs

5.1 | Timers
5.2 | Connection Manager
5.3 | Serializable Closures
5.4 | Cache Table
5.5 | MIME Types
5.6 | Serialization Utilities
5.7 | URL Param
5.8 | GZip
5.9 | Miscellaneous Utilities

On this page:

bytes-ci=?
url-replace-path
url-path->string
explode-path*
path-without-base
directory-part
build-path-unless-absolute
network-error
exn->string
read/ bytes
write/ bytes
path-piece?

top contents ← prev up next →

### 5.9 Miscellaneous Utilities🔗ℹ

(require web-server/private/util) | package: web-server-lib

> procedure (bytes-ci=? b1 b2) → boolean?
> b1 : bytes?
> b2 : bytes?

Compares two bytes case insensitively.

> procedure (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.

> procedure (url-path->string url-path) → string?
> url-path : (listof path/param?)

Formats url-path as a string with "/" as a delimiter and no params.

> procedure (explode-path* p) → (listof path-piece?)
> p : path-string?

Like normalize-path, but does not resolve symlinks.

> procedure (path-without-base base p) → (listof path-piece?)
> base : path-string?
> p : path-string?

Returns, as a list, the portion of p after base, assuming base is a prefix of p.

> procedure (directory-part p) → path?
> p : path-string?

Returns the directory part of p, returning (current-directory) if it is relative.

> procedure (build-path-unless-absolute base p) → path?
> base : path-string?
> p : path-string?

Prepends base to p, unless p is absolute.

> procedure (network-error s fmt v ...) → void
> s : symbol?
> fmt : string?
> v : any/c

Like error, but throws a exn:fail:network.

> procedure (exn->string exn) → string?
> exn : (or/c exn? any/c)

Formats exn with (error-display-handler) as a string.

> procedure (read/bytes bstr) → printable/c
> bstr : bytes?

Extracts a value from bstr using read.

> procedure (write/bytes v) → bytes?
> v : printable/c

Prints v into a byte string using write.

> value path-piece? : contract?

Equivalent to (or/c path-string? (symbols 'up 'same)).
top contents ← prev up next →