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.
- Show accurate defaults
- Make generate_cert executable
- Delete temporary certificate files (everything except identity.pfx)
Signed-off-by: Alexey Yerin <yerinalexey98fd@gmail.com>
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>
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>
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>
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.
If you pass path like `example.com//etc/passwd`, server will respond
with contents of `/etc/passwd` file
Signed-off-by: Alexey Yerin <yerinalexey98fd@gmail.com>