| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_URL_REQUEST_URL_REQUEST_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 // First-party URL redirect policy: During server redirects, the first-party | 112 // First-party URL redirect policy: During server redirects, the first-party |
| 113 // URL for cookies normally doesn't change. However, if the request is a | 113 // URL for cookies normally doesn't change. However, if the request is a |
| 114 // top-level first-party request, the first-party URL should be updated to the | 114 // top-level first-party request, the first-party URL should be updated to the |
| 115 // URL on every redirect. | 115 // URL on every redirect. |
| 116 enum FirstPartyURLPolicy { | 116 enum FirstPartyURLPolicy { |
| 117 NEVER_CHANGE_FIRST_PARTY_URL, | 117 NEVER_CHANGE_FIRST_PARTY_URL, |
| 118 UPDATE_FIRST_PARTY_URL_ON_REDIRECT, | 118 UPDATE_FIRST_PARTY_URL_ON_REDIRECT, |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 // 'Upgrade-Insecure-Requests' gives developers the ability to force some |
| 122 // requests to upgrade themselves to secure transport before hitting the |
| 123 // network (along with any redirects they encounter along the way). The |
| 124 // insecure request policy governs this behavior: |
| 125 // |
| 126 // * DO_NOT_UPGRADE_INSECURE_REQUESTS is the default behavior, which does |
| 127 // not upgrade insecure request (hence the clever name). |
| 128 // |
| 129 // * UPGRADE_ALL_INSECURE_REQUESTS will upgrade any insecure request to |
| 130 // secure transport. |
| 131 // |
| 132 // * UPGRADE_SAME_HOST_INSECURE_REQUESTS will upgrade any insecure request |
| 133 // whose target's host matches the request's initiator's host. |
| 134 // |
| 135 // See https://w3c.github.io/webappsec-upgrade-insecure-requests/ for detail. |
| 136 enum InsecureRequestPolicy { |
| 137 DO_NOT_UPGRADE_INSECURE_REQUESTS, |
| 138 UPGRADE_SAME_HOST_INSECURE_REQUESTS, |
| 139 UPGRADE_ALL_INSECURE_REQUESTS |
| 140 }; |
| 141 |
| 121 // The delegate's methods are called from the message loop of the thread | 142 // The delegate's methods are called from the message loop of the thread |
| 122 // on which the request's Start() method is called. See above for the | 143 // on which the request's Start() method is called. See above for the |
| 123 // ordering of callbacks. | 144 // ordering of callbacks. |
| 124 // | 145 // |
| 125 // The callbacks will be called in the following order: | 146 // The callbacks will be called in the following order: |
| 126 // Start() | 147 // Start() |
| 127 // - OnCertificateRequested* (zero or more calls, if the SSL server and/or | 148 // - OnCertificateRequested* (zero or more calls, if the SSL server and/or |
| 128 // SSL proxy requests a client certificate for authentication) | 149 // SSL proxy requests a client certificate for authentication) |
| 129 // - OnSSLCertificateError* (zero or one call, if the SSL server's | 150 // - OnSSLCertificateError* (zero or one call, if the SSL server's |
| 130 // certificate has an error) | 151 // certificate has an error) |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 // `https://example.com/`'s form submission is made in the top-level frame, | 321 // `https://example.com/`'s form submission is made in the top-level frame, |
| 301 // the first party for cookies would be the target URL's origin. The | 322 // the first party for cookies would be the target URL's origin. The |
| 302 // initiator remains `https://example.com/`. | 323 // initiator remains `https://example.com/`. |
| 303 // | 324 // |
| 304 // This value is used to perform the cross-origin check specified in Section | 325 // This value is used to perform the cross-origin check specified in Section |
| 305 // 4.3 of https://tools.ietf.org/html/draft-west-first-party-cookies. | 326 // 4.3 of https://tools.ietf.org/html/draft-west-first-party-cookies. |
| 306 const url::Origin& initiator() const { return initiator_; } | 327 const url::Origin& initiator() const { return initiator_; } |
| 307 // This method may only be called before Start(). | 328 // This method may only be called before Start(). |
| 308 void set_initiator(const url::Origin& initiator); | 329 void set_initiator(const url::Origin& initiator); |
| 309 | 330 |
| 331 // The insecure request policy to apply to this request. The insecure request |
| 332 // policy may only be changed before Start() is called. |
| 333 InsecureRequestPolicy insecure_request_policy() const { |
| 334 return insecure_request_policy_; |
| 335 } |
| 336 void set_insecure_request_policy( |
| 337 InsecureRequestPolicy insecure_request_policy); |
| 338 |
| 310 // The request method, as an uppercase string. "GET" is the default value. | 339 // The request method, as an uppercase string. "GET" is the default value. |
| 311 // The request method may only be changed before Start() is called and | 340 // The request method may only be changed before Start() is called and |
| 312 // should only be assigned an uppercase value. | 341 // should only be assigned an uppercase value. |
| 313 const std::string& method() const { return method_; } | 342 const std::string& method() const { return method_; } |
| 314 void set_method(const std::string& method); | 343 void set_method(const std::string& method); |
| 315 | 344 |
| 316 // The referrer URL for the request. This header may actually be suppressed | 345 // The referrer URL for the request. This header may actually be suppressed |
| 317 // from the underlying network request for security reasons (e.g., a HTTPS | 346 // from the underlying network request for security reasons (e.g., a HTTPS |
| 318 // URL will not be sent as the referrer for a HTTP request). The referrer | 347 // URL will not be sent as the referrer for a HTTP request). The referrer |
| 319 // may only be changed before Start() is called. | 348 // may only be changed before Start() is called. |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 | 799 |
| 771 std::vector<GURL> url_chain_; | 800 std::vector<GURL> url_chain_; |
| 772 GURL first_party_for_cookies_; | 801 GURL first_party_for_cookies_; |
| 773 url::Origin initiator_; | 802 url::Origin initiator_; |
| 774 GURL delegate_redirect_url_; | 803 GURL delegate_redirect_url_; |
| 775 std::string method_; // "GET", "POST", etc. Should be all uppercase. | 804 std::string method_; // "GET", "POST", etc. Should be all uppercase. |
| 776 std::string referrer_; | 805 std::string referrer_; |
| 777 ReferrerPolicy referrer_policy_; | 806 ReferrerPolicy referrer_policy_; |
| 778 std::string token_binding_referrer_; | 807 std::string token_binding_referrer_; |
| 779 FirstPartyURLPolicy first_party_url_policy_; | 808 FirstPartyURLPolicy first_party_url_policy_; |
| 809 InsecureRequestPolicy insecure_request_policy_; |
| 780 HttpRequestHeaders extra_request_headers_; | 810 HttpRequestHeaders extra_request_headers_; |
| 781 int load_flags_; // Flags indicating the request type for the load; | 811 int load_flags_; // Flags indicating the request type for the load; |
| 782 // expected values are LOAD_* enums above. | 812 // expected values are LOAD_* enums above. |
| 783 | 813 |
| 784 // Never access methods of the |delegate_| directly. Always use the | 814 // Never access methods of the |delegate_| directly. Always use the |
| 785 // Notify... methods for this. | 815 // Notify... methods for this. |
| 786 Delegate* delegate_; | 816 Delegate* delegate_; |
| 787 | 817 |
| 788 // Current error status of the job. When no error has been encountered, this | 818 // Current error status of the job. When no error has been encountered, this |
| 789 // will be SUCCESS. If multiple errors have been encountered, this will be | 819 // will be SUCCESS. If multiple errors have been encountered, this will be |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 | 895 |
| 866 // The proxy server used for this request, if any. | 896 // The proxy server used for this request, if any. |
| 867 HostPortPair proxy_server_; | 897 HostPortPair proxy_server_; |
| 868 | 898 |
| 869 DISALLOW_COPY_AND_ASSIGN(URLRequest); | 899 DISALLOW_COPY_AND_ASSIGN(URLRequest); |
| 870 }; | 900 }; |
| 871 | 901 |
| 872 } // namespace net | 902 } // namespace net |
| 873 | 903 |
| 874 #endif // NET_URL_REQUEST_URL_REQUEST_H_ | 904 #endif // NET_URL_REQUEST_URL_REQUEST_H_ |
| OLD | NEW |