Skip to content

Feature request: SecureSocket.secure() should support non-_Socket Sockets #39690

Open
@GreenAppers

Description

The _ in _detachRaw precludes using SecureSocket with a Socket implemented outside of dart:io:
https://github.com/dart-lang/sdk/blob/master/sdk/lib/io/secure_socket.dart#L116

I'm working on a Dart SSH package that implements Socket over an SSH tunnel: https://github.com/GreenAppers/dartssh/blob/master/lib/socket_io.dart#L110

I would like to be able to make SSL connections over an SSH tunnel using SecureSocket, but this is not currently possible.

I think simply renaming _detachRaw to detachRaw would be one fix.

However perhaps a better fix would be to expose the _Socket constructor. Something like Socket socketFromRaw(RawSocket raw) => _Socket(raw); And then I would implement RawSocket instead of Socket.

Perhaps someone will recommended a better solution. (If it turns out the SSL implementation under SecureSocket only supports a native file descriptor, the fix would be more involved)

In the mean time, I will test the fixes I've proposed and update the bug. Thanks!

Metadata

Assignees

No one assigned

    Labels

    area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.library-iotype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions