Skip to content

Support for delayed secure connections (STARTTLS) #69

Closed
@arnaud-lb

Description

@arnaud-lb

Hi!

I would like to exchange some data on a stream before enabling TLS on it. Currently, the SecureConnector doesn't allow this, and there is no clean way of enabling TLS on Streams after the connection.

Use cases:

  • Supporting HTTP proxy CONNECT (required to implement HTTPS proxy support in http-client)
  • Supporting SMTP STARTTLS

I'm going to implement this, however I would like your opinion on these solutions:

  1. Add a DelayedSecureConnector class. Its create() method would result in a DelayedSecureStream instance, with a connect() method

  2. Add a createDelayed() method on SecureConnector, returning the stream and a callback that would allow to enable TLS. Also add a SecureConnectorInterface.

    list ($stream, $enableTLS) = $connector->connectDelayed();
    // Do something with the stream
    // Then, enable TLS:
    $enableTLS()->then(...);
    
  3. Add a "prologue" callback argument to create(), allowing the callback to manipulate the stream before encryption is enabled

WDYT ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions