snapview/tungstenite-rs

client_tls, stream is not upgradeable?

dozepih opened this issue · 1 comments

/// upgrading the stream to TLS if required.

Is this really true? Tried sending in a TlsStream<TcpStream> with the result of: TLS error: native-tls error: unexpected EOF but just using a <TcpStream> works fine.

Yes, this is true 🙂 However, we can't identify if the stream is encrypted (we don't know anything about the stream except that it's Read and Write). We decide if we need to wrap the stream based on the protocol ws:// vs wss://. So if you supply a stream X with wss:// URL, we would try to "upgrade" the stream to use TLS.