Params.sslTrustCallback

A pointer to a function of prototype mg_trust_callback_type: int trust_callback(const char *hostname, const char *ip_address, const char *key_type, const char *fingerprint, void *trust_data);

After performing the SSL handshake, mg_connect will call this function providing the hostname, IP address, public key type and fingerprint and user provided data. If the function returns a non-zero value, SSL connection will be immediately terminated. This can be used to implement TOFU (trust on first use) mechanism. It might happen that hostname can not be determined, in that case the trust callback will be called with hostname="undefined".

struct Params
mg_trust_callback_type sslTrustCallback;

Meta