Skip to content

StreamWriter.start_tls should allow overriding server_side #155896

Description

@krystalgamer

Feature or enhancement

Proposal:

start_tls() is used to upgrade a connection to a secure version.
Currently the server_side parameter is calculated based on the existence of a callback which is only set by start_server().

While for most cases the server should be performing the server role for the TLS handshake, there's a few instances the opposite is desired.

For my personal use case I've duplicated the logic and added a new kwarg to set it manually and it works.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Activity

  1. added
    type-feature
    on Aug 16, 2026
  2. added
    stdlib
    on Aug 16, 2026
  3. asvetlov commented on Nov 2, 2026

    @asvetlov
    Contributor

    I'm not sure that we should go in this direction.
    From my perspective, server_side=True is mandatory for server mode.
    Otherwise, we open an attack vector for Python users.

    If the risk is tolerable for you, duplicated logic is fine IMHO.

  4. krystalgamer commented on Nov 2, 2026

    @krystalgamer
    Author

    it's a niche usecase with server-to-server communication. totally fine with duplicating the logic :)

    @asvetlov i'm not following the attack vector you mention.

  5. added a commit that references this issue on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibtopic-asynciotype-feature

    Projects

    • Status
      Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions