diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-04-05 19:05:32 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-04-05 19:05:32 +0100 |
commit | 065d4b113a567567c4c93056d2c04abe877d8f71 (patch) | |
tree | f7ffa79fd30792136a779115ea6f1ca28a2458de | |
parent | a9cca486d560a4d2741a86e2ea53298658af1aac (diff) | |
download | rspamd-065d4b113a567567c4c93056d2c04abe877d8f71.tar.gz rspamd-065d4b113a567567c4c93056d2c04abe877d8f71.zip |
Fix URL unit test.
-rw-r--r-- | src/libserver/url.c | 2 | ||||
-rw-r--r-- | test/lua/unit/url.lua | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/libserver/url.c b/src/libserver/url.c index 629d9baa1..dff3ea1fc 100644 --- a/src/libserver/url.c +++ b/src/libserver/url.c @@ -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 { diff --git a/test/lua/unit/url.lua b/test/lua/unit/url.lua index 9f9643009..dd6f4b760 100644 --- a/test/lua/unit/url.lua +++ b/test/lua/unit/url.lua @@ -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) |