forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check Accept-CH filters before adding a client hint to the request
It was discovered that, when applying Critical-CH client hints, the critical client hints would only be filtered if they did not appear in the Accept-CH response header. However, we apply some filters to the Accept-CH response header before persisting the client hints in the Accept-CH cache. The filters currently are just features guarded by a feature flag, but in the future, we will also want Accept-CH values to be gated by the presence of an Origin Trial (see crbug.com/1226193 for an example). In crrev.com/c/2983659, the same Accept-CH filter was applied on Critical-CH as is applied when persisting client hints in the Accept-CH cache. This was intended as a temporary solution to fix the bug. However, it does not solve for the fact that the filtering logic on Accept-CH values happen in two places (when parsing and persisting the Accept-CH header and when processing the Critical-CH values). This CL unifies the logic of filtering Accept-CH values in one place. Instead of filtering Accept-CH values when persisting the hints in the Accept-CH cache, we persist the Accept-CH hints as given to us in the response header. Only when adding the client hints to the request header do we check for any Accept-CH values that must be filtered before adding to the request header. We use the same logic to also determine if the value(s) in the Critical-CH header should cause a resend of the request with the critical client hints in the request header. Bug: 1231630 Change-Id: Iede700094bb2d6c1d10b1a601d52e2860dd9ae08 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3048882 Commit-Queue: Ali Beyad <abeyad@chromium.org> Reviewed-by: Matt Falkenhagen <falken@chromium.org> Reviewed-by: Bo <boliu@chromium.org> Reviewed-by: Aaron Tagliaboschi <aarontag@chromium.org> Reviewed-by: Justin Novosad <junov@chromium.org> Cr-Commit-Position: refs/heads/master@{#905962}
- Loading branch information
Showing
51 changed files
with
427 additions
and
287 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<html> | ||
<link rel="icon" href="data:;base64,="> | ||
<head></head> | ||
Empty file which uses link-rel to disable favicon fetches. The corresponding | ||
.mock-http-headers sets client hints. | ||
</html> |
4 changes: 4 additions & 0 deletions
4
chrome/test/data/client_hints/critical_ch_lang.html.mock-http-headers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
HTTP/1.1 200 OK | ||
Accept-CH: lang,sec-ch-ua-full-version | ||
Accept-CH-Lifetime: 3600 | ||
Critical-CH: lang |
6 changes: 6 additions & 0 deletions
6
chrome/test/data/client_hints/critical_ch_ua_full_version.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<html> | ||
<link rel="icon" href="data:;base64,="> | ||
<head></head> | ||
Empty file which uses link-rel to disable favicon fetches. The corresponding | ||
.mock-http-headers sets client hints. | ||
</html> |
4 changes: 4 additions & 0 deletions
4
chrome/test/data/client_hints/critical_ch_ua_full_version.html.mock-http-headers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
HTTP/1.1 200 OK | ||
Accept-CH: lang,sec-ch-ua-full-version | ||
Accept-CH-Lifetime: 3600 | ||
Critical-CH: sec-ch-ua-full-version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
include_rules = [ | ||
"+services/network/public/cpp/is_potentially_trustworthy.h", | ||
"+third_party/blink/public/platform", | ||
"+third_party/blink/public/common/client_hints/enabled_client_hints.h", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.