diff --git a/README.md b/README.md index e39700d39..bac0db318 100644 --- a/README.md +++ b/README.md @@ -169,7 +169,6 @@ legend: * [RFC 1321](https://tools.ietf.org/html/rfc1321) - The MD5 Message-Digest Algorithm * [RFC 1886](https://tools.ietf.org/html/rfc1886) - DNS Extensions to support IP version 6 -* [RFC 2032](https://tools.ietf.org/html/rfc2032) - RTP Payload Format for H.261 Video Streams * [RFC 2616](https://tools.ietf.org/html/rfc2616) - Hypertext Transfer Protocol -- HTTP/1.1 * [RFC 2617](https://tools.ietf.org/html/rfc2617) - HTTP Authentication: Basic and Digest Access Authentication * [RFC 2782](https://tools.ietf.org/html/rfc2782) - A DNS RR for Specifying the Location of Services (DNS SRV) diff --git a/include/re_http.h b/include/re_http.h index 3e8ed965d..322eb1abf 100644 --- a/include/re_http.h +++ b/include/re_http.h @@ -173,6 +173,7 @@ int http_client_set_keypem(struct http_cli *cli, const char *pem); int http_client_set_session_reuse(struct http_cli *cli, bool enabled); int http_client_set_tls_min_version(struct http_cli *cli, int version); int http_client_set_tls_max_version(struct http_cli *cli, int version); +int http_client_disable_verify_server(struct http_cli *cli); #endif /* Server */ diff --git a/src/dbg/dbg.c b/src/dbg/dbg.c index df3e74847..0e84cf3d2 100644 --- a/src/dbg/dbg.c +++ b/src/dbg/dbg.c @@ -91,8 +91,10 @@ void dbg_close(void) */ void dbg_handler_set(dbg_print_h *ph, void *arg) { + dbg_lock(); dbg.ph = ph; dbg.arg = arg; + dbg_unlock(); } @@ -151,27 +153,24 @@ static void dbg_vprintf(int level, const char *fmt, va_list ap) static void dbg_fmt_vprintf(int level, const char *fmt, va_list ap) { char buf[256]; - int len; dbg_lock(); + int dbg_level = dbg.level; + dbg_print_h *ph = dbg.ph; + void *arg = dbg.arg; + dbg_unlock(); - if (level > dbg.level) - goto out; - - if (!dbg.ph) - goto out; - - len = re_vsnprintf(buf, sizeof(buf), fmt, ap); - if (len <= 0) - goto out; + if (level > dbg_level) + return; /* Print handler? */ - if (dbg.ph) { - dbg.ph(level, buf, len, dbg.arg); - } + if (ph) { + int len = re_vsnprintf(buf, sizeof(buf), fmt, ap); + if (len <= 0) + return; - out: - dbg_unlock(); + ph(level, buf, len, arg); + } } diff --git a/src/http/client.c b/src/http/client.c index 87ebedfb7..58a1e9302 100644 --- a/src/http/client.c +++ b/src/http/client.c @@ -1227,7 +1227,25 @@ int http_client_set_tls_max_version(struct http_cli *cli, int version) return tls_set_max_proto_version(cli->tls, version); } -#endif + + +/** + * Disable TLS server certificate verification + * + * @param cli HTTP Client + * + * @return 0 if success, otherwise errorcode + */ +int http_client_disable_verify_server(struct http_cli *cli) +{ + if (!cli) + return EINVAL; + + tls_disable_verify_server(cli->tls); + + return 0; +} +#endif /* USE_TLS */ /**