[DNR] Rule condition to match on response headers
Categories
(WebExtensions :: Request Handling, enhancement, P3)
Tracking
(Not tracked)
People
(Reporter: robwu, Unassigned)
References
(Blocks 1 open bug)
Details
(Keywords: parity-chrome, Whiteboard: [wecg][addons-jira])
API design discussions on the shape of the API are still ongoing in https://github.com/w3c/webextensions/issues/460 , but it is clear that DNR will have an API to match requests by response header. This is a deviation from before: previously all matched rules could be determined at the start of the request, now rules also need to be evaluated at the onHeadersReceived stage.
Chromium is working on their implementation at https://bugs.chromium.org/p/chromium/issues/detail?id=1141166
Updated•2 years ago
|
Comment 1•1 year ago
|
||
Chrome's implementation is now available on Chrome Canary, so I'd say it's near-stable.
Comment 2•1 year ago
|
||
I opened this corresponding bug with webkit: https://bugs.webkit.org/show_bug.cgi?id=275158
Comment 3•1 year ago
|
||
It appears that the proposal at https://github.com/w3c/webextensions/issues/460 is now basically settled. According to https://github.com/w3c/webextensions/blob/main/_minutes/2024-06-20-wecg.md, "ways of matching substrings" was "the last major thing to resolve", and there a thought that "globs would offer the balance between functionality and performance". Subsequently, Rob noted in https://github.com/w3c/webextensions/issues/460#issuecomment-2198661058 "Since the expected number of header matching rules is low, I don't expect a significant performance impact with the use of globs for matching headers." Since then, globs were added to Chromium's in-progress implementation, and more recently, response header matching was enabled on stable: https://issues.chromium.org/issues/40727004#comment66.
Comment 4•1 year ago
|
||
This is now feature-complete in Chromium: https://issues.chromium.org/issues/40727004#comment69
You can find the internal documentation on the new HeaderInfo dictionary here:
The two new RuleCondition types are here, and they are optional arrays of HeaderInfo, named responseHeaders and excludedResponseHeaders: https://source.chromium.org/chromium/chromium/src/+/0e7b854de08540505da2688660ed40fe1dad990e:extensions/common/api/declarative_net_request.idl;l=363-371
Comment 5•1 year ago
|
||
Official docs: https://developer.chrome.com/docs/extensions/reference/api/declarativeNetRequest#type-HeaderInfo and https://developer.chrome.com/docs/extensions/reference/api/declarativeNetRequest#property-RuleCondition-excludedResponseHeaders and https://developer.chrome.com/docs/extensions/reference/api/declarativeNetRequest#property-RuleCondition-responseHeaders
Updated•1 year ago
|
Description
•