Basic HTTP server for local hosting.
Copyright © 2024 Chris Roberts (Krobbizoid).
Holo is a basic HTTP server targeted at serving local files for testing. Because of its focus on simplicity and privacy, it has some limitations that may prevent it from doing what you want it to do.
Build Holo with cargo build --release
and move the executable from
target/release/holo(.exe)
to a directory with environment access. After this
you can use Holo from the command line:
holo [OPTIONS] [root]
By default, Holo will serve files from the current working directory at
http://localhost:8080/
. Holo will continue running until Ctrl+C
is used to
exit.
Argument | Usage |
---|---|
[root] |
Server root directory [default: .] |
Holo can be given an optional argument representing the path to serve files from. The path must be an existing directory. If no path is given, the current working directory will be used.
Short | Long | Arguments | Usage |
---|---|---|---|
-p |
--port |
<port> |
TCP port [default: 8080] |
-i |
--index |
(None) | Serve automatic index pages |
-c |
--cors |
(None) | Enable cross-origin resource sharing |
-h |
--help |
(None) | Print help |
-V |
--version |
(None) | Print version |
If the --port
option is not set, the default port of 8080
will be used.
Ports below 1024
are likely to be reserved or require administrator
privileges.
If the --index
flag is set, an automatic index page listing directories and
files will be served when a directory without an index.html
file is
requested. If the flag is not set, a 404 page will be served instead.
If the --cors
flag is set, resources from outside the host machine will be
allowed in webpages, but some JavaScript features will be disabled.
If the --help
or --version
flags are set, Holo will print information but
not perform any action.
Serve files in the current working directory on port 8080
:
holo
Serve files in etc/builds/web/
on port 8080
:
holo etc/builds/web/
Serve files in files/
on port 8080
with automatic index pages:
holo files -i
Serve files in C:\htdocs\
on port 80
with cross-origin resources:
holo C:\htdocs -p 80 -c
- Clients from outside the host machine will only be served 403 pages. This is an intentional design choice to improve privacy. An option to open servers to LAN or the internet is being considered.
- Holo does not support HTTPS or any kind of content encoding.
- Holo runs on a single thread. HTTP requests are queued up and must be handled one at a time.
- Request methods and headers are ignored.
Holo uses the following libraries:
- clap - Command line argument parsing.
- new_mime_guess - Media type inference.
- percent-encoding - URL encoding and decoding.
Holo is released under the MIT License:
https://krobbi.github.io/license/2024/mit.txt
See LICENSE.txt for a full copy of the license text.