зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1243586 - Implement Upgrade-Insecure-Requests HTTP Request Header Field (r=rbarnes)
This commit is contained in:
Родитель
68b656f551
Коммит
a863521d73
|
@ -315,6 +315,21 @@ nsHttpChannel::Connect()
|
|||
|
||||
LOG(("nsHttpChannel::Connect [this=%p]\n", this));
|
||||
|
||||
// Note that we are only setting the "Upgrade-Insecure-Requests" request
|
||||
// header for *all* navigational requests instead of all requests as
|
||||
// defined in the spec, see:
|
||||
// https://www.w3.org/TR/upgrade-insecure-requests/#preference
|
||||
nsContentPolicyType type = mLoadInfo ?
|
||||
mLoadInfo->GetExternalContentPolicyType() :
|
||||
nsIContentPolicy::TYPE_OTHER;
|
||||
|
||||
if (type == nsIContentPolicy::TYPE_DOCUMENT ||
|
||||
type == nsIContentPolicy::TYPE_SUBDOCUMENT) {
|
||||
rv = SetRequestHeader(NS_LITERAL_CSTRING("Upgrade-Insecure-Requests"),
|
||||
NS_LITERAL_CSTRING("1"), false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
bool isHttps = false;
|
||||
rv = mURI->SchemeIs("https", &isHttps);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
|
Загрузка…
Ссылка в новой задаче