diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-06-02 20:50:48 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-06-02 20:55:10 +0100 |
commit | 1d3c9379b9044a59e3db06697f9967ba88137a1d (patch) | |
tree | baa9cfff3b9b8cdde0a9ed28084052e12e02c7b1 /src/lua/lua_parsers.c | |
parent | 141617dab47bf741af4578c656d4cda5f18742ed (diff) | |
download | rspamd-1d3c9379b9044a59e3db06697f9967ba88137a1d.tar.gz rspamd-1d3c9379b9044a59e3db06697f9967ba88137a1d.zip |
[Rework] Html: Deal with the utf_content part
Diffstat (limited to 'src/lua/lua_parsers.c')
-rw-r--r-- | src/lua/lua_parsers.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/lua/lua_parsers.c b/src/lua/lua_parsers.c index a0c2f264d..6c75d8039 100644 --- a/src/lua/lua_parsers.c +++ b/src/lua/lua_parsers.c @@ -206,9 +206,9 @@ lua_parsers_parse_html (lua_State *L) struct rspamd_lua_text *t; const gchar *start = NULL; gsize len; - GByteArray *res, *in; + GByteArray *in; rspamd_mempool_t *pool; - struct html_content *hc; + void *hc; if (lua_type (L, 1) == LUA_TUSERDATA) { t = lua_check_text (L, 1); @@ -224,19 +224,15 @@ lua_parsers_parse_html (lua_State *L) if (start != NULL) { pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL, 0); - hc = rspamd_mempool_alloc0 (pool, sizeof (*hc)); in = g_byte_array_sized_new (len); g_byte_array_append (in, start, len); - res = rspamd_html_process_part (pool, hc, in); + hc = rspamd_html_process_part(pool, in); - t = lua_newuserdata (L, sizeof (*t)); - rspamd_lua_setclass (L, "rspamd{text}", -1); - t->start = res->data; - t->len = res->len; - t->flags = RSPAMD_TEXT_FLAG_OWN; + rspamd_ftok_t res; + rspamd_html_get_parsed_content(hc, &res); + lua_new_text(L, res.begin, res.len, TRUE); - g_byte_array_free (res, FALSE); g_byte_array_free (in, TRUE); rspamd_mempool_delete (pool); } |