Skip to content

ALPN processing on Linux can be improved #58299

@wfurt

Description

@wfurt

this was noticed while working on #57079
There are few places when we allocate when we may not need to - particularly converting ALPN list to array.
The list is typically small so we may use stackalloc.
Further more, typical use would probably have only http11 and h2. We can probably special-case this and avoid processing for each connection. HttpClient already does that:

private static readonly List<SslApplicationProtocol> s_http3ApplicationProtocols = new List<SslApplicationProtocol>() { SslApplicationProtocol.Http3 };
private static readonly List<SslApplicationProtocol> s_http2ApplicationProtocols = new List<SslApplicationProtocol>() { SslApplicationProtocol.Http2, SslApplicationProtocol.Http11 };
private static readonly List<SslApplicationProtocol> s_http2OnlyApplicationProtocols = new List<SslApplicationProtocol>() { SslApplicationProtocol.Http2 };

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions