fn openssl_acceptor(mut builder: SslAcceptorBuilder) -> io::Result<SslAcceptor> {
    builder.set_alpn_select_callback(|_, protocols| {
        const H2: &[u8] = b"\x02h2";
        const H11: &[u8] = b"\x08http/1.1";

        if protocols.windows(3).any(|window| window == H2) {
            Ok(b"h2")
        } else if protocols.windows(9).any(|window| window == H11) {
            Ok(b"http/1.1")
        } else {
            Err(AlpnError::NOACK)
        }
    });

    builder.set_alpn_protos(b"\x08http/1.1\x02h2")?;

    Ok(builder.build())
}
/// Configure `SslAcceptorBuilder` with custom server flags.
Configure `SslAcceptorBuilder` with custom server flags.
Configure ` SslAcceptorBuilder ` with custom server flags .
fn openssl_acceptor(mut builder: SslAcceptorBuilder) -> io::Result<SslAcceptor> {
    builder.set_alpn_select_callback(|_, protocols| {
        const H2: &[u8] = b"\x02h2";
        const H11: &[u8] = b"\x08http/1.1";
        if protocols.windows(3).any(|window| window == H2) {
            Ok(b"h2")
        } else if protocols.windows(9).any(|window| window == H11) {
            Ok(b"http/1.1")
        } else {
            Err(AlpnError::NOACK)
        }
    });
    builder.set_alpn_protos(b"\x08http/1.1\x02h2")?;
    Ok(builder.build())
}
fn openssl_acceptor ( mut builder : SslAcceptorBuilder ) -> io :: Result < SslAcceptor > { builder . set_alpn_select_callback ( | _ , protocols | { const H2 : & [ u8 ] = b" \x02 " ; const H11 : & [ u8 ] = b" \x08 " ; if protocols . windows ( 3 ) . any ( | window | window == H2 ) { Ok ( b" " ) } else if protocols . windows ( 9 ) . any ( | window | window == H11 ) { Ok ( b" " ) } else { Err ( AlpnError :: NOACK ) } } ) ; builder . set_alpn_protos ( b" \x08 \x02 " ) ? ; Ok ( builder . build ( ) ) }
Configure `SslAcceptorBuilder` with custom server flags.
Configure ` SslAcceptorBuilder ` with custom server flags .
builder
SslAcceptorBuilder
builder
SslAcceptorBuilder