Skip to content

Commit

Permalink
http/client: add setter to disable tls server verification (#1114)
Browse files Browse the repository at this point in the history
  • Loading branch information
maximilianfridrich authored Apr 30, 2024
1 parent 06ce16c commit 1b54c8a
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 @@ -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
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 1b54c8a

Please sign in to comment.