static void uclient_ssl_notify_error(struct ustream_ssl *ssl, int error, const char *str)
{
struct uclient_http *uh = container_of(ssl, struct uclient_http, ussl);
+ struct uclient *uc = &uh->uc;
+ if (uc->cb->log_msg)
+ uc->cb->log_msg(uc, UCLIENT_LOG_SSL_ERROR, str);
uclient_http_error(uh, UCLIENT_ERROR_CONNECT);
}
static void uclient_ssl_notify_verify_error(struct ustream_ssl *ssl, int error, const char *str)
{
struct uclient_http *uh = container_of(ssl, struct uclient_http, ussl);
+ struct uclient *uc = &uh->uc;
if (!uh->ssl_require_validation)
return;
+ if (uc->cb->log_msg)
+ uc->cb->log_msg(uc, UCLIENT_LOG_SSL_VERIFY_ERROR, str);
uclient_http_error(uh, UCLIENT_ERROR_SSL_INVALID_CERT);
}
__UCLIENT_ERROR_MAX
};
+enum uclient_log_type {
+ UCLIENT_LOG_SSL_ERROR,
+ UCLIENT_LOG_SSL_VERIFY_ERROR,
+ __UCLIENT_LOG_MAX
+};
+
union uclient_addr {
struct sockaddr sa;
struct sockaddr_in sin;
void (*data_eof)(struct uclient *cl);
void (*header_done)(struct uclient *cl);
void (*error)(struct uclient *cl, int code);
+ void (*log_msg)(struct uclient *cl, enum uclient_log_type type, const char *msg);
};
struct uclient *uclient_new(const char *url, const char *auth_str, const struct uclient_cb *cb);