Skip to content

Make H2Upgraded public to allow downcasting Upgraded for Sync access to underlying IO #3987

@imlk0

Description

@imlk0

Hi, I'd like to request that hyper::proto::h2::H2Upgraded<T> be made pub, so users can downcast an hyper::upgrade::Upgraded object to access the underlying I/O type for HTTP/2 connections.

Problem

Currently, Upgraded is not Sync, which prevents sending it across threads or storing it in Sync contexts. While HTTP/1 upgraded connections can be downcast using .downcast::<Tokio<TcpStream >>(), but the underlying I/O type for HTTP/2 H2Upgraded<T> is private, making it impossible to downcast and recover the inner IO (which is often Sync).

// This fails to compile — `H2Upgraded` is private
upgraded.downcast::<hyper::proto::h2::H2Upgraded<bytes::Bytes>>()

Note

Thanks for all the great work on Hyper! I'd be happy to help implement this if you agree.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-featureCategory: feature. This is adding a new feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions