]> source.dussan.org Git - rspamd.git/commitdiff
Do not rewrite the original url when using redirector
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 16 Nov 2015 13:06:05 +0000 (13:06 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 16 Nov 2015 13:06:05 +0000 (13:06 +0000)
src/plugins/surbl.c

index ca0986a71311e3641cde189e470ee4ea3ba9cab5..f3f09c29b0bbcec247e955b24a893e91db785f0d 100644 (file)
@@ -985,6 +985,7 @@ surbl_redirector_finish (struct rspamd_http_connection *conn,
        struct redirector_param *param = (struct redirector_param *)conn->ud;
        struct rspamd_task *task;
        gint r, urllen;
+       struct rspamd_url *redirected_url;
        const rspamd_ftok_t *hdr;
        gchar *urlstr;
 
@@ -1001,19 +1002,24 @@ surbl_redirector_finish (struct rspamd_http_connection *conn,
                                        struri (param->url),
                                        hdr);
                        urllen = hdr->len;
-                       urlstr = rspamd_mempool_alloc (param->task->task_pool,
+                       urlstr = rspamd_mempool_alloc (task->task_pool,
                                        urllen + 1);
+                       redirected_url = rspamd_mempool_alloc (task->task_pool,
+                                       sizeof (*redirected_url));
                        rspamd_strlcpy (urlstr, hdr->begin, urllen + 1);
-                       r = rspamd_url_parse (param->url, urlstr, urllen,
-                                       param->task->task_pool);
+                       r = rspamd_url_parse (redirected_url, urlstr, urllen,
+                                       task->task_pool);
 
                        if (r == URI_ERRNO_OK) {
-                               make_surbl_requests (param->url,
+                               make_surbl_requests (redirected_url,
                                                param->task,
                                                param->suffix,
                                                FALSE,
                                                param->tree);
                        }
+                       else {
+                               msg_info_task ("cannot parse redirector reply: %s", urlstr);
+                       }
                }
        }
        else {