Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Sec-CH-UA-Reduced client hint header when Origin Trial token present
In this CL, we add logic to parse and accept the Sec-CH-UA-Reduced client hint in the Accept-CH header and and only send the Sec-CH-UA-Reduced client hint only in the presence of a valid UserAgentReduction Origin Trial token. If the Origin Trial token is present and valid, and the origin contains Sec-CH-UA-Reduced in the Accept-CH cache, then on all subsequent requests to the origin, the Sec-CH-UA-Reduced request header will be set with a value of "?1" (sh-boolean). If the Accept-CH cache does not contain Sec-CH-UA-Reduced, or the Origin Trial token is not valid, then Sec-CH-UA-Reduced will not be sent in the request headers. NB: A subsequent CL will change the User-Agent request header to the reduced UA string if the Sec-CH-UA-Reduced header is sent. Chrome Platform Status: https://chromestatus.com/feature/5704553745874944 Design Doc: https://docs.google.com/document/d/1feIxK9S7oNgT2oGGebbxE9X0O-4wTKcsP_gRaY99tq4 Bug: 1222742 Change-Id: If855d4bb393540d49de3be80aa9bc7c80f861c50 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3042810 Commit-Queue: Ali Beyad <abeyad@chromium.org> Reviewed-by: Aaron Tagliaboschi <aarontag@chromium.org> Reviewed-by: Robert Kroeger <rjkroege@chromium.org> Reviewed-by: Mike West <mkwst@chromium.org> Cr-Commit-Position: refs/heads/master@{#906810}
- Loading branch information
Showing
23 changed files
with
556 additions
and
124 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
5 changes: 5 additions & 0 deletions
5
chrome/test/data/client_hints/accept_ch_ua_reduced_missing_valid_origin_trial.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,5 @@ | ||
<html> | ||
<link rel="icon" href="data:;base64,="> | ||
<head></head> | ||
The Origin Trial token is valid, but the Sec-CH-UA-Reduced header is not present. | ||
</html> |
3 changes: 3 additions & 0 deletions
3
.../data/client_hints/accept_ch_ua_reduced_missing_valid_origin_trial.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,3 @@ | ||
HTTP/1.1 200 OK | ||
Accept-CH: sec-ch-ua-full-version | ||
Origin-Trial: A93QtcQ0CRKf5ioPasUwNbweXQWgbI4ZEshiz+YS7dkQEWVfW9Ua2pTnA866sZwRzuElkPwsUdGdIaW0fRUP8AwAAABceyJvcmlnaW4iOiAiaHR0cHM6Ly8xMjcuMC4wLjE6NDQ0NDQiLCAiZmVhdHVyZSI6ICJVc2VyQWdlbnRSZWR1Y3Rpb24iLCAiZXhwaXJ5IjogMjAwMDAwMDAwMH0= |
7 changes: 7 additions & 0 deletions
7
chrome/test/data/client_hints/accept_ch_ua_reduced_with_invalid_origin_trial.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,7 @@ | ||
<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. The Origin Trial token in the headers | ||
file is a corruption of the valid Origin Trial token. | ||
</html> |
3 changes: 3 additions & 0 deletions
3
...t/data/client_hints/accept_ch_ua_reduced_with_invalid_origin_trial.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,3 @@ | ||
HTTP/1.1 200 OK | ||
Accept-CH: sec-ch-ua-full-version,sec-ch-ua-reduced | ||
Origin-Trial: A23QtcQ0CRKf5ioPasUwNbweXQWgbI4ZEshiz+YS7dkQEWVfW9Ua2pTnA866sZwRzuElkPwsUdGdIaW0fRUP8AwAAABceyJvcmlnbW4iOiAiaHR0cHM6Ly8xMjcuMC4wLjE6NDQ0NDQiLCAiZmVhdHVyZSI6ICJVc2VyQWdlbnRSZWR1Y3Rpb24iLCAiZXhwaXJ5IjogMjAwMDAwMDAwMH0= |
8 changes: 8 additions & 0 deletions
8
chrome/test/data/client_hints/accept_ch_ua_reduced_with_no_origin_trial.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,8 @@ | ||
<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. The Origin Trial token in the headers | ||
file is missing, even though the Sec-CH-UA-Reduced client hint is present in | ||
the Accept-CH header. | ||
</html> |
2 changes: 2 additions & 0 deletions
2
...e/test/data/client_hints/accept_ch_ua_reduced_with_no_origin_trial.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,2 @@ | ||
HTTP/1.1 200 OK | ||
Accept-CH: sec-ch-ua-full-version,sec-ch-ua-reduced |
8 changes: 8 additions & 0 deletions
8
chrome/test/data/client_hints/accept_ch_ua_reduced_with_valid_origin_trial.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,8 @@ | ||
<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. The Origin Trial token was generated by | ||
running (in tools/origin_trials): | ||
generate_token.py https://127.0.0.1:44444 UserAgentReduction --expire-timestamp=2000000000 | ||
</html> |
3 changes: 3 additions & 0 deletions
3
...est/data/client_hints/accept_ch_ua_reduced_with_valid_origin_trial.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,3 @@ | ||
HTTP/1.1 200 OK | ||
Accept-CH: sec-ch-ua-full-version,sec-ch-ua-reduced | ||
Origin-Trial: A93QtcQ0CRKf5ioPasUwNbweXQWgbI4ZEshiz+YS7dkQEWVfW9Ua2pTnA866sZwRzuElkPwsUdGdIaW0fRUP8AwAAABceyJvcmlnaW4iOiAiaHR0cHM6Ly8xMjcuMC4wLjE6NDQ0NDQiLCAiZmVhdHVyZSI6ICJVc2VyQWdlbnRSZWR1Y3Rpb24iLCAiZXhwaXJ5IjogMjAwMDAwMDAwMH0= |
7 changes: 7 additions & 0 deletions
7
chrome/test/data/client_hints/critical_ch_ua_reduced_with_invalid_origin_trial.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,7 @@ | ||
<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. The Origin Trial token is a corrupted | ||
version of the original. | ||
</html> |
4 changes: 4 additions & 0 deletions
4
...data/client_hints/critical_ch_ua_reduced_with_invalid_origin_trial.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: sec-ch-ua-full-version,sec-ch-ua-reduced | ||
Critical-CH: sec-ch-ua-reduced | ||
Origin-Trial: A23QtcQ0CRKf5ioPasUwNbweXQWgbI4ZEshiz+YS7dkQEWVfW9Ua2pTnA866sZwRzsElkPwsUdGdIaW0fRUP8AwAAABceyJvcmlnaW4iOiAiaHR0cHM6Ly8xMjcuMC4wLjE6NDQ0NDQiLCAiZmVhdHVyZSI6ICJVc2VyQWdlbnRSZWR1Y3Rpb24iLCAiZXhwaXJ5IjogMjAwMDAwMDAwMH0= |
8 changes: 8 additions & 0 deletions
8
chrome/test/data/client_hints/critical_ch_ua_reduced_with_valid_origin_trial.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,8 @@ | ||
<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. The Origin Trial token was generated by | ||
running (in tools/origin_trials): | ||
generate_token.py https://127.0.0.1:44444 UserAgentReduction --expire-timestamp=2000000000 | ||
</html> |
4 changes: 4 additions & 0 deletions
4
...t/data/client_hints/critical_ch_ua_reduced_with_valid_origin_trial.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: sec-ch-ua-full-version,sec-ch-ua-reduced | ||
Critical-CH: sec-ch-ua-reduced | ||
Origin-Trial: A93QtcQ0CRKf5ioPasUwNbweXQWgbI4ZEshiz+YS7dkQEWVfW9Ua2pTnA866sZwRzuElkPwsUdGdIaW0fRUP8AwAAABceyJvcmlnaW4iOiAiaHR0cHM6Ly8xMjcuMC4wLjE6NDQ0NDQiLCAiZmVhdHVyZSI6ICJVc2VyQWdlbnRSZWR1Y3Rpb24iLCAiZXhwaXJ5IjogMjAwMDAwMDAwMH0= |
Oops, something went wrong.