* chore: improve crate doc checks on ci
* fix: doc_auto_cfg feature has been removed (error)
* fix: bare URLs are not automatically turned into clickable links (warning)
It optimizes for binary size by replacing the `regex` crate with its lightweight equivalent (`regex-lite`).
The change reports a binary size reduction of approximately `~500KB`.
x86_64-unknown-linux-musl example:
before (v2.39.0):
8,9M static-web-server
after:
8,4M static-web-server
* feat: add `exit_on_error` option when starting server to choose if the
entire process exits if the server fails to start
* Update src/server.rs
* style: formatting fix
---------
Co-authored-by: Francis Tseng <accounts@frnsys.com>
Co-authored-by: Jose Quintana <1700322+joseluisq@users.noreply.github.com>
* virtual hosts: support HTTP/2 using :authority
So far, the HTTP host header has been used to determine the hostname
that is being accessed. In HTTP/2, this header is not guaranteed to be
sent. Instead, the ":authority" pseudo-header field is used. This commit
adds a check for that header to make virtual hosts also work with
HTTP/2.
Additionally, this commit adds code to check and remove the port number,
which may or may not be sent as part of the HTTP host header.
* chore: add test cases
---------
Co-authored-by: CrazyCraftix <>
Co-authored-by: joseluisq <1700322+joseluisq@users.noreply.github.com>
It removes `public` from `Cache-Control` value, leaving max-age=<VALUE>, which can prevent CDN and Basic Authentication issues. See details on #560.
This applies to the "Cache-Control Headers" feature, with no user-breaking changes expected.
- `sws.toml` used if present
- But `config.toml` has priority if it exists
- A warning message is printed if `config.toml` is used, as it will be removed in a future release previous advice.
- BREAKING: End support for unmaintained Windows 7, 8, 8.1 platforms as previously announced on v2.36.1.
- SECURITY (RUSTSEC-2024-0437): Crash due to uncontrolled recursion in protobuf crate was temporarily solved in the previous release. However, this PR applies the dependency patches recently available.
- RESTORED: `experimental` Cargo feature for metrics and in-memory cache.
This PR adds support for controlling ANSI escape codes for colors and other text formatting when logging via a new boolean --log-with-ansi CLI option and its equivalent SERVER_LOG_WITH_ANSI env.
No ANSI by default:
Note that from now on, SWS will be no-ansi by default. If you want colored log output, then use --log-with-ansi.
For example:
```
static-web-server -p 8788 -d ./public/ -g trace -z --log-with-ansi
```
It fixes an issue (previously an ad-hoc and inconsistent behavior) where SWS printed INFO-level messages at startup despite setting up a higher log level. E.g., `WARN` or `ERROR`.
Notice:
For consistency reasons, SWS now won't persistently show server information at startup independently of the log level as it did before. Instead, those info log entries are non-persistent and under the normal `INFO` log level.
For example, to show those logs again then use the `INFO` log level.
$ static-web-server -p 8787 -d public/ -g info
It just automates the post-release updates needed after every release, like documentation and installer script updates, as well as checksum generation.
This change removes the "experimental" Cargo feature from the
resulting static-web-server **binary** temporarily (not the Cargo
feature itself) to prevent shipping the RUSTSEC-2024-0437 security
vulnerability along with SWS binary.
The "experimental" Cargo feature will be restored once the upstream
patch is available.
Old Windows 7, 8, 8.1 patch:
Additionally, it pins zerofrom, zerofrom-derive and litemap
dependencies **temporarily** to be able to build SWS for old Windows
7, 8, 8.1 because newer versions of them require rustc 1.81 or later.