| Index: net/url_request/url_request.h
|
| diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h
|
| index eb94da89088b9c5a4a2360cbd2593a3b1b859086..bc927da4adc0e7b20332b2ff9a29c1799bf82fa1 100644
|
| --- a/net/url_request/url_request.h
|
| +++ b/net/url_request/url_request.h
|
| @@ -118,6 +118,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.
|
| @@ -307,6 +328,11 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe),
|
| // This method may only be called before Start().
|
| void set_initiator(const url::Origin& initiator);
|
|
|
| + // The insecure request policy to apply to this request. The insecure request
|
| + // policy may only be changed before Start() is called.
|
| + 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.
|
| @@ -633,9 +659,13 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe),
|
| // MAXIMUM_PRIORITY if the IGNORE_LIMITS load flag is set.
|
| void SetPriority(RequestPriority priority);
|
|
|
| - // Returns true iff this request would be internally redirected to HTTPS
|
| - // due to HSTS. If so, |redirect_url| is rewritten to the new HTTPS URL.
|
| - bool GetHSTSRedirect(GURL* redirect_url) const;
|
| + // Returns true iff this request should be internally redirected to HTTPS
|
| + // due to either HSTS (https://tools.ietf.org/html/rfc6797) or
|
| + // Upgrade-Insecure-Requests
|
| + // (https://w3c.github.io/webappsec-upgrade-insecure-requests/). If so,
|
| + // |redirect_url| is rewritten to the new URL, and |type| is set to either
|
| + // "HSTS" or "Upgrade", accordingly.
|
| + bool GetSecureRedirect(GURL* redirect_url, std::string* redirect_type) const;
|
|
|
| void set_received_response_content_length(int64_t received_content_length) {
|
| received_response_content_length_ = received_content_length;
|
| @@ -777,6 +807,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.
|
|
|