aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libserver/html.c4
-rw-r--r--src/libserver/html.h1
-rw-r--r--src/lua/lua_html.c9
-rw-r--r--src/plugins/surbl.c13
4 files changed, 18 insertions, 9 deletions
diff --git a/src/libserver/html.c b/src/libserver/html.c
index 9e73b6f3e..ff745f80d 100644
--- a/src/libserver/html.c
+++ b/src/libserver/html.c
@@ -1512,6 +1512,10 @@ rspamd_html_process_img_tag (rspamd_mempool_t *pool, struct html_tag *tag,
}
else {
img->flags |= RSPAMD_HTML_FLAG_IMAGE_EXTERNAL;
+ if (img->src) {
+ img->url = rspamd_html_process_url (pool,
+ img->src, fstr.len, NULL);
+ }
}
}
else if (comp->type == RSPAMD_HTML_COMPONENT_HEIGHT) {
diff --git a/src/libserver/html.h b/src/libserver/html.h
index c7534d309..c5a989f0e 100644
--- a/src/libserver/html.h
+++ b/src/libserver/html.h
@@ -48,6 +48,7 @@ struct html_image {
guint width;
guint flags;
gchar *src;
+ struct rspamd_url *url;
struct html_tag *tag;
};
diff --git a/src/lua/lua_html.c b/src/lua/lua_html.c
index 95072fe6c..47b8c7dfd 100644
--- a/src/lua/lua_html.c
+++ b/src/lua/lua_html.c
@@ -260,6 +260,7 @@ lua_html_push_image (lua_State *L, struct html_image *img)
{
LUA_TRACE_POINT;
struct html_tag **ptag;
+ struct rspamd_url **purl;
lua_newtable (L);
@@ -269,6 +270,14 @@ lua_html_push_image (lua_State *L, struct html_image *img)
lua_settable (L, -3);
}
+ if (img->url) {
+ lua_pushstring (L, "url");
+ purl = lua_newuserdata (L, sizeof (gpointer));
+ *purl = img->url;
+ rspamd_lua_setclass (L, "rspamd{url}", -1);
+ lua_settable (L, -3);
+ }
+
if (img->tag) {
lua_pushstring (L, "tag");
ptag = lua_newuserdata (L, sizeof (gpointer));
diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c
index 465edecf4..c27e5c858 100644
--- a/src/plugins/surbl.c
+++ b/src/plugins/surbl.c
@@ -1906,15 +1906,10 @@ surbl_test_url (struct rspamd_task *task, void *user_data)
img = g_ptr_array_index (part->html->images, j);
if ((img->flags & RSPAMD_HTML_FLAG_IMAGE_EXTERNAL)
- && img->src) {
- url = rspamd_html_process_url (task->task_pool,
- img->src, strlen (img->src), NULL);
-
- if (url) {
- surbl_tree_url_callback (url, url, param);
- msg_debug_surbl ("checked image url %s over %s",
- img->src, suffix->suffix);
- }
+ && img->url) {
+ surbl_tree_url_callback (img->url, img->url, param);
+ msg_debug_surbl ("checked image url %s over %s",
+ img->src, suffix->suffix);
}
}
}