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

Panic on invalid certificate path when creating tls server #1040

Open
fritzrehde opened this issue May 12, 2023 · 1 comment
Open

Panic on invalid certificate path when creating tls server #1040

fritzrehde opened this issue May 12, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@fritzrehde
Copy link

Version

└── warp v0.3.5

Platform
Linux thinkpad 6.3.1-arch1-1 #1 SMP PREEMPT_DYNAMIC Mon, 01 May 2023 17:42:39 +0000 x86_64 GNU/Linux

Description
I want to create a tls server with the code down below. config is a struct that stores the configuration, and it contains strings for client auth, cert and key paths. However, if these strings are invalid paths (or maybe just don't contain the "expected" content, I'm not sure), then warp::serve panics.

I tried this code:

        warp::serve(routes)
            .tls()
            .client_auth_required_path(config.client_ca_path)
            .cert_path(config.cert_path)
            .key_path(config.key_path)
            .run(socket)
            .await;

I expected to see this happen:
Some proper way of error handling. Can I work with a result somehow instead of it panicking?

Instead, this happened:

thread 'main' panicked at 'error binding to 0.0.0.0:3030: certificate parse error', /home/.../.cargo/registry/src/github.com-.../warp-0.3.5/src/server.rs:534:27
@fritzrehde fritzrehde added the bug Something isn't working label May 12, 2023
@dsendkowski
Copy link

You can make use of try_bind_with_graceful_shutdown function that has been added recently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants