Skip to content

Commit

Permalink
Pull request #577: AG-24033 Fix matching result caching
Browse files Browse the repository at this point in the history
Merge in ADGUARD-FILTERS/tsurlfilter from fix/AG-24033 to master

Squashed commit of the following:

commit 096866d
Author: Vladimir Zhelvis <v.zhelvis@adguard.com>
Date:   Wed Jul 12 22:18:33 2023 +0300

    update version and changelog

commit 8fd2160
Author: Vladimir Zhelvis <v.zhelvis@adguard.com>
Date:   Wed Jul 12 22:10:41 2023 +0300

    add method to request cache key
  • Loading branch information
zhelvis committed Jul 13, 2023
1 parent b356680 commit 9e5cada
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/tsurlfilter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
<!-- TODO: manually add compare links for version to the end of the file -->
<!-- e.g. [1.0.77]: https://github.com/AdguardTeam/tsurlfilter/compare/tsurlfilter-v1.0.76...tsurlfilter-v1.0.77 -->

## Unreleased
## [2.1.4] - 2023-07-13

### Added
- Support for $csp modifier in the MV3 converter.
Expand All @@ -18,6 +18,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Converting rules in MV3 with these modifiers `$elemhide`, `$specifichide`
and `$generichide` now does not cause any errors and is simply skipped.

### Fixed
- Matching result caching for rules with `$method` modifier


## [2.1.3] - 2023-06-26

### Added
Expand Down
2 changes: 1 addition & 1 deletion packages/tsurlfilter/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@adguard/tsurlfilter",
"version": "2.1.3",
"version": "2.1.4",
"description": "This is a TypeScript library that implements AdGuard's content blocking rules",
"main": "dist/es/index.js",
"module": "dist/es/index.js",
Expand Down
4 changes: 4 additions & 0 deletions packages/tsurlfilter/src/engine/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ export class Engine {
matchRequest(request: Request, frameRule: NetworkRule | null = null): MatchingResult {
let cacheKey = `${request.url}#${request.sourceHostname}#${request.requestType}`;

if (request.method) {
cacheKey += `#${request.method}`;
}

/**
* Add frame url text to the key to avoid caching,
* because allowlist rules are not stored in the engine
Expand Down

0 comments on commit 9e5cada

Please sign in to comment.