* Updated patches for v79 Remaining issue: * blank tabs when running on x86 emulators Waiting on upstream to fix that. The other upstream storage bug (https://bugs.chromium.org/p/chromium/issues/detail?id=1033655) is fixed in this version.
103 lines
4.3 KiB
Diff
103 lines
4.3 KiB
Diff
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
|
Date: Sat, 28 Apr 2018 08:30:26 +0200
|
|
Subject: Reduce HTTP headers in DoH requests to bare minimum
|
|
|
|
Serve DoH requests with maximum priority.
|
|
---
|
|
net/base/load_flags_list.h | 6 ++++++
|
|
net/dns/dns_transaction.cc | 3 ++-
|
|
net/url_request/url_request_http_job.cc | 16 +++++++++++-----
|
|
3 files changed, 19 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/net/base/load_flags_list.h b/net/base/load_flags_list.h
|
|
--- a/net/base/load_flags_list.h
|
|
+++ b/net/base/load_flags_list.h
|
|
@@ -106,6 +106,12 @@ LOAD_FLAG(SUPPORT_ASYNC_REVALIDATION, 1 << 16)
|
|
// the LOAD_CAN_USE_RESTRICTED_PREFETCH load flag.
|
|
LOAD_FLAG(RESTRICTED_PREFETCH, 1 << 17)
|
|
|
|
+// This load will not send Accept-Language or User-Agent headers, and not
|
|
+// advertise brotli encoding.
|
|
+// Used to comply with IETF (draft) DNS-over-HTTPS:
|
|
+// "Implementors SHOULD NOT set non-essential HTTP headers in DoH client requests."
|
|
+LOAD_FLAG(MINIMAL_HEADERS, 1 << 18)
|
|
+
|
|
// This flag must be set on requests that are allowed to reuse cache entries
|
|
// that are marked as RESTRICTED_PREFETCH. Requests without this flag cannot
|
|
// reuse restricted prefetch responses in the cache. Restricted response reuse
|
|
diff --git a/net/dns/dns_transaction.cc b/net/dns/dns_transaction.cc
|
|
--- a/net/dns/dns_transaction.cc
|
|
+++ b/net/dns/dns_transaction.cc
|
|
@@ -403,6 +403,7 @@ class DnsHTTPAttempt : public DnsAttempt, public URLRequest::Delegate {
|
|
// perspective to prevent the client from sending AIA requests).
|
|
request_->SetLoadFlags(request_->load_flags() | LOAD_DISABLE_CACHE |
|
|
LOAD_BYPASS_PROXY |
|
|
+ LOAD_IGNORE_LIMITS | LOAD_MINIMAL_HEADERS |
|
|
LOAD_DISABLE_CERT_NETWORK_FETCHES);
|
|
request_->set_allow_credentials(false);
|
|
}
|
|
@@ -1004,7 +1005,7 @@ class DnsTransactionImpl : public DnsTransaction,
|
|
had_tcp_attempt_(false),
|
|
first_server_index_(0),
|
|
url_request_context_(url_request_context),
|
|
- request_priority_(DEFAULT_PRIORITY) {
|
|
+ request_priority_(MAXIMUM_PRIORITY) {
|
|
DCHECK(session_.get());
|
|
DCHECK(!hostname_.empty());
|
|
DCHECK(!callback_.is_null());
|
|
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
|
|
--- a/net/url_request/url_request_http_job.cc
|
|
+++ b/net/url_request/url_request_http_job.cc
|
|
@@ -354,6 +354,7 @@ void URLRequestHttpJob::Start() {
|
|
// plugin could set a referrer although sending the referrer is inhibited.
|
|
request_info_.extra_headers.RemoveHeader(HttpRequestHeaders::kReferer);
|
|
|
|
+ if (!(request_info_.load_flags & LOAD_MINIMAL_HEADERS)) {
|
|
// Our consumer should have made sure that this is a safe referrer. See for
|
|
// instance WebCore::FrameLoader::HideReferrer.
|
|
if (referrer.is_valid()) {
|
|
@@ -369,11 +370,14 @@ void URLRequestHttpJob::Start() {
|
|
request_info_.extra_headers.SetHeader(HttpRequestHeaders::kReferer,
|
|
referer_value);
|
|
}
|
|
+ }
|
|
|
|
+ if (!(request_info_.load_flags & LOAD_MINIMAL_HEADERS)) {
|
|
request_info_.extra_headers.SetHeaderIfMissing(
|
|
HttpRequestHeaders::kUserAgent,
|
|
http_user_agent_settings_ ?
|
|
http_user_agent_settings_->GetUserAgent() : std::string());
|
|
+ }
|
|
|
|
AddExtraHeaders();
|
|
AddCookieHeaderAndStart();
|
|
@@ -588,10 +592,12 @@ void URLRequestHttpJob::AddExtraHeaders() {
|
|
} else {
|
|
// Advertise "br" encoding only if transferred data is opaque to proxy.
|
|
bool advertise_brotli = false;
|
|
- if (request()->context()->enable_brotli()) {
|
|
- if (request()->url().SchemeIsCryptographic() ||
|
|
- IsLocalhost(request()->url())) {
|
|
- advertise_brotli = true;
|
|
+ if (!(request_info_.load_flags & LOAD_MINIMAL_HEADERS)) {
|
|
+ if (request()->context()->enable_brotli()) {
|
|
+ if (request()->url().SchemeIsCryptographic() ||
|
|
+ IsLocalhost(request()->url())) {
|
|
+ advertise_brotli = true;
|
|
+ }
|
|
}
|
|
}
|
|
|
|
@@ -609,7 +615,7 @@ void URLRequestHttpJob::AddExtraHeaders() {
|
|
}
|
|
}
|
|
|
|
- if (http_user_agent_settings_) {
|
|
+ if (!(request_info_.load_flags & LOAD_MINIMAL_HEADERS) && http_user_agent_settings_) {
|
|
// Only add default Accept-Language if the request didn't have it
|
|
// specified.
|
|
std::string accept_language =
|
|
--
|
|
2.17.1
|
|
|