Index: net/url_request/url_request.h |
diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h |
index e1406f33633922e9ebc4625d62b3518b409d361c..e429fa3bd66266d60fe7737e4d3ba726d6e40fad 100644 |
--- a/net/url_request/url_request.h |
+++ b/net/url_request/url_request.h |
@@ -119,6 +119,27 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe), |
UPDATE_FIRST_PARTY_URL_ON_REDIRECT, |
}; |
+ // 'Upgrade-Insecure-Requests' gives developers the ability to force some |
+ // requests to upgrade themselves to secure transport before hitting the |
+ // network (along with any redirects they encounter along the way). The |
+ // insecure request policy governs this behavior: |
+ // |
+ // * DO_NOT_UPGRADE_INSECURE_REQUESTS is the default behavior, which does |
+ // not upgrade insecure request (hence the clever name). |
+ // |
+ // * UPGRADE_ALL_INSECURE_REQUESTS will upgrade any insecure request to |
+ // secure transport. |
+ // |
+ // * UPGRADE_SAME_HOST_INSECURE_REQUESTS will upgrade any insecure request |
+ // whose target's host matches the request's initiator's host. |
+ // |
+ // See https://w3c.github.io/webappsec-upgrade-insecure-requests/ for detail. |
+ enum InsecureRequestPolicy { |
+ DO_NOT_UPGRADE_INSECURE_REQUESTS, |
+ UPGRADE_SAME_HOST_INSECURE_REQUESTS, |
+ UPGRADE_ALL_INSECURE_REQUESTS |
+ }; |
+ |
// The delegate's methods are called from the message loop of the thread |
// on which the request's Start() method is called. See above for the |
// ordering of callbacks. |
@@ -308,6 +329,14 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe), |
// This method may only be called before Start(). |
void set_initiator(const base::Optional<url::Origin>& initiator); |
+ // The insecure request policy to apply to this request. This may only be |
+ // changed prior to calling Start(). |
+ InsecureRequestPolicy insecure_request_policy() const { |
+ return insecure_request_policy_; |
+ } |
+ void set_insecure_request_policy( |
+ InsecureRequestPolicy insecure_request_policy); |
+ |
// The request method, as an uppercase string. "GET" is the default value. |
// The request method may only be changed before Start() is called and |
// should only be assigned an uppercase value. |
@@ -651,6 +680,7 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe), |
// Returns the error status of the request. |
// Do not use! Going to be protected! |
const URLRequestStatus& status() const { return status_; } |
+ |
protected: |
// Allow the URLRequestJob class to control the is_pending() flag. |
void set_is_pending(bool value) { is_pending_ = value; } |
@@ -764,6 +794,7 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe), |
ReferrerPolicy referrer_policy_; |
std::string token_binding_referrer_; |
FirstPartyURLPolicy first_party_url_policy_; |
+ InsecureRequestPolicy insecure_request_policy_; |
HttpRequestHeaders extra_request_headers_; |
int load_flags_; // Flags indicating the request type for the load; |
// expected values are LOAD_* enums above. |