mirror of
https://github.com/samsonjs/agate.git
synced 2026-03-25 09:05:50 +00:00
Compare commits
69 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
92093a84ab | ||
|
|
26482e38c0 | ||
|
|
22b6dd50af | ||
|
|
11c569b4ec | ||
|
|
067e220145 | ||
|
|
7a5ef98ea8 | ||
|
|
b142891abe | ||
|
|
e758138c58 | ||
|
|
1807524209 | ||
|
|
9daefcd3c4 | ||
|
|
dee79f819c | ||
|
|
c385a11999 | ||
|
|
ef39d78f08 | ||
|
|
b0d30df91a | ||
|
|
d8481a2b0f | ||
|
|
5cdfb3dc4b | ||
|
|
90dcaff231 | ||
|
|
1091812e13 | ||
|
|
8a6de275ca | ||
|
|
1e84541bbb | ||
|
|
47410867a5 | ||
|
|
3bc7471f7b | ||
|
|
d9776361af | ||
|
|
ac59c0e268 | ||
|
|
2114ff8736 | ||
|
|
e781609383 | ||
|
|
37ac74f21d | ||
|
|
73eb53de4c | ||
|
|
5c84a90093 | ||
|
|
cb6b815b82 | ||
|
|
dfc4c4fd7b | ||
|
|
96b5431fa0 | ||
|
|
1893b3ad7a | ||
|
|
4173a12702 | ||
|
|
815bd517cc | ||
|
|
13ad2f363e | ||
|
|
cdc72e4f2d | ||
|
|
8cc245996b | ||
|
|
16cb171b06 | ||
|
|
354bfcceab | ||
|
|
bf5240d1ec | ||
|
|
4da99828c1 | ||
|
|
6d5ae9893f | ||
|
|
6c9e783b84 | ||
|
|
5561277985 | ||
|
|
6cc3128c64 | ||
|
|
738ab0adec | ||
|
|
dbc05d79c1 | ||
|
|
a2239e0a9c | ||
|
|
950e8fa69b | ||
|
|
ead0d840cb | ||
|
|
e8991931f3 | ||
|
|
f74882b3fd | ||
|
|
2ee76e7a03 | ||
|
|
6b5de4fbff | ||
|
|
ac0f3a57a3 | ||
|
|
4a8f3fe32d | ||
|
|
0be4b7c508 | ||
|
|
89eed22e39 | ||
|
|
4d660eef34 | ||
|
|
d1710c924f | ||
|
|
26a32b25cc | ||
|
|
7d2f552757 | ||
|
|
0b189d0366 | ||
|
|
c6a94d73d9 | ||
|
|
78f0cbac27 | ||
|
|
bbcff3f875 | ||
|
|
5f28a8f238 | ||
|
|
7c9bc9e424 |
9 changed files with 648 additions and 415 deletions
2
.github/workflows/cargo-audit.yml
vendored
2
.github/workflows/cargo-audit.yml
vendored
|
|
@ -10,7 +10,7 @@ jobs:
|
||||||
cargo-audit:
|
cargo-audit:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- uses: actions-rs/audit-check@v1
|
- uses: actions-rs/audit-check@v1
|
||||||
# Don't run on dependabot PRs or forks
|
# Don't run on dependabot PRs or forks
|
||||||
# https://github.com/actions-rs/clippy-check/issues/2#issuecomment-807852653
|
# https://github.com/actions-rs/clippy-check/issues/2#issuecomment-807852653
|
||||||
|
|
|
||||||
10
.github/workflows/release.yml
vendored
10
.github/workflows/release.yml
vendored
|
|
@ -15,10 +15,10 @@ jobs:
|
||||||
uses: ncipollo/release-action@v1
|
uses: ncipollo/release-action@v1
|
||||||
|
|
||||||
build_ubuntu:
|
build_ubuntu:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-22.04
|
||||||
needs: create_release
|
needs: create_release
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- name: build
|
- name: build
|
||||||
run: bash .github/workflows/release.sh
|
run: bash .github/workflows/release.sh
|
||||||
- name: upload release assets linux
|
- name: upload release assets linux
|
||||||
|
|
@ -32,7 +32,7 @@ jobs:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
needs: create_release
|
needs: create_release
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cargo build --verbose --release
|
run: cargo build --verbose --release
|
||||||
- name: strip names
|
- name: strip names
|
||||||
|
|
@ -50,7 +50,7 @@ jobs:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
needs: create_release
|
needs: create_release
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- name: install toolchain
|
- name: install toolchain
|
||||||
run: rustup target add aarch64-apple-darwin
|
run: rustup target add aarch64-apple-darwin
|
||||||
- name: Build x86_64
|
- name: Build x86_64
|
||||||
|
|
@ -79,7 +79,7 @@ jobs:
|
||||||
packages: write
|
packages: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Log into GHCR
|
- name: Log into GHCR
|
||||||
|
|
|
||||||
6
.github/workflows/test.yml
vendored
6
.github/workflows/test.yml
vendored
|
|
@ -12,7 +12,7 @@ jobs:
|
||||||
clippy:
|
clippy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- name: Run clippy action to produce annotations
|
- name: Run clippy action to produce annotations
|
||||||
# Don't run on dependabot PRs
|
# Don't run on dependabot PRs
|
||||||
# https://github.com/actions-rs/clippy-check/issues/2#issuecomment-807852653
|
# https://github.com/actions-rs/clippy-check/issues/2#issuecomment-807852653
|
||||||
|
|
@ -30,7 +30,7 @@ jobs:
|
||||||
formatting:
|
formatting:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- name: Formatting
|
- name: Formatting
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
|
|
@ -39,7 +39,7 @@ jobs:
|
||||||
tests:
|
tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- uses: actions-rs/cargo@v1
|
- uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
command: test
|
command: test
|
||||||
|
|
|
||||||
93
CHANGELOG.md
93
CHANGELOG.md
|
|
@ -5,18 +5,66 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
Updates to dependencies are not considered notable changes for the purpose of this changelog.
|
||||||
|
This may lead to no listed changes for a version.
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [3.3.19] - 2025-09-18
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* Update dependencies.
|
||||||
|
* Document commands for converting PEM to DER.
|
||||||
|
|
||||||
|
## [3.3.18] - 2025-08-05
|
||||||
|
## [3.3.17] - 2025-06-27
|
||||||
|
## [3.3.16] - 2025-05-06
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
* Build release artifacts with Ubuntu 22.04, because Ubuntu 20.04 is no longer supported
|
||||||
|
* pre-built binaries may no longer run on Linux distributions older than Ubuntu 22.04 (glibc 2.35)
|
||||||
|
* users with older glibc versions will need to build from source
|
||||||
|
|
||||||
|
## [3.3.15] - 2025-05-06
|
||||||
|
## [3.3.14] - 2025-03-24
|
||||||
|
## [3.3.13] - 2025-02-24
|
||||||
|
Thank you to @luineth for contributing to this release.
|
||||||
|
|
||||||
|
### Added
|
||||||
|
* aarch64 support for Docker image (#376)
|
||||||
|
|
||||||
|
## [3.3.12] - 2025-02-18
|
||||||
|
## [3.3.11] - 2024-11-29
|
||||||
|
Thank you to @geraldwuhoo and @jphastings for contributing to this release.
|
||||||
|
|
||||||
|
### Added
|
||||||
|
* Automatically publish docker images to GHCR (#366)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* Refactor Dockerfile for multi-stage build (#144)
|
||||||
|
|
||||||
|
## [3.3.10] - 2024-11-04
|
||||||
|
## [3.3.9] - 2024-09-10
|
||||||
|
## [3.3.8] - 2024-07-24
|
||||||
|
## [3.3.7] - 2024-04-01
|
||||||
|
## [3.3.6] - 2024-03-22
|
||||||
|
## [3.3.5] - 2024-03-15
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* updated and simplified dependencies
|
||||||
|
* fix syntax of license field in Cargo manifest
|
||||||
|
|
||||||
|
## [3.3.4] - 2024-01-16
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* cleaned up documentation
|
||||||
|
|
||||||
## [3.3.3] - 2023-12-27
|
## [3.3.3] - 2023-12-27
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
* fixed release automation
|
* fixed release automation
|
||||||
|
|
||||||
## [3.3.2] - 2023-12-27
|
## [3.3.2] - 2023-12-27
|
||||||
|
|
||||||
### Fixed
|
|
||||||
* updated dependencies
|
|
||||||
|
|
||||||
## [3.3.1] - 2023-08-05
|
## [3.3.1] - 2023-08-05
|
||||||
Thank you to Jan Stępień and @michaelnordmeyer for contributing to this release.
|
Thank you to Jan Stępień and @michaelnordmeyer for contributing to this release.
|
||||||
|
|
||||||
|
|
@ -31,7 +79,6 @@ Thank you to @equalsraf, @michaelnordmeyer and @wanderer1988 for contributing to
|
||||||
* listening on unix sockets (#244)
|
* listening on unix sockets (#244)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
* updated dependencies
|
|
||||||
* misstyped email address in section on how to report security vulnerabilities (#239)
|
* misstyped email address in section on how to report security vulnerabilities (#239)
|
||||||
* wrong language code in README (#189)
|
* wrong language code in README (#189)
|
||||||
|
|
||||||
|
|
@ -41,14 +88,12 @@ Thank you to @06kellyjac, @albertlarsan68 and @kahays for contributing to this r
|
||||||
### Fixed
|
### Fixed
|
||||||
* removed port collisions in tests, for the last time (#143)
|
* removed port collisions in tests, for the last time (#143)
|
||||||
* fixed Dockerfile startup command (#169)
|
* fixed Dockerfile startup command (#169)
|
||||||
* upated dependencies
|
|
||||||
|
|
||||||
## [3.2.3] - 2022-02-04
|
## [3.2.3] - 2022-02-04
|
||||||
Thank you to T. Spivey for contributing to this release.
|
Thank you to T. Spivey for contributing to this release.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
* improper IRIs are handled instead of crashing (bug reported via email)
|
* improper IRIs are handled instead of crashing (bug reported via email)
|
||||||
* updated dependencies
|
|
||||||
|
|
||||||
## [3.2.2] - 2022-01-25
|
## [3.2.2] - 2022-01-25
|
||||||
Thank you to @Suzie97 for contributing to this release.
|
Thank you to @Suzie97 for contributing to this release.
|
||||||
|
|
@ -56,16 +101,12 @@ Thank you to @Suzie97 for contributing to this release.
|
||||||
### Added
|
### Added
|
||||||
* CI build for `aarch64-apple-darwin` target (#137)
|
* CI build for `aarch64-apple-darwin` target (#137)
|
||||||
|
|
||||||
### Fixed
|
|
||||||
* updated dependencies
|
|
||||||
|
|
||||||
## [3.2.1] - 2021-12-02
|
## [3.2.1] - 2021-12-02
|
||||||
Thank you to @MatthiasPortzel for contributing to this release.
|
Thank you to @MatthiasPortzel for contributing to this release.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
* host name comparisons are now case insensitive (#115)
|
* host name comparisons are now case insensitive (#115)
|
||||||
* made automatic certificate configuration more prominent in the README
|
* made automatic certificate configuration more prominent in the README
|
||||||
* updated dependencies
|
|
||||||
|
|
||||||
## [3.2.0] - 2021-11-15
|
## [3.2.0] - 2021-11-15
|
||||||
Thank you to @balazsbtond and @joseph-marques for contributing to this release.
|
Thank you to @balazsbtond and @joseph-marques for contributing to this release.
|
||||||
|
|
@ -74,7 +115,6 @@ Thank you to @balazsbtond and @joseph-marques for contributing to this release.
|
||||||
* you can add header text to a directory listing. See the updated readme for details. (#98)
|
* you can add header text to a directory listing. See the updated readme for details. (#98)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
* updated dependencies
|
|
||||||
* error pages also send close_notify (#100)
|
* error pages also send close_notify (#100)
|
||||||
|
|
||||||
## [3.1.3] - 2021-10-25
|
## [3.1.3] - 2021-10-25
|
||||||
|
|
@ -103,7 +143,6 @@ Thank you to @jgarte and @alvaro-cuesta for contributing to this release.
|
||||||
### Fixed
|
### Fixed
|
||||||
* actually bind to multiple IP addresses. Despite the documentation saying so,
|
* actually bind to multiple IP addresses. Despite the documentation saying so,
|
||||||
Agate would only bind to the first address that did not result in an error. (#63)
|
Agate would only bind to the first address that did not result in an error. (#63)
|
||||||
* updated dependencies
|
|
||||||
|
|
||||||
## [3.1.0] - 2021-06-08
|
## [3.1.0] - 2021-06-08
|
||||||
Thank you to Matthew Ingwersen and Oliver Simmons (@GoodClover) for contributing to this release.
|
Thank you to Matthew Ingwersen and Oliver Simmons (@GoodClover) for contributing to this release.
|
||||||
|
|
@ -133,7 +172,6 @@ Thank you to @06kellyjac, @cpnfeeny, @lifelike, @skittlesvampir and @steko for c
|
||||||
The previous handling could be exploited as a DoS attack vector. (#59)
|
The previous handling could be exploited as a DoS attack vector. (#59)
|
||||||
* Two tests were running on the same port, causing them to fail nondeterministically. (#51)
|
* Two tests were running on the same port, causing them to fail nondeterministically. (#51)
|
||||||
* Rephrased the changelog for 3.0.0 on continuing to use older certificates. (#55)
|
* Rephrased the changelog for 3.0.0 on continuing to use older certificates. (#55)
|
||||||
* Updated dependencies.
|
|
||||||
|
|
||||||
## [3.0.2] - 2021-04-08
|
## [3.0.2] - 2021-04-08
|
||||||
Thank you to @kvibber, @lifelike and @pasdechance for contributing to this release.
|
Thank you to @kvibber, @lifelike and @pasdechance for contributing to this release.
|
||||||
|
|
@ -196,7 +234,6 @@ Thank you to @littleli and @06kellyjac for contributing to this release.
|
||||||
* The GitHub workflow has been fixed so Windows binaries are compressed correctly (#36).
|
* The GitHub workflow has been fixed so Windows binaries are compressed correctly (#36).
|
||||||
* Split out install steps to allow for more options in the future.
|
* Split out install steps to allow for more options in the future.
|
||||||
* Add install notes for nix/NixOS to the README (#38).
|
* Add install notes for nix/NixOS to the README (#38).
|
||||||
* Updated dependencies.
|
|
||||||
|
|
||||||
## [2.5.2] - 2021-02-12
|
## [2.5.2] - 2021-02-12
|
||||||
|
|
||||||
|
|
@ -293,9 +330,6 @@ Thank you to @Johann150 and @KilianKemps for contributing to this release.
|
||||||
### Added
|
### Added
|
||||||
* Optional directory listings (#8, #9).
|
* Optional directory listings (#8, #9).
|
||||||
|
|
||||||
### Fixed
|
|
||||||
* Updated dependencies.
|
|
||||||
|
|
||||||
## [2.0.0] - 2020-12-23
|
## [2.0.0] - 2020-12-23
|
||||||
Thank you to @bortzmeyer, @KillianKemps, and @Ylhp for contributing to this release.
|
Thank you to @bortzmeyer, @KillianKemps, and @Ylhp for contributing to this release.
|
||||||
|
|
||||||
|
|
@ -326,7 +360,6 @@ Thank you @Johann150, @jonhiggs and @tronje for contributing to this release!
|
||||||
* verify hostname and port in request URL (#4).
|
* verify hostname and port in request URL (#4).
|
||||||
* improved logging (#2, #3).
|
* improved logging (#2, #3).
|
||||||
* Don't redirect to "/" when the path is empty (#5).
|
* Don't redirect to "/" when the path is empty (#5).
|
||||||
* Update dependencies.
|
|
||||||
|
|
||||||
## [1.2.2] - 2020-09-21
|
## [1.2.2] - 2020-09-21
|
||||||
Thank you to @m040601 for contributing to this release.
|
Thank you to @m040601 for contributing to this release.
|
||||||
|
|
@ -336,13 +369,11 @@ Thank you to @m040601 for contributing to this release.
|
||||||
* Built both x86_64 and ARM binaries. These binaries are built for Linux operating systems with glibc 2.28 or later, such as Debian 10 ("buster") or newer, Ubuntu 18.10 or newer, and Raspberry Pi OS 2019-06-20 or newer (#1).
|
* Built both x86_64 and ARM binaries. These binaries are built for Linux operating systems with glibc 2.28 or later, such as Debian 10 ("buster") or newer, Ubuntu 18.10 or newer, and Raspberry Pi OS 2019-06-20 or newer (#1).
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
* Update dependencies.
|
|
||||||
* Minor internal code cleanup.
|
* Minor internal code cleanup.
|
||||||
|
|
||||||
## [1.2.1] - 2020-06-20
|
## [1.2.1] - 2020-06-20
|
||||||
### Fixed
|
### Fixed
|
||||||
* Reduce memory usage when serving large files.
|
* Reduce memory usage when serving large files.
|
||||||
* Update dependencies.
|
|
||||||
|
|
||||||
## [1.2.0] - 2020-06-10
|
## [1.2.0] - 2020-06-10
|
||||||
### Changed
|
### Changed
|
||||||
|
|
@ -351,7 +382,6 @@ Thank you to @m040601 for contributing to this release.
|
||||||
### Fixed
|
### Fixed
|
||||||
* Handling for requests that exceed 1KB.
|
* Handling for requests that exceed 1KB.
|
||||||
* Reduce memory allocations and speed up request parsing.
|
* Reduce memory allocations and speed up request parsing.
|
||||||
* Update dependencies.
|
|
||||||
|
|
||||||
## [1.1.0] - 2020-05-22
|
## [1.1.0] - 2020-05-22
|
||||||
### Added
|
### Added
|
||||||
|
|
@ -364,7 +394,24 @@ Thank you to @m040601 for contributing to this release.
|
||||||
|
|
||||||
## [1.0.0] - 2020-05-21
|
## [1.0.0] - 2020-05-21
|
||||||
|
|
||||||
[Unreleased]: https://github.com/mbrubeck/agate/compare/v3.3.1...HEAD
|
[Unreleased]: https://github.com/mbrubeck/agate/compare/v3.3.18...HEAD
|
||||||
|
[3.3.18]: https://github.com/mbrubeck/agate/compare/v3.3.17...v3.3.18
|
||||||
|
[3.3.17]: https://github.com/mbrubeck/agate/compare/v3.3.16...v3.3.17
|
||||||
|
[3.3.16]: https://github.com/mbrubeck/agate/compare/v3.3.15...v3.3.16
|
||||||
|
[3.3.15]: https://github.com/mbrubeck/agate/compare/v3.3.14...v3.3.15
|
||||||
|
[3.3.14]: https://github.com/mbrubeck/agate/compare/v3.3.13...v3.3.14
|
||||||
|
[3.3.13]: https://github.com/mbrubeck/agate/compare/v3.3.12...v3.3.13
|
||||||
|
[3.3.12]: https://github.com/mbrubeck/agate/compare/v3.3.11...v3.3.12
|
||||||
|
[3.3.11]: https://github.com/mbrubeck/agate/compare/v3.3.10...v3.3.11
|
||||||
|
[3.3.10]: https://github.com/mbrubeck/agate/compare/v3.3.9...v3.3.10
|
||||||
|
[3.3.9]: https://github.com/mbrubeck/agate/compare/v3.3.8...v3.3.9
|
||||||
|
[3.3.8]: https://github.com/mbrubeck/agate/compare/v3.3.7...v3.3.8
|
||||||
|
[3.3.7]: https://github.com/mbrubeck/agate/compare/v3.3.6...v3.3.7
|
||||||
|
[3.3.6]: https://github.com/mbrubeck/agate/compare/v3.3.5...v3.3.6
|
||||||
|
[3.3.5]: https://github.com/mbrubeck/agate/compare/v3.3.4...v3.3.5
|
||||||
|
[3.3.4]: https://github.com/mbrubeck/agate/compare/v3.3.3...v3.3.4
|
||||||
|
[3.3.3]: https://github.com/mbrubeck/agate/compare/v3.3.2...v3.3.3
|
||||||
|
[3.3.2]: https://github.com/mbrubeck/agate/compare/v3.3.1...v3.3.2
|
||||||
[3.3.1]: https://github.com/mbrubeck/agate/compare/v3.3.0...v3.3.1
|
[3.3.1]: https://github.com/mbrubeck/agate/compare/v3.3.0...v3.3.1
|
||||||
[3.3.0]: https://github.com/mbrubeck/agate/compare/v3.2.4...v3.3.0
|
[3.3.0]: https://github.com/mbrubeck/agate/compare/v3.2.4...v3.3.0
|
||||||
[3.2.4]: https://github.com/mbrubeck/agate/compare/v3.2.3...v3.2.4
|
[3.2.4]: https://github.com/mbrubeck/agate/compare/v3.2.3...v3.2.4
|
||||||
|
|
|
||||||
761
Cargo.lock
generated
761
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
12
Cargo.toml
12
Cargo.toml
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "agate"
|
name = "agate"
|
||||||
version = "3.3.14"
|
version = "3.3.20"
|
||||||
authors = ["Matt Brubeck <mbrubeck@limpet.net>", "Johann150 <johann+agate@qwertqwefsday.eu>"]
|
authors = ["Matt Brubeck <mbrubeck@limpet.net>", "Johann150 <johann+agate@qwertqwefsday.eu>"]
|
||||||
description = "Very simple server for the Gemini hypertext protocol"
|
description = "Very simple server for the Gemini hypertext protocol"
|
||||||
keywords = ["server", "gemini", "hypertext", "internet", "protocol"]
|
keywords = ["server", "gemini", "hypertext", "internet", "protocol"]
|
||||||
|
|
@ -15,15 +15,15 @@ exclude = ["/tools", "/.github", "/Cross.toml", "/content", "/CODE_OF_CONDUCT.md
|
||||||
configparser = "3.0"
|
configparser = "3.0"
|
||||||
env_logger = { version = "0.11", default-features = false, features = ["auto-color", "humantime"] }
|
env_logger = { version = "0.11", default-features = false, features = ["auto-color", "humantime"] }
|
||||||
futures-util = "0.3"
|
futures-util = "0.3"
|
||||||
getopts = "0.2.21"
|
getopts = { version = "0.2.24", default-features = false }
|
||||||
glob = "0.3"
|
glob = "0.3"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
mime_guess = "2.0"
|
mime_guess = "2.0"
|
||||||
percent-encoding = "2.3"
|
percent-encoding = "2.3"
|
||||||
rcgen = { version = "0.13.2", default-features = false, features = ["ring"] }
|
rcgen = { version = "0.14.7", default-features = false, features = ["ring"] }
|
||||||
tokio-rustls = { version = "0.26.2", default-features = false, features = ["logging", "ring", "tls12"] }
|
tokio-rustls = { version = "0.26.4", default-features = false, features = ["logging", "ring", "tls12"] }
|
||||||
tokio = { version = "1.44", features = ["fs", "io-util", "net", "rt-multi-thread", "sync"] }
|
tokio = { version = "1.49", features = ["fs", "io-util", "net", "rt-multi-thread", "sync"] }
|
||||||
url = "2.5.4"
|
url = "2.5.8"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
trotter = "1.0"
|
trotter = "1.0"
|
||||||
|
|
|
||||||
|
|
@ -195,6 +195,13 @@ Using a directory named just `.` causes undefined behaviour as this would have t
|
||||||
|
|
||||||
The files for a certificate/key pair have to be named `cert.der` and `key.der` respectively. The certificate has to be a X.509 certificate in a DER format file and has to include a subject alt name of the domain name. The private key has to be in DER format and must be either an RSA, ECDSA or Ed25519 key.
|
The files for a certificate/key pair have to be named `cert.der` and `key.der` respectively. The certificate has to be a X.509 certificate in a DER format file and has to include a subject alt name of the domain name. The private key has to be in DER format and must be either an RSA, ECDSA or Ed25519 key.
|
||||||
|
|
||||||
|
If you have an existing certificate/key pair in PEM format, you can use these commands to convert them to the DER format:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
openssl x509 -inform pem -in cert.pem -outform der -out cert.der
|
||||||
|
openssl rsa -inform pem -in privkey.pem -outform der -out key.der
|
||||||
|
```
|
||||||
|
|
||||||
## Logging
|
## Logging
|
||||||
|
|
||||||
All requests via TCP sockets will be logged using this format:
|
All requests via TCP sockets will be logged using this format:
|
||||||
|
|
|
||||||
155
src/main.rs
155
src/main.rs
|
|
@ -73,7 +73,7 @@ fn main() {
|
||||||
panic!("Failed to listen on {addr}: {e}")
|
panic!("Failed to listen on {addr}: {e}")
|
||||||
} else {
|
} else {
|
||||||
// already listening on the other unspecified address
|
// already listening on the other unspecified address
|
||||||
log::warn!("Could not start listener on {}, but already listening on another unspecified address. Probably your system automatically listens in dual stack?", addr);
|
log::warn!("Could not start listener on {addr}, but already listening on another unspecified address. Probably your system automatically listens in dual stack?");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -82,7 +82,7 @@ fn main() {
|
||||||
listening_unspecified |= addr.ip().is_unspecified();
|
listening_unspecified |= addr.ip().is_unspecified();
|
||||||
|
|
||||||
handles.push(tokio::spawn(async move {
|
handles.push(tokio::spawn(async move {
|
||||||
log::info!("Started listener on {}", addr);
|
log::info!("Started listener on {addr}");
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let (stream, _) = listener.accept().await.unwrap_or_else(|e| {
|
let (stream, _) = listener.accept().await.unwrap_or_else(|e| {
|
||||||
|
|
@ -92,11 +92,11 @@ fn main() {
|
||||||
tokio::spawn(async {
|
tokio::spawn(async {
|
||||||
match RequestHandle::new(stream, arc).await {
|
match RequestHandle::new(stream, arc).await {
|
||||||
Ok(handle) => match handle.handle().await {
|
Ok(handle) => match handle.handle().await {
|
||||||
Ok(info) => log::info!("{}", info),
|
Ok(info) => log::info!("{info}"),
|
||||||
Err(err) => log::warn!("{}", err),
|
Err(err) => log::warn!("{err}"),
|
||||||
},
|
},
|
||||||
Err(log_line) => {
|
Err(log_line) => {
|
||||||
log::warn!("{}", log_line);
|
log::warn!("{log_line}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -134,11 +134,11 @@ fn main() {
|
||||||
tokio::spawn(async {
|
tokio::spawn(async {
|
||||||
match RequestHandle::new_unix(stream, arc).await {
|
match RequestHandle::new_unix(stream, arc).await {
|
||||||
Ok(handle) => match handle.handle().await {
|
Ok(handle) => match handle.handle().await {
|
||||||
Ok(info) => log::info!("{}", info),
|
Ok(info) => log::info!("{info}"),
|
||||||
Err(err) => log::warn!("{}", err),
|
Err(err) => log::warn!("{err}"),
|
||||||
},
|
},
|
||||||
Err(log_line) => {
|
Err(log_line) => {
|
||||||
log::warn!("{}", log_line);
|
log::warn!("{log_line}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -273,10 +273,7 @@ fn args() -> Result<Args> {
|
||||||
// the directory does not exist
|
// the directory does not exist
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
// since certificate management should be automated, we are going to create the directory too
|
// since certificate management should be automated, we are going to create the directory too
|
||||||
log::info!(
|
log::info!("The certificate directory {certs_path:?} does not exist, creating it.");
|
||||||
"The certificate directory {:?} does not exist, creating it.",
|
|
||||||
certs_path
|
|
||||||
);
|
|
||||||
std::fs::create_dir(&certs_path).expect("could not create certificate directory");
|
std::fs::create_dir(&certs_path).expect("could not create certificate directory");
|
||||||
// we just created the directory, skip loading from it
|
// we just created the directory, skip loading from it
|
||||||
(None, PathBuf::from(certs_path))
|
(None, PathBuf::from(certs_path))
|
||||||
|
|
@ -293,55 +290,53 @@ fn args() -> Result<Args> {
|
||||||
let hostname = Host::parse(&s)?;
|
let hostname = Host::parse(&s)?;
|
||||||
|
|
||||||
// check if we have a certificate for that domain
|
// check if we have a certificate for that domain
|
||||||
if let Host::Domain(ref domain) = hostname {
|
if let Host::Domain(ref domain) = hostname
|
||||||
if !matches!(certs, Some(ref certs) if certs.has_domain(domain)) {
|
&& !matches!(certs, Some(ref certs) if certs.has_domain(domain))
|
||||||
log::info!("No certificate or key found for {:?}, generating them.", s);
|
{
|
||||||
|
log::info!("No certificate or key found for {s:?}, generating them.");
|
||||||
|
|
||||||
let mut cert_params = CertificateParams::new(vec![domain.clone()])?;
|
let mut cert_params = CertificateParams::new(vec![domain.clone()])?;
|
||||||
cert_params
|
cert_params
|
||||||
.distinguished_name
|
.distinguished_name
|
||||||
.push(DnType::CommonName, domain);
|
.push(DnType::CommonName, domain);
|
||||||
|
|
||||||
// <CertificateParams as Default>::default() already implements a
|
// <CertificateParams as Default>::default() already implements a
|
||||||
// date in the far future from the time of writing: 4096-01-01
|
// date in the far future from the time of writing: 4096-01-01
|
||||||
|
|
||||||
let key_pair = if matches.opt_present("e") {
|
let key_pair = if matches.opt_present("e") {
|
||||||
KeyPair::generate_for(&rcgen::PKCS_ED25519)
|
KeyPair::generate_for(&rcgen::PKCS_ED25519)
|
||||||
} else {
|
} else {
|
||||||
KeyPair::generate()
|
KeyPair::generate()
|
||||||
}?;
|
}?;
|
||||||
|
|
||||||
// generate the certificate with the configuration
|
// generate the certificate with the configuration
|
||||||
let cert = cert_params.self_signed(&key_pair)?;
|
let cert = cert_params.self_signed(&key_pair)?;
|
||||||
|
|
||||||
// make sure the certificate directory exists
|
// make sure the certificate directory exists
|
||||||
fs::create_dir(certs_path.join(domain))?;
|
let cert_dir = certs_path.join(domain);
|
||||||
// write certificate data to disk
|
fs::create_dir(&cert_dir)?;
|
||||||
let mut cert_file = File::create(certs_path.join(format!(
|
|
||||||
"{}/{}",
|
// write certificate data to disk
|
||||||
domain,
|
let mut cert_file = File::create(cert_dir.join(certificates::CERT_FILE_NAME))?;
|
||||||
certificates::CERT_FILE_NAME
|
cert_file.write_all(cert.der())?;
|
||||||
)))?;
|
|
||||||
cert_file.write_all(cert.der())?;
|
// write key data to disk
|
||||||
// write key data to disk
|
let key_file_path = cert_dir.join(certificates::KEY_FILE_NAME);
|
||||||
let key_file_path =
|
let mut key_file = File::create(&key_file_path)?;
|
||||||
certs_path.join(format!("{}/{}", domain, certificates::KEY_FILE_NAME));
|
#[cfg(unix)]
|
||||||
let mut key_file = File::create(&key_file_path)?;
|
{
|
||||||
#[cfg(unix)]
|
// set permissions so only owner can read
|
||||||
{
|
match key_file.set_permissions(std::fs::Permissions::from_mode(0o400)) {
|
||||||
// set permissions so only owner can read
|
Ok(_) => (),
|
||||||
match key_file.set_permissions(std::fs::Permissions::from_mode(0o400)) {
|
Err(_) => log::warn!(
|
||||||
Ok(_) => (),
|
"could not set permissions for new key file {}",
|
||||||
Err(_) => log::warn!(
|
key_file_path.display()
|
||||||
"could not set permissions for new key file {}",
|
),
|
||||||
key_file_path.display()
|
|
||||||
),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
key_file.write_all(key_pair.serialized_der())?;
|
|
||||||
|
|
||||||
reload_certs = true;
|
|
||||||
}
|
}
|
||||||
|
key_file.write_all(key_pair.serialized_der())?;
|
||||||
|
|
||||||
|
reload_certs = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
hostnames.push(hostname);
|
hostnames.push(hostname);
|
||||||
|
|
@ -496,7 +491,7 @@ impl RequestHandle<UnixStream> {
|
||||||
metadata,
|
metadata,
|
||||||
}),
|
}),
|
||||||
// use nonexistent status code 00 if connection was not established
|
// use nonexistent status code 00 if connection was not established
|
||||||
Err(e) => Err(format!("{} \"\" 00 \"TLS error\" error:{}", log_line, e)),
|
Err(e) => Err(format!("{log_line} \"\" 00 \"TLS error\" error:{e}")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -597,13 +592,13 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
// correct port
|
// correct port
|
||||||
if let Some(expected_port) = self.local_port_check {
|
if let Some(expected_port) = self.local_port_check
|
||||||
if let Some(port) = url.port() {
|
&& let Some(port) = url.port()
|
||||||
// Validate that the port in the URL is the same as for the stream this request
|
{
|
||||||
// came in on.
|
// Validate that the port in the URL is the same as for the stream this request
|
||||||
if port != expected_port {
|
// came in on.
|
||||||
return Err((PROXY_REQUEST_REFUSED, "Proxy request refused"));
|
if port != expected_port {
|
||||||
}
|
return Err((PROXY_REQUEST_REFUSED, "Proxy request refused"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(url)
|
Ok(url)
|
||||||
|
|
@ -662,24 +657,24 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Ok(metadata) = tokio::fs::metadata(&path).await {
|
if let Ok(metadata) = tokio::fs::metadata(&path).await
|
||||||
if metadata.is_dir() {
|
&& metadata.is_dir()
|
||||||
if url.path().ends_with('/') || url.path().is_empty() {
|
{
|
||||||
// if the path ends with a slash or the path is empty, the links will work the same
|
if url.path().ends_with('/') || url.path().is_empty() {
|
||||||
// without a redirect
|
// if the path ends with a slash or the path is empty, the links will work the same
|
||||||
// use `push` instead of `join` because the changed path is used later
|
// without a redirect
|
||||||
path.push("index.gmi");
|
// use `push` instead of `join` because the changed path is used later
|
||||||
if !path.exists() {
|
path.push("index.gmi");
|
||||||
path.pop();
|
if !path.exists() {
|
||||||
// try listing directory
|
path.pop();
|
||||||
return self.list_directory(&path).await;
|
// try listing directory
|
||||||
}
|
return self.list_directory(&path).await;
|
||||||
} else {
|
|
||||||
// if client is not redirected, links may not work as expected without trailing slash
|
|
||||||
let mut url = url;
|
|
||||||
url.set_path(&format!("{}/", url.path()));
|
|
||||||
return self.send_header(REDIRECT_PERMANENT, url.as_str()).await;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// if client is not redirected, links may not work as expected without trailing slash
|
||||||
|
let mut url = url;
|
||||||
|
url.set_path(&format!("{}/", url.path()));
|
||||||
|
return self.send_header(REDIRECT_PERMANENT, url.as_str()).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -743,7 +738,7 @@ where
|
||||||
return Ok(());
|
return Ok(());
|
||||||
};
|
};
|
||||||
|
|
||||||
log::info!("Listing directory {:?}", path);
|
log::info!("Listing directory {path:?}");
|
||||||
|
|
||||||
self.send_header(SUCCESS, "text/gemini").await?;
|
self.send_header(SUCCESS, "text/gemini").await?;
|
||||||
self.stream.write_all(preamble.as_bytes()).await?;
|
self.stream.write_all(preamble.as_bytes()).await?;
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ impl FileOptions {
|
||||||
/// (Re)reads a specified sidecar file.
|
/// (Re)reads a specified sidecar file.
|
||||||
/// This function will allways try to read the file, even if it is current.
|
/// This function will allways try to read the file, even if it is current.
|
||||||
fn read_database(&mut self, db: &Path) {
|
fn read_database(&mut self, db: &Path) {
|
||||||
log::debug!("reading database {:?}", db);
|
log::debug!("reading database {db:?}");
|
||||||
|
|
||||||
let mut ini = Ini::new_cs();
|
let mut ini = Ini::new_cs();
|
||||||
ini.set_default_section("mime");
|
ini.set_default_section("mime");
|
||||||
|
|
@ -124,7 +124,7 @@ impl FileOptions {
|
||||||
let files = match map {
|
let files = match map {
|
||||||
Ok(section) => section,
|
Ok(section) => section,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
log::error!("invalid config file {:?}: {}", db, err);
|
log::error!("invalid config file {db:?}: {err}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -147,8 +147,7 @@ impl FileOptions {
|
||||||
|| !header.chars().nth(2).unwrap().is_whitespace()
|
|| !header.chars().nth(2).unwrap().is_whitespace()
|
||||||
{
|
{
|
||||||
log::error!(
|
log::error!(
|
||||||
"Line for {:?} starts like a full header line, but it is incorrect; ignoring it.",
|
"Line for {path:?} starts like a full header line, but it is incorrect; ignoring it."
|
||||||
path
|
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -158,9 +157,7 @@ impl FileOptions {
|
||||||
// character has to be a space, so correct any
|
// character has to be a space, so correct any
|
||||||
// other whitespace to it (e.g. tabs)
|
// other whitespace to it (e.g. tabs)
|
||||||
log::warn!(
|
log::warn!(
|
||||||
"Full Header line for {:?} has an invalid character, treating {:?} as a space.",
|
"Full Header line for {path:?} has an invalid character, treating {separator:?} as a space."
|
||||||
path,
|
|
||||||
separator
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
let status = header
|
let status = header
|
||||||
|
|
@ -193,12 +190,12 @@ impl FileOptions {
|
||||||
match glob_with(path, glob_options) {
|
match glob_with(path, glob_options) {
|
||||||
Ok(paths) => paths.collect::<Vec<_>>(),
|
Ok(paths) => paths.collect::<Vec<_>>(),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
log::error!("incorrect glob pattern in {:?}: {}", path, err);
|
log::error!("incorrect glob pattern in {path:?}: {err}");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log::error!("path is not UTF-8: {:?}", path);
|
log::error!("path is not UTF-8: {path:?}");
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -213,7 +210,7 @@ impl FileOptions {
|
||||||
self.file_meta.insert(path, preset.clone());
|
self.file_meta.insert(path, preset.clone());
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
log::warn!("could not process glob path: {}", err);
|
log::warn!("could not process glob path: {err}");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue