housleyjk / ws-rs

Lightweight, event-driven WebSockets for Rust.
MIT License
1.46k stars 221 forks source link

SSL Server example is outdated #307

Open creikey opened 4 years ago

creikey commented 4 years ago

Uses the method SslAcceptorBuilder::mozilla_intermediate which has been deprecated in the ssl package since 0.9.14

creikey commented 4 years ago

I don't know enough about rust to confidently open a PR for this, but I think the code:

let acceptor = Rc::new(SslAcceptorBuilder::mozilla_intermediate(
        SslMethod::tls(),
        &pkey,
        &cert,
        std::iter::empty::<X509Ref>(),
    ).unwrap().build());

Can be replaced with this new code that works with the most recent opensll api:

let mut acceptor_builder = SslAcceptor::mozilla_intermediate(SslMethod::tls()).unwrap();
    acceptor_builder.set_private_key(&pkey).unwrap();
    acceptor_builder.set_certificate(&cert).unwrap();
    let acceptor = Rc::new(acceptor_builder.build());
Darkspirit commented 4 years ago

With openssl 0.10.24 and later, mozilla_intermediate_v5() should be used. The old mozilla_intermediate() does not have TLS 1.3.