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

Call to TlsAcceptor.accept is not terminating if we send plain text traffic from client #63

Closed
parthmistry opened this issue Jun 10, 2021 · 1 comment

Comments

@parthmistry
Copy link

I am trying this echo server example with TlsAcceptor:
https://github.com/tokio-rs/tls/blob/master/tokio-native-tls/examples/echo.rs

And sending some plain-text traffic to this sample echo server like following:

curl -v "http://127.0.0.1:12345"

Of course, sending http request to echo server does not make much sense but I am just checking that call to tls_acceptor.accept should fail if it receives non-ssl traffic. On linux machine I am receiving following output with error on server-

accept connection from 127.0.0.1:48271
thread 'tokio-runtime-worker' panicked at 'accept error: Ssl(Error { code: ErrorCode(1), cause: Some(Ssl(ErrorStack([Error { code: 336027804, library: "SSL routines", function: "SSL23_GET_CLIENT_HELLO", reason: "http request", file: "s23_srvr.c", line: 414 }]))) }, X509VerifyResult { code: 0, error: "ok" })', src/main.rs:33:68
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

However on Mac OS X (11.4) call to tls_acceptor.accept(socket).await.expect("accept error") never terminates and even curl command keeps on waiting.

I just want to handle scenario where plain-text traffic is received on server instead of ssl-traffic and tls_acceptor should error out. Let me know if I am missing something here.

I am using rust 1.52.1 with following cargo dependencies-

tokio = { version = "1", features = ["full"] }
tokio-native-tls = "0.3.0"
native-tls = "0.2.7"
@parthmistry
Copy link
Author

I observed similar behavior when using only native-tls as well. So I guess no fix is needed for tokio-native-tls and closing this issue.

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

1 participant