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

HTTPS Example does not work #357

Closed
aniljava opened this issue Jul 9, 2016 · 2 comments
Closed

HTTPS Example does not work #357

aniljava opened this issue Jul 9, 2016 · 2 comments

Comments

@aniljava
Copy link

aniljava commented Jul 9, 2016

https.rs is copy pasted from example directory to src/main.rs

Cargo.toml

[dependencies.nickel]
version = "*"

[dependencies.hyper]
version = "*"

[features]
ssl = ["nickel/ssl"]

Also does not work with, ssl = ["nickel/ssl", "hyper/ssl"]

Error from cargo run --features ssl

src/main.rs:13:12: 13:24 error: the trait bound `hyper::net::Openssl: hyper::net::Ssl` is not satisfied [E0277]
src/main.rs:13     server.listen_https("127.0.0.1:6767", ssl).unwrap();
                          ^~~~~~~~~~~~
src/main.rs:13:12: 13:24 help: run `rustc --explain E0277` to see a detailed explanation
src/main.rs:13:48: 13:54 error: no method named `unwrap` found for type `()` in the current scope
src/main.rs:13     server.listen_https("127.0.0.1:6767", ssl).unwrap();

Environment

# rustc --version
rustc 1.9.0 (e4e8b6668 2016-05-18)

#cargo --version
cargo 0.10.0-nightly (10ddd7d 2016-04-08)
@Ryman
Copy link
Member

Ryman commented Jul 12, 2016

You should set your versions for nickel and hyper to be in sync, currently the published version of nickel is 0.8 and it's compatible with the 0.8 branch of hyper. The specific error you're seeing is because the Openssl you're using is from the 0.9 hyper and it implements ServerSsl rather than Ssl which was the 0.8 version of the trait. Sadly rustc doesn't give a great error here as it doesn't have any information about crate versions (a cargo concept only last I checked). There's an open issue for cargo around that: rust-lang/cargo#1636

For the second error, "no method named unwrap", the current example code on master hasn't been published yet (holding for another minor breaking change) so you can just remove the unwrap if you're using 0.8.

An alternative, if you want to use the current master, you can set your toml to the following:

[dependencies.nickel]
version = "*"
git = "https://github.com/nickel-org/nickel.rs"

But I really recommend you tie yourself to a specific version as generally life gets much easier then!

@jolhoeft
Copy link
Member

Due to changes in hyper, we have to redesign our https support. Resolving in favor of #415

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

No branches or pull requests

3 participants