| 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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 85 } |
| 86 | 86 |
| 87 namespace net { | 87 namespace net { |
| 88 | 88 |
| 89 class CookieOptions; | 89 class CookieOptions; |
| 90 class HostPortPair; | 90 class HostPortPair; |
| 91 class IOBuffer; | 91 class IOBuffer; |
| 92 class SSLCertRequestInfo; | 92 class SSLCertRequestInfo; |
| 93 class SSLInfo; | 93 class SSLInfo; |
| 94 class UploadData; | 94 class UploadData; |
| 95 class UploadDataStream; |
| 95 class URLRequestContext; | 96 class URLRequestContext; |
| 96 class URLRequestJob; | 97 class URLRequestJob; |
| 97 class X509Certificate; | 98 class X509Certificate; |
| 98 | 99 |
| 99 // This stores the values of the Set-Cookie headers received during the request. | 100 // This stores the values of the Set-Cookie headers received during the request. |
| 100 // Each item in the vector corresponds to a Set-Cookie: line received, | 101 // Each item in the vector corresponds to a Set-Cookie: line received, |
| 101 // excluding the "Set-Cookie:" part. | 102 // excluding the "Set-Cookie:" part. |
| 102 typedef std::vector<std::string> ResponseCookies; | 103 typedef std::vector<std::string> ResponseCookies; |
| 103 | 104 |
| 104 //----------------------------------------------------------------------------- | 105 //----------------------------------------------------------------------------- |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 GURL GetSanitizedReferrer() const; | 392 GURL GetSanitizedReferrer() const; |
| 392 | 393 |
| 393 // The referrer policy to apply when updating the referrer during redirects. | 394 // The referrer policy to apply when updating the referrer during redirects. |
| 394 // The referrer policy may only be changed before Start() is called. | 395 // The referrer policy may only be changed before Start() is called. |
| 395 void set_referrer_policy(ReferrerPolicy referrer_policy); | 396 void set_referrer_policy(ReferrerPolicy referrer_policy); |
| 396 | 397 |
| 397 // Sets the delegate of the request. This value may be changed at any time, | 398 // Sets the delegate of the request. This value may be changed at any time, |
| 398 // and it is permissible for it to be null. | 399 // and it is permissible for it to be null. |
| 399 void set_delegate(Delegate* delegate); | 400 void set_delegate(Delegate* delegate); |
| 400 | 401 |
| 401 // The data comprising the request message body is specified as a sequence of | |
| 402 // data segments and/or files containing data to upload. These methods may | |
| 403 // be called to construct the data sequence to upload, and they may only be | |
| 404 // called before Start() is called. For POST requests, the user must call | |
| 405 // SetRequestHeaderBy{Id,Name} to set the Content-Type of the request to the | |
| 406 // appropriate value before calling Start(). | |
| 407 // | |
| 408 // When uploading data, bytes_len must be non-zero. | |
| 409 void AppendBytesToUpload(const char* bytes, int bytes_len); // takes a copy | |
| 410 | |
| 411 // Indicates that the request body should be sent using chunked transfer | 402 // Indicates that the request body should be sent using chunked transfer |
| 412 // encoding. This method may only be called before Start() is called. | 403 // encoding. This method may only be called before Start() is called. |
| 413 void EnableChunkedUpload(); | 404 void EnableChunkedUpload(); |
| 414 | 405 |
| 415 // Appends the given bytes to the request's upload data to be sent | 406 // Appends the given bytes to the request's upload data to be sent |
| 416 // immediately via chunked transfer encoding. When all data has been sent, | 407 // immediately via chunked transfer encoding. When all data has been sent, |
| 417 // call MarkEndOfChunks() to indicate the end of upload data. | 408 // call MarkEndOfChunks() to indicate the end of upload data. |
| 418 // | 409 // |
| 419 // This method may be called only after calling EnableChunkedUpload(). | 410 // This method may be called only after calling EnableChunkedUpload(). |
| 420 void AppendChunkToUpload(const char* bytes, | 411 void AppendChunkToUpload(const char* bytes, |
| 421 int bytes_len, | 412 int bytes_len, |
| 422 bool is_last_chunk); | 413 bool is_last_chunk); |
| 423 | 414 |
| 424 // Set the upload data directly. | 415 // Set the upload data directly. |
| 425 void set_upload(UploadData* upload); | 416 void set_upload(UploadData* upload); |
| 426 | 417 |
| 427 // Get the upload data directly. | 418 // Get the upload data directly. |
| 428 const UploadData* get_upload() const; | 419 const UploadDataStream* get_upload() const; |
| 429 UploadData* get_upload_mutable(); | |
| 430 | 420 |
| 431 // Returns true if the request has a non-empty message body to upload. | 421 // Returns true if the request has a non-empty message body to upload. |
| 432 bool has_upload() const; | 422 bool has_upload() const; |
| 433 | 423 |
| 434 // Set an extra request header by ID or name, or remove one by name. These | 424 // Set an extra request header by ID or name, or remove one by name. These |
| 435 // methods may only be called before Start() is called, or before a new | 425 // methods may only be called before Start() is called, or before a new |
| 436 // redirect in the request chain. | 426 // redirect in the request chain. |
| 437 void SetExtraRequestHeaderById(int header_id, const std::string& value, | 427 void SetExtraRequestHeaderById(int header_id, const std::string& value, |
| 438 bool overwrite); | 428 bool overwrite); |
| 439 void SetExtraRequestHeaderByName(const std::string& name, | 429 void SetExtraRequestHeaderByName(const std::string& name, |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 // cookie store, socket pool, etc.) | 746 // cookie store, socket pool, etc.) |
| 757 const URLRequestContext* context_; | 747 const URLRequestContext* context_; |
| 758 | 748 |
| 759 NetworkDelegate* network_delegate_; | 749 NetworkDelegate* network_delegate_; |
| 760 | 750 |
| 761 // Tracks the time spent in various load states throughout this request. | 751 // Tracks the time spent in various load states throughout this request. |
| 762 BoundNetLog net_log_; | 752 BoundNetLog net_log_; |
| 763 | 753 |
| 764 scoped_refptr<URLRequestJob> job_; | 754 scoped_refptr<URLRequestJob> job_; |
| 765 scoped_refptr<UploadData> upload_; | 755 scoped_refptr<UploadData> upload_; |
| 756 scoped_ptr<UploadDataStream> upload_data_stream_; |
| 757 bool disable_upload_; |
| 766 std::vector<GURL> url_chain_; | 758 std::vector<GURL> url_chain_; |
| 767 GURL first_party_for_cookies_; | 759 GURL first_party_for_cookies_; |
| 768 GURL delegate_redirect_url_; | 760 GURL delegate_redirect_url_; |
| 769 std::string method_; // "GET", "POST", etc. Should be all uppercase. | 761 std::string method_; // "GET", "POST", etc. Should be all uppercase. |
| 770 std::string referrer_; | 762 std::string referrer_; |
| 771 ReferrerPolicy referrer_policy_; | 763 ReferrerPolicy referrer_policy_; |
| 772 HttpRequestHeaders extra_request_headers_; | 764 HttpRequestHeaders extra_request_headers_; |
| 773 int load_flags_; // Flags indicating the request type for the load; | 765 int load_flags_; // Flags indicating the request type for the load; |
| 774 // expected values are LOAD_* enums above. | 766 // expected values are LOAD_* enums above. |
| 775 | 767 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 base::TimeTicks creation_time_; | 839 base::TimeTicks creation_time_; |
| 848 | 840 |
| 849 scoped_ptr<const base::debug::StackTrace> stack_trace_; | 841 scoped_ptr<const base::debug::StackTrace> stack_trace_; |
| 850 | 842 |
| 851 DISALLOW_COPY_AND_ASSIGN(URLRequest); | 843 DISALLOW_COPY_AND_ASSIGN(URLRequest); |
| 852 }; | 844 }; |
| 853 | 845 |
| 854 } // namespace net | 846 } // namespace net |
| 855 | 847 |
| 856 #endif // NET_URL_REQUEST_URL_REQUEST_H_ | 848 #endif // NET_URL_REQUEST_URL_REQUEST_H_ |
| OLD | NEW |