Simplify Config::load
Simplify Config::load by using the fs::read_to_string function provided
in std. Additionally, we update the type of the config_path argument to
be generic over AsRef<Path> which is generally preferred over &str for
file path arguments.
Cancel request on invalid Unicode character
It's pointless to continue as file names mostly don't contain invalid
Unicode.
Signed-off-by: Alexey Yerin <yerinalexey98fd@gmail.com>
Merge branch 'master' of git.sr.ht:~garritfra/taurus
Improve docs & update generate_cert script
- Show accurate defaults
- Make generate_cert executable
- Delete temporary certificate files (everything except identity.pfx)
Signed-off-by: Alexey Yerin <yerinalexey98fd@gmail.com>
Add Continuous Integration
Use 4096 bit key length for test certs
Fixes a security error on debian machines
Return TaurusError when failing to parse GeminiRequest
This patch adds TaurusError::InvalidRequest` and updates GeminiRequest
to impl FromStr and expose Gemini::parse that will attempt to parse a
string and return an instance of TaurusError::InvalidRequest if an error
occurs - such as the request being malformed, or the url being invalid.
Signed-off-by: Josh Leeb-du Toit <mail@joshleeb.com>
Add TaurusResult type alias
This patch adds the `TaurusResult` type alias, and replaces instances of
`error::TaurusError` with just `TaurusError`.
Signed-off-by: Josh Leeb-du Toit <mail@joshleeb.com>
Impl From<native_tls::Error> to TaurusError::InvalidCertificate
This patch adds `#[from]` to `TaurusError::InvalidCertificate` which
means that any `native_tls::Error` can be converted (using `From` and
`Into`) to a `TaurusError::InvalidCertificate`.
From what I can see, [here][native_tls_error_docs], the
`native_tls::Error` type is kind of a catch all for errors from that lib
rather than being broken down into suberrors (like `io::Error`)
[native_tls_error_docs]: https://docs.rs/native-tls/0.2.6/native_tls/struct.Error.html
Signed-off-by: Josh Leeb-du Toit <mail@joshleeb.com>
Prevent memory leaks
Creating an owned String takes time and space in the heap and should be
done lazily. But in some places error message (which is an owned String)
is created even if there's no errors.