[epiphany/gnome-3-18] EphyUriTester: Ensure "||" rules are anchored at the start
- From: Emanuele Aina <emaaa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/gnome-3-18] EphyUriTester: Ensure "||" rules are anchored at the start
- Date: Tue, 10 Nov 2015 10:24:28 +0000 (UTC)
commit fd7de6057011fb59d0c0ddd108e2104f2d2016a8
Author: Emanuele Aina <emanuele aina collabora com>
Date: Mon Nov 9 17:10:45 2015 +0000
EphyUriTester: Ensure "||" rules are anchored at the start
Filter rules beginning with "||" mean that the following expression must
match (at least partially) the domain.
This means that "||example.com/foo" should match "foo.example.com/foo"
but not "fooexample.com/foo" nor
"example.com/bar?redir=example.com/foo" while the current code will
happily match all of them.
https://bugzilla.gnome.org/show_bug.cgi?id=754954
embed/web-extension/uri-tester.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/embed/web-extension/uri-tester.c b/embed/web-extension/uri-tester.c
index 1915651..aa6b58c 100644
--- a/embed/web-extension/uri-tester.c
+++ b/embed/web-extension/uri-tester.c
@@ -696,7 +696,10 @@ uri_tester_parse_line (UriTester *tester, char *line)
{
(void)*line++;
(void)*line++;
- uri_tester_add_url_pattern (tester, "", "fulluri", line);
+ /* set a regex prefix to ensure that '||' patterns are anchored at the
+ * start and that any characters (if any) preceding the domain specified
+ * by the rule is separated from it by a dot '.' */
+ uri_tester_add_url_pattern (tester, "^[\\w\\-]+:\\/+(?!\\/)(?:[^\\/]+\\.)?", "fulluri", line);
return;
}
if (line[0] == '|')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]