Function rustls_server_connection_get_server_name

Source
#[no_mangle]
pub extern "C" fn rustls_server_connection_get_server_name(
    conn: *const rustls_connection,
) -> rustls_str<'static>
Expand description

Returns a rustls_str reference to the server name sent by the client in a server name indication (SNI) extension.

The returned rustls_str is valid until the next mutating function call affecting the connection. A mutating function call is one where the first argument has type struct rustls_connection * (as opposed to const struct rustls_connection *). The caller does not need to free the rustls_str.

Returns a zero-length rustls_str if:

  • the connection is not a server connection.
  • the connection is a server connection but the SNI extension in the client hello has not been processed during the handshake yet. Check rustls_connection_is_handshaking.
  • the SNI value contains null bytes.