Skip to content

Commit

Permalink
http/client: add setter to disable tls server verification
Browse files Browse the repository at this point in the history
  • Loading branch information
maximilianfridrich committed Apr 29, 2024
1 parent b5da6fc commit f8f0314
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/re_http.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ void http_client_set_laddr(struct http_cli *cli, const struct sa *addr);
void http_client_set_laddr6(struct http_cli *cli, const struct sa *addr);
void http_client_set_bufsize_max(struct http_cli *cli, size_t max_size);
size_t http_client_get_bufsize_max(struct http_cli *cli);
int http_client_disable_verify_server(struct http_cli *cli);

#ifdef USE_TLS
int http_client_set_tls(struct http_cli *cli, struct tls *tls);
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 f8f0314

Please sign in to comment.