Skip to content

Relax body requirements by removing 'static bound #3752

Open
@nanoqsh

Description

@nanoqsh

For now to send any requests you need request's body to be 'static: handshake

I think this restriction is unnecessary for many async runtimes that allow borrowing external environment. My proposal is to remove this restriction, allowing types such as Full<&'a [u8]> to be used as a body. Besides, it may simplify the public API a little bit.

This can be done for http1. But the implementation of the http2 requires a downcasting of body's Data, so it must be 'static. Anyway, even <B as Body>::Data: 'static is less restrictive than B: Body + 'static, it allows to use some borrowed body that produces static chunks of data. I'm not sure if it's possible to relax this restriction too. Maybe something can be invented in the future

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