Apply ALPN protocols OpenSSL 1.1.0f+ allows ALPN negotiation to fail without aborting handshake. rustls follows RFC 7301 strictly and rejects connections with no matching protocol. To emulate OpenSSL behavior, we add a special fallback protocol (null byte).
(config_alpn: &mut Vec<Vec<u8>>, alpn_protocols: &[Vec<u8>])
| 851 | /// rustls follows RFC 7301 strictly and rejects connections with no matching protocol. |
| 852 | /// To emulate OpenSSL behavior, we add a special fallback protocol (null byte). |
| 853 | fn apply_alpn_with_fallback(config_alpn: &mut Vec<Vec<u8>>, alpn_protocols: &[Vec<u8>]) { |
| 854 | if !alpn_protocols.is_empty() { |
| 855 | *config_alpn = alpn_protocols.to_vec(); |
| 856 | config_alpn.push(vec![0u8]); // Add null byte as fallback marker |
| 857 | } |
| 858 | } |
| 859 | |
| 860 | /// Create a client TLS configuration |
| 861 | /// |
no test coverage detected