/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
namespace { class EarlyHintsPreConnectOverride : public nsIInterfaceRequestor, public nsISpeculativeConnectionOverrider { public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSISPECULATIVECONNECTIONOVERRIDER
NS_DECL_NSIINTERFACEREQUESTOR
nsCOMPtr<nsIURI> uri; if (NS_FAILED(aHeader.NewResolveHref(getter_AddRefs(uri), aBaseURI))) { return;
}
// only preconnect secure context urls if (!uri->SchemeIs("https")) { return;
}
uint32_t maxPreconnectCount =
StaticPrefs::network_early_hints_preconnect_max_connections();
nsCOMPtr<nsIInterfaceRequestor> callbacks = new EarlyHintsPreConnectOverride(maxPreconnectCount); // Note that the http connection manager will limit the number of // connections we can make, so it should be fine we don't check duplicate // preconnect attempts here.
CORSMode corsMode = dom::Element::StringToCORSMode(aHeader.mCrossOrigin);
gIOService->SpeculativeConnectWithOriginAttributesNative(
uri, std::move(aOriginAttributes), callbacks, corsMode == CORS_ANONYMOUS);
}
} // namespace mozilla::net
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.