Skip to content

Conversation

@tylerhawkes
Copy link

This is a continuation of #465 that was originally done by @ctrlaltf24.

My company has been using that branch with a few minor improvements. I just got the tests passing by changing how the certificates and keys are generated so that rustls will accept localhost in a secure connection.

ctrlaltf24 and others added 17 commits September 19, 2024 19:24
Turned out to be rather easy due to all tls being handled by our dependencies.

Don't love the _fallback-tls feature, however with it we can use cargo-all-features,
which helps reduce feature related bugs.

Downside of cargo-all-features is it takes a long time to execute.

Fixes: 1c3t3a#407, 1c3t3a#366
There's still an error with ci.
engineio/src/lib.rs/test/tls_connector doesn't function the same as native-tls one (as it properly validates hostnames)

Needs further investigation as to why the hostname shows as invalid in ci. If we no longer need that, then this PR can be merged.
Turned out to be rather easy due to all tls being handled by our dependencies.

Don't love the _fallback-tls feature, however with it we can use cargo-all-features,
which helps reduce feature related bugs.

Downside of cargo-all-features is it takes a long time to execute.

Fixes: 1c3t3a#407, 1c3t3a#366
There's still an error with ci.
engineio/src/lib.rs/test/tls_connector doesn't function the same as native-tls one (as it properly validates hostnames)

Needs further investigation as to why the hostname shows as invalid in ci. If we no longer need that, then this PR can be merged.
NXD-0: Update webpki due to vulnerabilities
…s-types' into tyler/feat-add-features-for-other-tls-types
.build()
.unwrap(),
)
// .tls_config(
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can remove this, since it isn't needed for the tests to pass.


sender
.send(Message::text(Cow::Borrowed(from_utf8(&Bytes::from(
.send(Message::text(Utf8Bytes::try_from(Bytes::from(
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the other changes in this file are due to upgrading tungstenite. This avoids an extra allocation that was happening inside of the text call.

use std::io::Read;

pub(crate) fn tls_connector() -> error::Result<TlsConnector> {
pub fn tls_connector() -> error::Result<TlsConfig> {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is exposed to the socketio crate for use in tests.

Comment on lines +212 to +215
#[cfg_attr(
feature = "_native-tls",
doc = r#"
# Example for native-tls
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These look less appealing, but allows the docs build for all feature configurations

@shenjackyuanjie
Copy link
Contributor

are there any update for this PR?
I would like to use this branch in my project, is this "stable"?

@tylerhawkes
Copy link
Author

are there any update for this PR? I would like to use this branch in my project, is this "stable"?

Yes, this is stable. It will only have requested changes needed to make requested fixes (if that ever happens)

You can also use the nextdata-tech:feat-add-features-for-other-tls-types branch that has the same fixes, just not with the tests passing

@tommyreins
Copy link

is this PR ready for review?

@SomaticIT
Copy link

It works very well on my project.
@1c3t3a, can it be reviewed for merging?

It's a very important feature...

@tylerhawkes
Copy link
Author

This is ready for review, unless you want it broken up, which I can do, but this is the effect of making a change and having a couple of dependency bumps and a couple of bug fixes over time. More that 60% of the code would remain on this pr if I did break it up.

@vanics
Copy link

vanics commented Jul 24, 2025

I'd also love to see this one merged.

@tommyreins
Copy link

What's the hold up?

@ventosus
Copy link

ventosus commented Sep 9, 2025

Could this be extended to build without tls at all?

I don't need tls in my project and it is a nuisance to cross build (ring dependency fails to cross compile with musl).

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

Successfully merging this pull request may close these issues.

9 participants