]> source.dussan.org Git - rspamd.git/commitdiff
Fix URL unit test.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 5 Apr 2015 18:05:32 +0000 (19:05 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 5 Apr 2015 18:05:32 +0000 (19:05 +0100)
src/libserver/url.c
test/lua/unit/url.lua

index 629d9baa110b40b1a00f6716d7ca4666bdac0071..dff3ea1fc832d385f2bcf087dcbdc315f127d9b0 100644 (file)
@@ -904,7 +904,7 @@ rspamd_url_init (struct rspamd_config *cfg)
                url_scanner->tld_trie = rspamd_trie_create (TRUE);
                rspamd_url_add_static_matchers (url_scanner->matchers);
 
-               if (cfg->tld_file) {
+               if (cfg != NULL && cfg->tld_file) {
                        rspamd_url_parse_tld_file (cfg->tld_file, url_scanner);
                }
                else {
index 9f9643009468fb2373b15f7447ad233a69a716e4..dd6f4b7601cb5772dcdda3a17e5530dc48894733 100644 (file)
@@ -38,9 +38,11 @@ context("URL check functions", function()
   int form;  /* URI originated from form */
   int is_phished; /* URI maybe phishing */
   };
+  struct rspamd_config;
   struct rspamd_url* rspamd_url_get_next (void *pool,
     const char *start, char const **pos);
   void * rspamd_mempool_new (unsigned long size);
+  void rspamd_url_init (struct rspamd_config *cfg);
   ]]
   
   test("Extract urls from text", function()
@@ -52,6 +54,8 @@ context("URL check functions", function()
       {"http://user:password@тест2.РФ:18 text", {"тест2.рф", "user"}},
     }
     
+    ffi.C.rspamd_url_init(nil)
+    
     for _,c in ipairs(cases) do
       local res = ffi.C.rspamd_url_get_next(pool, c[1], nil)