Skip to content
This repository has been archived by the owner. It is now read-only.

added check to prevent checking filter rules against non-blockable URLs #101

Merged
merged 2 commits into from May 15, 2018

Conversation

@pes10k
Copy link
Collaborator

pes10k commented May 12, 2018

Added isBlockableProtocol function in ad_block_client.h/cc and corresponding tests in test/matching_test.cc

Quick ignores URLs that don't start with one of the following (case insensitive, any of which can be prefix by blob:):

  • http://
  • https://
  • ws://
  • wss://
* - ws
* - wss
*/
bool isBlockableProtocol(const char *url, int urlLen) {

This comment has been minimized.

Copy link
@bbondy

bbondy May 14, 2018

Member

I think we should add a mini state machine for this to avoid the allocations. Similar to how the normal parsing works with keeping an enum for the current state and the current char that is being processed.

@pes10k
Copy link
Collaborator Author

pes10k commented May 15, 2018

@bbondy Okie dokie, i've reimplemented the protocol check to use a state machine style flow. It ended up being > 100 lines, so I moved it to its own file (protocol.h/cc), and changed the name of the test file to match (i.e. test/protocol_test.cc).

@pes10k pes10k force-pushed the pes10k:dont-check-invalid-protocols branch from 468f376 to 9ab10f4 May 15, 2018
…ine based design
@pes10k pes10k force-pushed the pes10k:dont-check-invalid-protocols branch from 9ab10f4 to 8c95910 May 15, 2018
@bbondy
bbondy approved these changes May 15, 2018
@bbondy
Copy link
Member

bbondy commented May 15, 2018

Thanks!

@bbondy bbondy merged commit 522fa53 into brave:master May 15, 2018
1 check failed
1 check failed
continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.