Commit 63526b1d authored by Kunihiko Sakamoto's avatar Kunihiko Sakamoto Committed by Commit Bot

Lower qvalue of application/signed-exchange in Accept header

Before this patch, "application/signed-exchange;v=b3" in Accept header
had the same q-value as "text/html". But if SXG and non-SXG version of a
resource are available, browser should prefer non-SXG because SXG adds
overhead.

This patch decreases the q-value of "application/signed-exchange;v=b3"
accept header value to 0.9, which is in the middle of "text/html" and
"*/*".

Bug: 1003704
Change-Id: I955e16093a601bbe5177d842128ddff405808cc3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1810120Reviewed-by: default avatarMatt Menke <mmenke@chromium.org>
Reviewed-by: default avatarDavid Benjamin <davidben@chromium.org>
Reviewed-by: default avatarTsuyoshi Horo <horo@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#702313}
parent b8058564
...@@ -44,7 +44,7 @@ IN_PROC_BROWSER_TEST_F(ChromeAcceptHeaderTest, Check) { ...@@ -44,7 +44,7 @@ IN_PROC_BROWSER_TEST_F(ChromeAcceptHeaderTest, Check) {
// navigation code path and behaves similarly to PDF loaded inside <iframe>. // navigation code path and behaves similarly to PDF loaded inside <iframe>.
ASSERT_EQ( ASSERT_EQ(
"text/html,application/xhtml+xml,application/xml;q=0.9,image/" "text/html,application/xhtml+xml,application/xml;q=0.9,image/"
"webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3", "webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
plugin_accept_header); plugin_accept_header);
} else { } else {
// This is for a sub-resource request. // This is for a sub-resource request.
......
...@@ -97,13 +97,13 @@ IN_PROC_BROWSER_TEST_F(AcceptHeaderTest, Check) { ...@@ -97,13 +97,13 @@ IN_PROC_BROWSER_TEST_F(AcceptHeaderTest, Check) {
// ResourceType::kMainFrame // ResourceType::kMainFrame
EXPECT_EQ( EXPECT_EQ(
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp," "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,"
"image/apng,*/*;q=0.8,application/signed-exchange;v=b3", "image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
GetFor("/accept-header.html")); GetFor("/accept-header.html"));
// ResourceType::kSubFrame // ResourceType::kSubFrame
EXPECT_EQ( EXPECT_EQ(
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp," "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,"
"image/apng,*/*;q=0.8,application/signed-exchange;v=b3", "image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
GetFor("/iframe.html")); GetFor("/iframe.html"));
// ResourceType::kStylesheet // ResourceType::kStylesheet
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
namespace content { namespace content {
constexpr char kAcceptHeaderSignedExchangeSuffix[] = constexpr char kAcceptHeaderSignedExchangeSuffix[] =
",application/signed-exchange;v=b3"; ",application/signed-exchange;v=b3;q=0.9";
enum class SignedExchangeVersion { kUnknown, kB3 }; enum class SignedExchangeVersion { kUnknown, kB3 };
......
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
PASS: The browser asks for XHTML. PASS: The browser asks for XHTML.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment