Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimisations and `document` request and rule handling fixes #35

Merged
merged 10 commits into from Jun 28, 2019

disables full regex handling by default in Node version

  • Loading branch information
AndriusA committed Jun 18, 2019
commit 0da75f089aee1ed01780492c8e98db2dc5cc6c0b
@@ -66,6 +66,7 @@ name = "bench_rules"
harness = false

[features]

default = ["full-regex-handling"]
full-domain-matching = [] # feature has no explicit dependencies
metrics = []
full-regex-handling = []
@@ -16,7 +16,7 @@ neon-build = "0.2.0"
[dependencies]
neon-serde = "0.1.1"
serde = { version = "1.0", features = ["derive", "rc"] }
adblock = { path = "../" }
adblock = { path = "../", default-features = false }
neon = "0.2.0"

[patch.crates-io]
@@ -25,6 +25,7 @@ pub enum FilterError {
EmptyRedirection,
UnrecognisedOption,
NoRegex,
FullRegexUnsupported,
RegexParsingError(regex::Error),
PunycodeError,
}
@@ -398,8 +399,15 @@ impl NetworkFilter {
if line[filter_index_start..filter_index_end].starts_with('/')
&& line[filter_index_start..filter_index_end].ends_with('/')
{
// return Err(FilterError::NoRegex);
mask.set(NetworkFilterMask::IS_COMPLETE_REGEX, true);
#[cfg(feature = "full-regex-handling")]
{
mask.set(NetworkFilterMask::IS_COMPLETE_REGEX, true);
}

#[cfg(not(feature = "full-regex-handling"))]
{
return Err(FilterError::FullRegexUnsupported);
}
}

if mask.contains(NetworkFilterMask::IS_HOSTNAME_ANCHOR) {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.