diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-02-03 14:59:45 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-02-03 14:59:45 +0000 |
commit | 78e0800beb28669360e37d78de06abf31df9dcac (patch) | |
tree | b603504c5a0bca50225f98353f6c11a158789732 /src/lua | |
parent | c0e76d49b5133638cee11846a1fc79d8929c865a (diff) | |
download | rspamd-78e0800beb28669360e37d78de06abf31df9dcac.tar.gz rspamd-78e0800beb28669360e37d78de06abf31df9dcac.zip |
[Minor] Allow to disable ssl verification if needed
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_http.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/lua/lua_http.c b/src/lua/lua_http.c index 2213d8aae..4952f3404 100644 --- a/src/lua/lua_http.c +++ b/src/lua/lua_http.c @@ -56,6 +56,7 @@ static const struct luaL_reg httplib_m[] = { }; #define RSPAMD_LUA_HTTP_FLAG_TEXT (1 << 0) +#define RSPAMD_LUA_HTTP_FLAG_NOVERIFY (1 << 0) struct lua_http_cbdata { lua_State *L; @@ -260,6 +261,10 @@ lua_http_make_connection (struct lua_http_cbdata *cbd) rspamd_http_message_set_peer_key (cbd->msg, cbd->peer_pk); } + if (cbd->flags & RSPAMD_LUA_HTTP_FLAG_NOVERIFY) { + cbd->msg->flags |= RSPAMD_HTTP_FLAG_SSL_NOVERIFY; + } + rspamd_http_connection_write_message (cbd->conn, cbd->msg, cbd->host, cbd->mime_type, cbd, fd, &cbd->tv, cbd->ev_base); @@ -548,6 +553,15 @@ lua_http_request (lua_State *L) } lua_pop (L, 1); + + lua_pushstring (L, "no_ssl_verify"); + lua_gettable (L, 1); + + if (!!lua_toboolean (L, -1)) { + flags |= RSPAMD_LUA_HTTP_FLAG_NOVERIFY; + } + + lua_pop (L, 1); } else { msg_err ("http request has bad params"); |