callback = function(task)
local rspamd_re = require "rspamd_regexp"
local hash = require "rspamd_cryptobox_hash"
- local rspamd_logger = require "rspamd_logger"
if task:has_symbol('LEAKED_PASSWORD_SCAM') then
-- Perform BTC wallet check (quite expensive)
#define RSPAMD_LUA_HTTP_FLAG_NOVERIFY (1 << 1)
#define RSPAMD_LUA_HTTP_FLAG_RESOLVED (1 << 2)
#define RSPAMD_LUA_HTTP_FLAG_KEEP_ALIVE (1 << 3)
+#define RSPAMD_LUA_HTTP_FLAG_YIELDED (1 << 4)
struct lua_http_cbdata {
struct rspamd_http_connection *conn;
{
struct lua_http_cbdata *cbd = (struct lua_http_cbdata *)conn->ud;
if (cbd->cbref == -1) {
- lua_http_resume_handler (conn, NULL, err->message);
+ if (cbd->flags & RSPAMD_LUA_HTTP_FLAG_YIELDED) {
+ cbd->flags &= ~RSPAMD_LUA_HTTP_FLAG_YIELDED;
+ lua_http_resume_handler (conn, NULL, err->message);
+ }
+ else {
+ /* TODO: kill me please */
+ msg_info ("lost HTTP error in coroutines mess: %s", err->message);
+ }
}
else {
lua_http_push_error (cbd, err->message);
lua_State *L;
if (cbd->cbref == -1) {
- lua_http_resume_handler (conn, msg, NULL);
+ if (cbd->flags & RSPAMD_LUA_HTTP_FLAG_YIELDED) {
+ cbd->flags &= ~RSPAMD_LUA_HTTP_FLAG_YIELDED;
+ lua_http_resume_handler (conn, msg, NULL);
+ }
+ else {
+ /* TODO: kill me please */
+ msg_err ("lost HTTP data in coroutines mess");
+ }
+
REF_RELEASE (cbd);
return 0;
if (cbd->cbref == -1) {
cbd->thread = lua_thread_pool_get_running_entry (cfg->lua_thread_pool);
+ cbd->flags |= RSPAMD_LUA_HTTP_FLAG_YIELDED;
return lua_thread_yield (cbd->thread, 0);
}