From af9e9e657a5a48dce624cf118abca85555969acf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Wed, 25 Jan 2012 16:08:09 +0200 Subject: filter: fix lookup of urls with path components --- src/squark-filter.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/squark-filter.c b/src/squark-filter.c index 6bd8c5d..c8e4f18 100644 --- a/src/squark-filter.c +++ b/src/squark-filter.c @@ -24,6 +24,12 @@ #include "filterdb.h" #include "authdb.h" +#if 0 +#define dbg_printf(x...) fprintf(stderr, x) +#else +#define dbg_printf(x...) +#endif + #define FILTER_OVERRIDE_TIMEOUT (15*60) static struct sqdb db; @@ -238,6 +244,8 @@ static int url_classify(struct url_info *url, struct sqdb *db) if (blob_is_null(got)) break; + dbg_printf("Trying '%.*s'\n", key.len, key.ptr); + previ = i; i = cmph_search_packed(cmph, key.ptr, key.len); if (!blob_is_null(tld)) { @@ -272,13 +280,18 @@ static int url_classify(struct url_info *url, struct sqdb *db) /* and then search for path matches -- construct hashing * string of url decoded path */ blob_push_urldecode(&keybuf, url->path); - key = keylimits = blob_pushed(BLOB_BUF(buffer), keybuf); + keylimits = blob_pushed(BLOB_BUF(buffer), keybuf); + + dbg_printf("Checking path components on '%.*s'\n", keylimits.len, keylimits.ptr); while (indx[i].has_paths) { /* add one more path component */ got = blob_expand_tail(&key, keylimits, '/'); if (blob_is_null(got)) break; + + dbg_printf("Trying with path '%.*s'\n", key.len, key.ptr); + previ = i; i = cmph_search_packed(cmph, key.ptr, key.len); tld = sqdb_get_string_literal(db, indx[i].component); -- cgit v1.2.3