index : static-web-server.git

ascending towards madness

author Jose Quintana <joseluisquintana20@gmail.com> 2023-04-22 20:20:49.0 +00:00:00
committer Jose Quintana <joseluisquintana20@gmail.com> 2023-04-22 20:20:49.0 +00:00:00
commit
85851e93226645880f8c9cfcb4c411a36f10406a [patch]
tree
229f00ae99714e91bd1ace286a365459682171f0
parent
981c3888102a36f133f149ada3a3464ffe0a53dc
download
85851e93226645880f8c9cfcb4c411a36f10406a.tar.gz

docs: zstd compression feature description [skip ci]



Diff

 README.md                                   |  2 +-
 docs/content/features/compression-static.md |  6 ++----
 docs/content/features/compression.md        |  4 ++--
 docs/content/index.md                       | 20 ++++++++++----------
 4 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/README.md b/README.md
index 3690656..a1c03c7 100644
--- a/README.md
+++ b/README.md
@@ -42,7 +42,7 @@ It's cross-platform and available for `Linux`, `macOS`, `Windows` and `FreeBSD` 
- Memory-safe and significantly reduced CPU and RAM overhead.
- Blazing fast static files-serving and asynchronous powered by the latest [Hyper]https://github.com/hyperium/hyper/, [Tokio]https://github.com/tokio-rs/tokio and a set of [awesome crates]https://github.com/static-web-server/static-web-server/blob/master/Cargo.toml.
- Single __4MB__ (uncompressed) and fully static binary with no dependencies ([Musl libc]https://doc.rust-lang.org/edition-guide/rust-2018/platform-and-target-support/musl-support-for-fully-static-binaries.html). Suitable for running on [any Linux distro]https://en.wikipedia.org/wiki/Linux_distribution or [Docker container]https://hub.docker.com/r/joseluisq/static-web-server/tags.
- Optional GZip, Deflate or Brotli compression for text-based web files only.
- Optional GZip, Deflate, Brotli or Zstandard (zstd) compression for text-based web files only.
- Compression on-demand via [Accept-Encoding]https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding header.
- [Partial Content Delivery]https://en.wikipedia.org/wiki/Byte_serving support for byte-serving of large files.
- Optional [Cache-Control]https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control headers for assets.
diff --git a/docs/content/features/compression-static.md b/docs/content/features/compression-static.md
index 5754bac..2e6cd3f 100644
--- a/docs/content/features/compression-static.md
+++ b/docs/content/features/compression-static.md
@@ -1,8 +1,8 @@
# Pre-compressed files serving

**`SWS`** provides support to serve pre-compressed [`Gzip`]https://datatracker.ietf.org/doc/html/rfc1952 or [`Brotli`]https://www.ietf.org/rfc/rfc7932.txt files directly from the disk.
**`SWS`** provides support to serve pre-compressed [`Gzip`]https://datatracker.ietf.org/doc/html/rfc1952, [`Brotli`]https://www.ietf.org/rfc/rfc7932.txt and [`Zstandard` (zstd)]https://datatracker.ietf.org/doc/html/rfc8878 files directly from the disk.

SWS can look up existing pre-compressed file variants (`.gz` or `.br`) on disk and serve them directly.
SWS can look up existing pre-compressed file variants (`.gz`, `.br` or `zst`) on disk and serve them directly.

The feature is disabled by default and can be controlled by the boolean `--compression-static` option or the equivalent [SERVER_COMPRESSION_STATIC]./../configuration/environment-variables.md#server_compression_static env.

@@ -14,7 +14,6 @@ Otherwise, if the pre-compressed file is not found then SWS just continues the n

Here is an example:


```sh
static-web-server -p=8787 -d=/var/www --compression-static=true -g=trace
```
@@ -34,4 +33,3 @@ Below are some relevant log entries to show how the feature works.
2022-09-22T21:30:12.905965Z TRACE encode_headers: hyper::proto::h1::role: close time.busy=138µs time.idle=35.4µs
2022-09-22T21:30:12.906236Z DEBUG hyper::proto::h1::io: flushed 242 bytes
```

diff --git a/docs/content/features/compression.md b/docs/content/features/compression.md
index 7eda687..e81faf8 100644
--- a/docs/content/features/compression.md
+++ b/docs/content/features/compression.md
@@ -1,12 +1,12 @@
# Compression

**`SWS`** provides [`Gzip`]https://datatracker.ietf.org/doc/html/rfc1952, [`Deflate`]https://datatracker.ietf.org/doc/html/rfc1951#section-Abstract and [`Brotli`]https://www.ietf.org/rfc/rfc7932.txt compression of HTTP responses.
**`SWS`** provides [`Gzip`]https://datatracker.ietf.org/doc/html/rfc1952, [`Deflate`]https://datatracker.ietf.org/doc/html/rfc1951#section-Abstract, [`Brotli`]https://www.ietf.org/rfc/rfc7932.txt and [`Zstandard` (zstd)]https://datatracker.ietf.org/doc/html/rfc8878 compression of HTTP responses.

The compression functionality is determined by the [`Accept-Encoding`]https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding header and is only applied to text-based web file types.

## MIME types compressed

Only this list of common text-based MIME type files will be compressed either with `Gzip`, `Deflate` or `Brotli` via the `Accept-Encoding` header value.
Only this list of common text-based MIME-type files will be compressed either with `Gzip`, `Deflate` or `Brotli` via the `Accept-Encoding` header value.

```txt
text/html
diff --git a/docs/content/index.md b/docs/content/index.md
index 697cebd..e537b82 100644
--- a/docs/content/index.md
+++ b/docs/content/index.md
@@ -31,23 +31,23 @@

## Overview

**Static Web Server** (or **`SWS`** abbreviated) is a very small and fast production-ready web server suitable to serve static web files or assets.
**Static Web Server** (or **`SWS`** abbreviated) is a tiny and fast production-ready web server suitable to serve static web files or assets.

It is focused on **lightness** and **easy-to-use** principles while keeping [high performance and safety]https://blog.rust-lang.org/2015/04/10/Fearless-Concurrency.html powered by [The Rust Programming Language]https://rust-lang.org.
It is focused on **lightness and easy-to-use** principles while keeping [high performance and safety]https://blog.rust-lang.org/2015/04/10/Fearless-Concurrency.html powered by [The Rust Programming Language]https://rust-lang.org.

Written on top of [Hyper]https://github.com/hyperium/hyper and [Tokio]https://github.com/tokio-rs/tokio runtime. It provides [concurrent and asynchronous networking abilities]https://rust-lang.github.io/async-book/01_getting_started/02_why_async.html as well as the latest HTTP/1 - HTTP/2 implementations.
Written on top of [Hyper]https://github.com/hyperium/hyper and [Tokio]https://github.com/tokio-rs/tokio runtime, it provides [concurrent and asynchronous networking abilities]https://rust-lang.github.io/async-book/01_getting_started/02_why_async.html and the latest HTTP/1 - HTTP/2 implementations.

It's cross-platform and available for Linux, macOS, Windows and FreeBSD (`x86`,`x86_64`,`ARM`,`ARM64`) as well as Docker.
It's cross-platform and available for `Linux`, `macOS`, `Windows` and `FreeBSD` (`x86`/`x86_64`,  `ARM`/`ARM64`) and `Docker`.

![static-web-server]https://user-images.githubusercontent.com/1700322/152613820-658f025c-d0a4-46b3-aa6d-bdc7f638ce77.png

## Features

- Built with [Rust]https://rust-lang.org which is focused on [safety, speed and concurrency]https://kornel.ski/rust-c-speed.
- Memory safe and very reduced CPU and RAM overhead.
- Blazing fast static files-serving and asynchronous powered by latest [Hyper]https://github.com/hyperium/hyper/, [Tokio]https://github.com/tokio-rs/tokio and a set of [awesome crates]https://github.com/static-web-server/static-web-server/blob/master/Cargo.toml.
- Built with [Rust]https://rust-lang.org, which focuses on [safety, speed and concurrency]https://kornel.ski/rust-c-speed.
- Memory-safe and significantly reduced CPU and RAM overhead.
- Blazing fast static files-serving and asynchronous powered by the latest [Hyper]https://github.com/hyperium/hyper/, [Tokio]https://github.com/tokio-rs/tokio and a set of [awesome crates]https://github.com/static-web-server/static-web-server/blob/master/Cargo.toml.
- Single __4MB__ (uncompressed) and fully static binary with no dependencies ([Musl libc]https://doc.rust-lang.org/edition-guide/rust-2018/platform-and-target-support/musl-support-for-fully-static-binaries.html). Suitable for running on [any Linux distro]https://en.wikipedia.org/wiki/Linux_distribution or [Docker container]https://hub.docker.com/r/joseluisq/static-web-server/tags.
- Optional GZip, Deflate or Brotli compression for text-based web files only.
- Optional GZip, Deflate, Brotli or Zstandard (zstd) compression for text-based web files only.
- Compression on-demand via [Accept-Encoding]https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding header.
- [Partial Content Delivery]https://en.wikipedia.org/wiki/Byte_serving support for byte-serving of large files.
- Optional [Cache-Control]https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control headers for assets.
@@ -56,7 +56,7 @@ It's cross-platform and available for Linux, macOS, Windows and FreeBSD (`x86`,`
- [Security headers]https://web.dev/security-headers/ for HTTP/2 by default.
- [HEAD]https://tools.ietf.org/html/rfc7231#section-4.3.2 responses.
- Lightweight and configurable logging via [tracing]https://github.com/tokio-rs/tracing crate.
- Customizable number of worker threads.
- A Customizable number of worker threads.
- Optional directory listing.
- [CORS]https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS support.
- Basic HTTP Authentication.
@@ -68,7 +68,7 @@ It's cross-platform and available for Linux, macOS, Windows and FreeBSD (`x86`,`
- Custom URL rewrites and redirects via glob patterns.
- Support for serving pre-compressed (Gzip/Brotli) files.
- First-class [Docker]https://docs.docker.com/get-started/overview/ support. [Scratch]https://hub.docker.com/_/scratch and latest [Alpine Linux]https://hub.docker.com/_/alpine Docker images.
- Ability to accept a socket listener as a file descriptor for use in sandboxing and on-demand applications (E.g [systemd]http://0pointer.de/blog/projects/socket-activation.html).
- Ability to accept a socket listener as a file descriptor for sandboxing and on-demand applications (e.g [systemd]http://0pointer.de/blog/projects/socket-activation.html).
- Cross-platform. Pre-compiled binaries for Linux, macOS, Windows and FreeBSD (`x86`,`x86_64`,`ARM`,`ARM64`).

## Benchmarks