Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Box<dyn Error> with error enum #157

Open
wants to merge 38 commits into
base: master
Choose a base branch
from

Conversation

haileys
Copy link

@haileys haileys commented Feb 5, 2019

This pull request replaces the use of a Box<dyn Error> in Server::new and related methods with a plain old error enum instead.

This is easier to work with as a consumer of tiny_http and makes it possible to handle errors exhaustively.

The first commit in this PR simply replaces the string error message about SSL requiring the ssl feature with a NewServerError::SslFeatureRequired enum case.

The second commit builds on this by making the ServerConfig::ssl field conditional on the ssl feature, making any attempt to start an SSL server without the ssl feature a compile time error. This change allowed me to then remove NewServerError::SslFeatureRequired again.

spk and others added 30 commits March 26, 2017 22:38
131: Uncomment and fix detect_connection_closed test r=frewsxcv
Pass locally but not sure if travis is configured correctly
Cheers
130: Fix use of deprecated item: replaced by std::thread::sleep r=frewsxcv
Hello, this fix some deprecated items on tests:

```
warning: use of deprecated item: replaced by `std::thread::sleep`, #[warn(deprecated)] on by default
  --> tests/network.rs:73:5
   |
73 |     thread::sleep_ms(100);
   |     ^^^^^^^^^^^^^^^^

```

Cheers
Since rustc_serialize is now deprecated, and since it is currently only used
for the websockets example, limit the dependency to development only.
133: Pull in rustc_serialize as a dev dependency only r=frewsxcv

Since rustc_serialize is now deprecated, and since it is currently only used
for the websockets example, limit the dependency to development only.
Fix `next_header_source` alignment
142: Bump dependencies r=frewsxcv a=Eijebong
README: Bump version nr. in the Installation section
Fix a small documentation typo
The project "encoding" appears to be unmaintained, and hasn't received
an update since 2017. Unfortunately the "encoding" artifacts on
crates.io do not contain the licenses for the project, which adds
difficulty in auditing dependencies.

Since "tiny-http" doesn't actually use the EncodingDecoder, this patch
removes it and it's dependency on "encoding" in order to avoid
complications resolving the "tiny-http" dependency story.

Instead, I would suggest investigating migrating over to
https://docs.rs/encoding_rs/0.8.13/encoding_rs/, which appears to be
actively maintained by Mozilla.

If this patch is accepted, would it be possible to get a release as
well?
frewsxcv and others added 8 commits December 20, 2018 21:50
Expose chunked_threshold on Response. Fix tiny-http#149
AsciiExt was deprecated in 1.26.0
153: Remove the unused EncodingDecoder r=frewsxcv a=erickt

The project "encoding" appears to be unmaintained, and hasn't received
an update since 2017. Unfortunately the "encoding" artifacts on
crates.io do not contain the licenses for the project, which adds
difficulty in auditing dependencies.

Since "tiny-http" doesn't actually use the EncodingDecoder, this patch
removes it and it's dependency on "encoding" in order to avoid
complications resolving the "tiny-http" dependency story.

Instead, I would suggest investigating migrating over to
https://docs.rs/encoding_rs/0.8.13/encoding_rs/, which appears to be
actively maintained by Mozilla.

If this patch is accepted, would it be possible to get a release as
well?

Co-authored-by: Erick Tryzelaar <etryzelaar@google.com>
@tomaka
Copy link
Member

tomaka commented Mar 4, 2019

Sorry for the delay.

One problem with this, is that if you depend on the library without the SSL feature and match on the enum, then if the feature gets enabled your compilation will break.

I think we should have an SSL error anyway, except that it would contain an opaque type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet