A tiny, zero-dependency HTTP fileserver, meant for local development of HTML. It's not the absolute fastest, it's not the absolute smallest executable, it's not the most featureful, but it's incredibly simple to deploy and does almost nothing but just serve the file you name over HTTP. Specifically, all it does is:
/index.html
Content-Type
Because of its simplicity, it's incredibly quick to install, quick to start, and quick to respond
Planned tasks in no particular order include:
..
block works as expected with other browsers.
s in themAccept
headersContent-Encoding
, especially gzip
(for pre-gzip
'd files)Planned non-features include:
Note: As this crate hasn't been published yet, I haven't tested this yet. I will soon.
cargo install httpserv
That's it. Assuming the Cargo bin directory is on your path, you can now call
httpserv
from your command line.
All arguments are optional -- if you want to serve your current directory on
localhost:8080
with the default mappings, you can just type httpserv
and
hit enter. Otherwise:
httpserv [directory] [listen] [mappings...]
directory
: Where to look for files to serve. Defaults to .
listen
: The host/port to listen on, as expected by the FromStr
impl for
SocketAddr
. Defaults to localhost:8080
mappings...
: Any additional mappings from file extension to MIME
types, besides the defaults. Anything specified here which matches the same
extension as a default will override the default MIME type.Because this is meant for local development and not production uses, there are some issues which I haven't bothered to fix. In general, the reason why boils down to httpserv being meant to aid local development. If you're using it for anything critical, you're doing it very wrong and should get your hands on a webserver actually made to be used in production.
Content-Length
will be incorrect,
so the browser may truncate the content or display an error.