1075 Commits

Author SHA1 Message Date
Jose Quintana
9fb21113fd docs: windows firewall rule instructions for windows service feature
[skip ci]
2024-03-05 23:50:54 +01:00
Jose Quintana
769daf1a74 chore: update dependencies 05.03.2024 2024-03-05 21:09:14 +01:00
Jose Quintana
e031a7d79a chore: debian 12.5 docker image update 2024-02-28 21:46:47 +01:00
Jose Quintana
a68349ce14 refactor: add targets to crate docs 2024-02-28 21:17:11 +01:00
Jose Quintana
afd6a87389 feat: cancellation ability for server::Server::run_server_on_rt and server::Server::run_standalone functions (#319)
It enhances the `server::Server::run_server_on_rt` and `server::Server::run_standalone` functions to support cancellation to shut down the server gracefully on demand as a complement to the termination signals handling in Linux/Unix systems.

The `Server::run_standalone` function now accepts an optional
`cancel` parameter to shut down the server gracefully on demand as
a complement to the termination signals handling in Linux/Unix systems.

Functions updated:

```rs
/// NOTE:
/// Now it will also handle server cancellation via the `cancel_recv` param in Linux/Unix systems
/// similar to what Windows does.
pub fn run_server_on_rt<F>(self, cancel_recv: Option<Receiver<()>>, cancel_fn: F) -> Result

/// NOTE:
/// Now it also accepts a `cancel` param to shut down the server in Linux/Unix systems
/// similar to what Windows does.
pub fn run_standalone(self, cancel: Option<Receiver<()>>) -> Result
```
2024-02-28 18:53:00 +01:00
Yonas Yanfa
b6444f471f fix: error: the item TryFrom is imported redundantly #317 (#318)
This should fix #317 for Rust nightly.
2024-02-26 18:35:12 +01:00
Jose Quintana
2286e452a0 docs: v2.27.0 [skip ci] 2024-02-13 00:20:15 +01:00
Jose Quintana
cb573a5f9e v2.27.0 v2.27.0 2024-02-13 00:03:25 +01:00
Jose Quintana
ec93d6c32a chore: update dependencies 12.02.2024 2024-02-12 23:38:20 +01:00
Jose Quintana
1a6caa476a feat: add all and experimental Cargo feature flags (#313)
* feat: `all` and `experimental` cargo feature flags
  - the `all` will host all available features (`default`) plus the
    `experimental`.
  - the `experimental` will only hold unstable features like for example
    `metrics` (as of writing)
* chore: enable the `all` cargo feature for freebsd

this feature also fixes #312
2024-02-12 23:19:15 +01:00
Jose Quintana
a3e5050ab6 docs: v2.26.0 [skip ci] 2024-02-11 00:01:08 +01:00
Jose Quintana
6781ec3bc0 v2.26.0 v2.26.0 2024-02-10 23:43:25 +01:00
Jose Quintana
fd15914f47 docs: SWS Discord link [skip ci] 2024-02-10 23:33:51 +01:00
Jose Quintana
5623799c54 chore: alpine 3.18.6 2024-02-10 22:07:30 +01:00
Jose Quintana
563367c5af chore: minimum rust version 1.74.0 2024-02-10 21:49:17 +01:00
Jose Quintana
1d4f423ee5 chore: update dependencies 10.02.2024 2024-02-10 21:43:18 +01:00
Jose Quintana
370d2888b6 chore: base fuzz and micro-benchmark testing for static files module (#310)
it just introduces fuzzing and micro-benchmark tests for the static files module. As a way to continue enhancing the performance and security of SWS in general. It is expected to be improved over time including other modules as well.
2024-02-09 06:53:38 +01:00
Jose Quintana
80af0aa34f chore: update dependencies 07.02.2024 2024-02-07 21:52:11 +01:00
Jose Quintana
a7dc6ace80 refactor: drop linux ppc64le/s390x from alpine and scratch docker (#309)
The SWS binaries for ppc64le (powerpc64le-unknown-linux-gnu) and
s590x (s390x-unknown-linux-gnu) are dynamically linked so
it does **not** make so much sense to deliver them with either the
Alpine (musl) or the Scratch images (they even do not work properly as
of writing).

So we remove those two from the SWS Alpine and Scratch Docker image
variants to avoid misunderstandings or future issues.

The Debian Docker image should be preferred instead, either linux/ppc64le
or linux/s390x respectively.

This resolves #308
2024-02-06 22:56:11 +01:00
Jose Quintana
d4427eb3e1 feat: experimental Tokio Runtime metrics for Prometheus (#307)
* feat: Prometheus metrics endpoint at /metrics

Signed-off-by: Tom Plant <tom@tplant.com.au>

* fix: add `experimental` prefix to metrics arg, env var, and logs
Signed-off-by: Tom Plant <tom@tplant.com.au>

* fix: disable tokio-metrics-collector on Windows
Signed-off-by: Tom Plant <tom@tplant.com.au>

* chore: address feedback

* refactor: rename feature to `experimental-metrics` and add test

* fix: freebsd ci tests

* refactor: move dependencies to the unix target section

---------

Signed-off-by: Tom Plant <tom@tplant.com.au>
Co-authored-by: Jose Quintana <joseluisquintana20@gmail.com>
2024-02-04 13:44:38 +01:00
Jose Quintana
71dd54f998 feat: support for Range requests out of bounds (#306)
* feat: support for `Range` requests out of bounds

SWS will make sure to return only what's available in that case which
seems to be a very common behavior across web servers.

Previously exceeding the length of a file returning `416 Requested
Range Not Satisfiable`. Now it will return what's available.

```sh
$ curl -IH "Range: bytes=50-9000" http://localhost/index.html
\# HTTP/1.1 206 Partial Content
\# Server: nginx/1.25.3
\# Date: Sun, 28 Jan 2024 22:09:20 GMT
\# Content-Type: text/html
\# Content-Length: 486
\# Last-Modified: Mon, 02 Oct 2023 04:49:01 GMT
\# Connection: keep-alive
\# ETag: "651a4bbd-218"
\# Content-Range: bytes 50-535/536
```

it resolves #295 and relates to https://github.com/orgs/static-web-server/discussions/145
2024-01-29 00:36:32 +01:00
Jose Quintana
289356b8db docs: v2.25.0 [skip ci] 2024-01-23 01:06:39 +01:00
Jose Quintana
b470d84b1e v2.25.0 v2.25.0 2024-01-23 00:48:22 +01:00
Jose Quintana
32e86aa0f4 chore: update dependencies 23.01.2024 2024-01-23 00:03:53 +01:00
Jose Quintana
ef9876ad17 refactor: prefer cross precompiled binary on ci release workflow 2024-01-23 00:02:53 +01:00
Jose Quintana
42f52e899c fix: wrong glob brace expansion capture in url rewrites & redirects (#304)
* fix: wrong glob brace expansion capture in url redirects/rewrites

now an url redirect (or rewrite) `source` that uses glob groups with
brace expansions like `**/{*}.{jpg,jpeg}` will works as expected:

```toml
[advanced]

[[advanced.redirects]]
source = "**/{*}.{jpg,jpeg}"
destination = "http://localhost/new-images/$2.$3"
kind = 302
```

* chore: url rewrites/redirects test cases
2024-01-22 00:34:02 +01:00
Jose Quintana
9f2a4f0ba6 chore: alpine 3.18.5 update 2024-01-21 00:04:34 +01:00
Jose Quintana
3076d089c0 docs: optional host uri support for url redirects feature (#301) 2024-01-20 23:54:06 +01:00
Jose Quintana
dedefc5eeb docs: fix a few page typos 2024-01-20 23:35:07 +01:00
Jose Quintana
83e4277ff0 refactor: migrate to tokio-rustls 0.25 (#303)
- rustls 0.22
- rustls-pemfile 2.0
- bytes 1.5
2024-01-20 00:15:15 +01:00
Jose Quintana
477ed00e0a chore: update dependencies 19.01.2024 2024-01-19 22:11:34 +01:00
Jose Quintana
8c6ab533fd feat: optional Host URI support for the URL Redirects feature (#301)
* feat: optional `host` uri support for URL redirects

which allows redirecting based on a host's incoming uri making it
possible to perform for example www to non-www redirects.

config example:

```toml
[advanced]

[[advanced.redirects]]
host = "127.0.0.1:4433"
source = "/{*}"
destination = "https://localhost:4433/$1"
kind = 301
```

* chore: add test cases
2024-01-16 00:43:14 +01:00
Jose Quintana
67a2403253 refactor: prefer cross precompiled binary on ci devel workflow 2024-01-08 03:10:11 +01:00
Jose Quintana
1bbc70393c refactor: cache rust toolchain & cargo dirs for ci devel workflow (#300) 2024-01-08 02:14:39 +01:00
Jose Quintana
8815762f56 docs: v2.24.2 [skip ci] 2023-12-28 18:39:51 +01:00
Jose Quintana
f99e8669b0 v2.24.2 v2.24.2 2023-12-28 18:27:13 +01:00
Jose Quintana
16f4afdea0 chore: update dependencies 28.12.2023 2023-12-28 18:04:46 +01:00
Jose Quintana
af203ca432 chore: alpine 3.17.6 docker images 2023-12-20 12:50:02 +01:00
Jose Quintana
76dc853edf chore: update dependencies 20.12.2023 2023-12-20 12:43:44 +01:00
Jose Quintana
8cdb30510f chore: debian 12.4 docker images 2023-12-20 12:28:41 +01:00
Jose Quintana
96ec477e7b refactor: types import consistency 2023-12-05 03:26:22 +01:00
Jose Quintana
12dfb56d59 chore: update dependencies 05.12.2023 2023-12-05 03:03:06 +01:00
Jose Quintana
a9d509ed45 refactor: github issue & pr template improvements [skip ci] 2023-12-01 23:48:13 +01:00
Jose Quintana
ab67bd7a64 refactor: github issue & pull request template improvement [skip ci] (#294) 2023-12-01 23:19:26 +01:00
Jose Quintana
55545221de chore: update dependencies 24.11.2023 2023-11-24 00:58:40 +01:00
Jose Quintana
233d080d56 docs: v2.24.1 [skip ci] 2023-11-15 00:19:57 +01:00
Jose Quintana
98a5cc40d2 v2.24.1 v2.24.1 2023-11-15 00:01:14 +01:00
Jose Quintana
680323c98f chore: manual release build ci workflow (#288) 2023-11-14 23:43:40 +01:00
Jose Quintana
c0c88f1323 chore: update dependencies 14.11.2023 2023-11-14 23:24:46 +01:00
Jose Quintana
a987e37548 docs: fix typo in home page [skip ci]
related to #287
2023-11-14 23:22:40 +01:00