Skip to content

Commit

Permalink
Merge branch 'main' into coverity
Browse files Browse the repository at this point in the history
  • Loading branch information
sreimers committed May 8, 2024
2 parents b4c5c12 + 01c4613 commit 201873a
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 17 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions include/re_http.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
29 changes: 14 additions & 15 deletions src/dbg/dbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}


Expand Down Expand Up @@ -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);
}
}


Expand Down
20 changes: 19 additions & 1 deletion src/http/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */


/**
Expand Down

0 comments on commit 201873a

Please sign in to comment.