Warp .tls() error: method not found

Hello,

I wrote a little HTTP server using warp.

It works well using HTTP, but i would like to upgrade to HTTPS.

I saw in the doc that there is a .tls(), .cert_path() and .key_path(), which seems perfect. I also see the .TlsServer().

None works. When i try with .tls(), i get the following error:

method not found in `impl warp::Future`

The code is:

warp::serve(routes).run(server)
                .tls()
                .cert_path("cert.pem")
                .key_path("key.rsa")
                .await;

Which i don't really understand. So, any help regarding this error could be great, and a solution must be awsome ^

Thanks

run runs the server and won't return.
serve returns a Server that can be converted into a TlsServer by calling tls.

Make sure that warp's "tls" feature flag is enabled in Cargo.toml.

Try this instead:

warp::serve(routes) // returns Server
                .tls() // returns TlsServer
                .cert_path("cert.pem")
                .key_path("key.rsa")
                .run(bind_addr) // returns Future<Output=()>
                .await;
1 Like

awsome ^^

thanks

1 Like