summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2012-01-25 16:08:09 +0200
committerTimo Teräs <timo.teras@iki.fi>2012-01-25 16:08:09 +0200
commitaf9e9e657a5a48dce624cf118abca85555969acf (patch)
tree38ffdfb5d00022fac47081b5dd4379d811224ecf /src
parentfa2a0367f26d5aca03fbfc360d987b49c816d9c4 (diff)
downloadsquark-af9e9e657a5a48dce624cf118abca85555969acf.tar.bz2
squark-af9e9e657a5a48dce624cf118abca85555969acf.tar.xz
filter: fix lookup of urls with path componentsv0.4.1
Diffstat (limited to 'src')
-rw-r--r--src/squark-filter.c15
1 files changed, 14 insertions, 1 deletions
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);