Commit graph

112 commits

Author SHA1 Message Date
Johann150
197e4592b9
use configparser crate
This parser can correctly read globs from configuration keys which allows
their use not just in theory in the server logic but in the config file too.
2021-02-12 16:51:42 +01:00
Johann150
fdca530591
allow globs in config file paths
The configuration parser will have to be changed again because YAML does not
support asterisks in its key names.
2021-02-12 15:00:29 +01:00
Johann150
49813d0c68
serve hidden files if there is a .meta config for them 2021-02-11 18:46:20 +01:00
Johann150
bd9ed3255a
add central configuration mode
also slight correction of the documentation because we are now using YAML
(a space is now required behind the colon)
2021-02-11 09:04:38 +01:00
Johann150
8fd9ca15c3
better error message for missing keys (again)
adresses comments from #33
Loading the certificate and key file is done at startup because:
1. We can detect the incorrect file faster and fail the whole server and not
   just a worker thread. All subsequent worker threads would fail for the same
   reason anyway.
2. We do not have to read the same unchanged files over and over again. This
   is good because file I/O is slower than in-memory cloning instead.
2021-02-10 23:39:11 +01:00
Johann150
fb0a30e5fc
better error message for incorrect keys 2021-02-10 22:41:39 +01:00
Johann150
544f577b59
use YAML parser for sidecar files
The syntax so far is (compatible with) YAML.
2021-02-10 21:25:22 +01:00
Johann150
9d9fb3d31b
resolve merge conflicts 2021-02-09 19:52:29 +01:00
Johann150
a9588350a0
format using cargo fmt 2021-02-09 15:01:26 +01:00
Johann150
03325ba1a4
add flag for only TLSv1.3
closes #12
2021-02-09 14:45:47 +01:00
Johann150
309da06208
harmonise help texts 2021-02-08 21:52:22 +01:00
Johann150
8fbbec2b4b
implement simple vhosts
closes #28
2021-02-08 21:52:22 +01:00
Johann150
5de00f66bb
reenable multiple occurences of --addr
Accidentally disabled this when merging reformatting.
2021-02-08 10:22:16 +01:00
Johann150
e0cd1a723a
resolve clippy warnings 2021-02-06 20:03:58 +01:00
Johann150
055dceeece
also check logging environment variable 2021-02-05 08:43:07 +01:00
Johann150
f1ff0fe0fe
use Mutex instead of RwLock
Since we only ever need to access it mutably, no need to differentiate
mutable and immutable acces.
2021-02-04 17:56:50 +01:00
Johann150
548e0f401f
cache parsing, new syntax
Changed the parsing and also parse once when reading the config file and then
cache the parse result, rather than checking the line format every time the
file is served.
2021-02-04 17:00:33 +01:00
Johann150
aa713a2dea
formatting 2021-02-04 16:56:17 +01:00
Johann150
46866c4320
resolve merge conflicts 2021-01-27 22:00:28 +01:00
Johann150
0411a8278f fix doc comment 2021-01-26 09:36:51 -08:00
Johann150
f0789921e0 make functions into methods of RequestHandle 2021-01-26 09:36:51 -08:00
Johann150
116c9fdcb4 rename flag 2021-01-26 09:36:51 -08:00
Johann150
74853799c7 handle errors in handle_request 2021-01-26 09:36:51 -08:00
Johann150
3353989e7e add log_line to RequestHandle
There are still some problems with this, the error handling in handle_request
will have to be changed to accomodated the new log_line.
2021-01-26 09:36:51 -08:00
Johann150
aa17b5bc17 add RequestHandle struct 2021-01-26 09:36:51 -08:00
Johann150
21486a0d11 add logging for peer IP addresses 2021-01-26 09:36:51 -08:00
Johann150
fdd2ac7e56 simplify meta type to &str
Since this specialty is only used once and this would complicate generating the
logging string from a str array without code duplication.
2021-01-26 09:36:51 -08:00
Johann150
6bbbb5ed4b use sidecar files 2021-01-17 19:43:42 +01:00
Johann150
e68637fb1b fix check_outdated 2021-01-17 19:42:48 +01:00
Johann150
f7ac1fe21b update readme 2021-01-17 19:42:48 +01:00
Johann150
c916827709 add metadata database 2021-01-17 19:42:48 +01:00
Johann150
bb7e885143 run cargo fmt 2021-01-17 19:42:48 +01:00
Johann150
6d51e97649 fix help message 2021-01-16 18:24:10 -08:00
Johann150
7c4a042cd3 check port against TCP stream's port
This also reinstates the old format for the --addr flag and removes
the separate flag for the port.
2021-01-16 18:24:10 -08:00
Matt Brubeck
dd4be5b9f6 Take port as a separate command-line argument 2021-01-16 10:42:27 -08:00
Johann150
4e7d09204f only check path segments in URL
This will only check path segments specified in the request URL and not
path segments that are part of the path specified on the command line.

Otherwise if the content directory was (in) a hidden directory, or specified
with a relative path containing "." or ".." segments, nothing would be served.
2021-01-16 09:56:58 -08:00
Johann150
972ecf8c13 correctly redirect directories
cf. <https://lists.orbitalfox.eu/archives/gemini/2021/004827.html>
2021-01-16 09:56:04 -08:00
Johann150
681ba770a1 check all path components 2021-01-05 12:36:50 -08:00
Johann150
af783f6911 configuration flag to reenable secret files 2021-01-05 12:36:50 -08:00
Johann150
7d10fa3c74 do not serve hidden files 2021-01-05 12:36:50 -08:00
Matt Brubeck
1361f07467 Scheme-relative URLs are no longer allowed
https://lists.orbitalfox.eu/archives/gemini/2020/003646.html
2021-01-01 20:10:04 -08:00
Matt Brubeck
c563f27b1a Send close_notify before closing connection 2021-01-01 20:05:19 -08:00
Matt Brubeck
33d39cc34b Organize imports 2020-12-31 18:07:59 -08:00
Matt Brubeck
471a9927a0 Use the Tokio async runtime 2020-12-31 18:05:46 -08:00
Matt Brubeck
ec50a315a3 Use concrete types for TlsStreams 2020-12-31 17:02:45 -08:00
Matt Brubeck
edf2ebffdc Refactor error handling and logging 2020-12-31 16:20:57 -08:00
Matt Brubeck
847434d844 Reorganize some code 2020-12-31 15:41:15 -08:00
Matt Brubeck
879422c2cc Simplify percent-encoding of paths. 2020-12-31 15:39:36 -08:00
Matt Brubeck
fe62be214e Reduce number of writes in send_header 2020-12-31 14:43:22 -08:00
Matt Brubeck
bf2e35537c Percent-escape more characters 2020-12-30 22:12:38 -08:00