Commit graph

83 commits

Author SHA1 Message Date
Matt Brubeck
dfa5dbd971 Use getopts for option parsing 2020-12-22 16:09:05 -08:00
Matt Brubeck
5d187a47fc Sort dependencies 2020-12-22 13:11:58 -08:00
Matt Brubeck
06aa131196 Version 1.3.2 2020-12-09 11:36:02 -08:00
Matt Brubeck
ebd457d9cf Update to async-tls 0.11 2020-12-09 11:35:01 -08:00
Matt Brubeck
41dac7ce5f Version 1.3.1 2020-12-08 09:06:11 -08:00
Douglas Creager
838f3ad8cb Update dependencies to make cargo install work
Right now, you get an error trying to `cargo install agate`:

    error[E0277]: the trait bound `TlsAcceptor: From<Arc<ServerConfig>>` is not satisfied
      --> src/main.rs:91:8
       |
    91 |     Ok(TlsAcceptor::from(Arc::new(config)))
       |        ^^^^^^^^^^^^^^^^^ the trait `From<Arc<ServerConfig>>` is not implemented for `TlsAcceptor`
       |
       = help: the following implementations were found:
                 <TlsAcceptor as From<Arc<rustls::server::ServerConfig>>>
                 <TlsAcceptor as From<rustls::server::ServerConfig>>
       = note: required by `from`

This stems a recent point upgrade of async-tls.  The newest version
(0.10.2) now depends on rustls 0.19.  The previous version in agate's
lock file (0.10.0) depended on rustls 0.18.  Agate itself also depended
on rustls 0.18.

The default behavior of `cargo install` is to ignore the lock file and
run a `cargo update` before building and installing.  That causes agate
and async-tls to compile against different versions of rustls, causing
the compiler error above.

Arguably, async-tls's recent release should have been a breaking
release, to 0.11, but since that ship has sailed, we can bump agate's
requirements to the latest published versions.  Everything seems to
build correctly, and the server still seems to work fine.
2020-12-08 08:28:11 -08:00
Matt Brubeck
cd5918e1b9 Refactor error handling code 2020-11-21 10:44:06 -08:00
Matt Brubeck
9097318e28 Log all requests 2020-11-21 09:53:26 -08:00
Matt Brubeck
6b553afa13 Use error 53 for mismatched port 2020-11-21 09:51:28 -08:00
Matt Brubeck
8b418ea09f Fix typo in README 2020-11-20 14:46:50 -08:00
Matt Brubeck
2b5125f517 Version 1.3.0 2020-11-20 14:27:36 -08:00
Matt Brubeck
b88cffb75e Tweak formatting of URLs in logs 2020-11-20 14:16:14 -08:00
Matt Brubeck
39e17828bb Update dependencies 2020-11-20 13:54:36 -08:00
Matt Brubeck
5394793b44 Disable some optional dependencies 2020-11-20 13:50:42 -08:00
Johann150
a515d508ac do not redirect on empty path
also fixed the check for a trailing slash
2020-11-20 13:45:08 -08:00
Matt Brubeck
80286a59fa
Merge pull request #4 from Johann150/master
add host and port checks
2020-11-16 14:46:08 -08:00
Johann150
b671ddf235
implement right status codes
Ran cargo fmt.
Implemented most recommendations of clippy.
2020-11-16 20:39:30 +01:00
Johann150
7ef914153b
add host and port checks
If the host does not match, the status code 53 should be used. But I am not sure how
to implement this best as the parse_request function only returns a String as error.
2020-11-14 11:15:30 +01:00
Matt Brubeck
bd2bc310d9
Merge pull request #3 from tronje/master
Add some simple logging via the env_logger crate
2020-11-10 09:42:48 -08:00
Tronje Krabbe
b33417198c Add some simple logging via the env_logger crate 2020-11-09 16:55:09 +01:00
Matt Brubeck
d13c98d614 Update dependencies 2020-09-28 21:17:41 -07:00
Matt Brubeck
75a0d127a1 Remove duplicated instructions 2020-09-22 10:59:50 -07:00
Matt Brubeck
9b5ca7f130 Version 1.2.2 2020-09-21 15:12:45 -07:00
Matt Brubeck
34fc4968ae Update dependencies 2020-09-21 12:57:35 -07:00
Matt Brubeck
713c8ca837 Code cleanup 2020-07-27 15:59:02 -07:00
Matt Brubeck
2c4118b590 Switch from tree_magic to mime_guess 2020-07-22 08:33:04 -07:00
Matt Brubeck
3a05cefe6f Update depenedencies 2020-07-22 08:26:33 -07:00
Matt Brubeck
22c3209aa7 Update async-tls 2020-07-16 08:57:57 -07:00
Matt Brubeck
2cc5f791aa Code cleanup 2020-07-16 08:57:57 -07:00
Matt Brubeck
c12b2ab656 Factor out response code 2020-06-28 15:08:31 -07:00
Matt Brubeck
29fddfe41e Minor cleanup 2020-06-20 12:14:07 -07:00
Matt Brubeck
b25da60e10 Make usage output friendlier 2020-06-20 11:16:41 -07:00
Matt Brubeck
9b260dfdd2 Link to pre-compiled binary 2020-06-20 10:53:10 -07:00
Matt Brubeck
a20af4ad12 Version 1.2.1
* Reduce memory usage when serving large files
* Update dependencies
2020-06-20 10:35:05 -07:00
Matt Brubeck
443e83f01b Update dependencies 2020-06-20 10:32:59 -07:00
Matt Brubeck
95f03cf143 Never read whole file into memory 2020-06-20 10:30:43 -07:00
Matt Brubeck
76bbfafee5 Minor cleanup 2020-06-20 10:02:36 -07:00
Matt Brubeck
59c921c5d5 Switch to fork of tree_magic 2020-06-10 08:42:57 -07:00
Matt Brubeck
c4aa71836b Update dependencies 2020-06-08 18:28:48 -07:00
Matt Brubeck
7899d9addb Change file extension from .gemini to .gmi 2020-06-07 08:53:32 -07:00
Matt Brubeck
5314e23415 Update depedencies 2020-05-22 19:13:38 -07:00
Matt Brubeck
2632bf14be Minor cleanup 2020-05-22 19:13:27 -07:00
Matt Brubeck
798506a03c Fix error message when request is too long 2020-05-22 19:08:00 -07:00
Matt Brubeck
7588b23fcb Switch from lazy_static to once_cell 2020-05-22 19:03:41 -07:00
Matt Brubeck
8e13714011 comments 2020-05-22 18:37:55 -07:00
Matt Brubeck
cac7e394be Minor cleanup in parse_request 2020-05-22 15:26:16 -07:00
Matt Brubeck
a049beb66b Improved request parsing.
Only read up to 1024 bytes plus CRLF. This avoids allocations and
copies, and prevents malicious/buggy clients from making us allocate
unbounded amounts of memory.

We also stop if we see a lone LF, rather than timing out until CRLF is
received.
2020-05-22 08:45:58 -07:00
Matt Brubeck
039057b8db Improve request parsing 2020-05-22 08:32:44 -07:00
Matt Brubeck
0d872688f9 Use temporary fork of tree_magic 2020-05-21 17:05:06 -07:00
Matt Brubeck
ce570fc8c4 Auto-detect MIME types 2020-05-21 15:29:04 -07:00