OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
305 // check if the underlying file has been changed or not. The granularity of | 305 // check if the underlying file has been changed or not. The granularity of |
306 // the time comparison is 1 second since time_t precision is used in WebKit. | 306 // the time comparison is 1 second since time_t precision is used in WebKit. |
307 void AppendBytesToUpload(const char* bytes, int bytes_len); // takes a copy | 307 void AppendBytesToUpload(const char* bytes, int bytes_len); // takes a copy |
308 void AppendFileRangeToUpload(const FilePath& file_path, | 308 void AppendFileRangeToUpload(const FilePath& file_path, |
309 uint64 offset, uint64 length, | 309 uint64 offset, uint64 length, |
310 const base::Time& expected_modification_time); | 310 const base::Time& expected_modification_time); |
311 void AppendFileToUpload(const FilePath& file_path) { | 311 void AppendFileToUpload(const FilePath& file_path) { |
312 AppendFileRangeToUpload(file_path, 0, kuint64max, base::Time()); | 312 AppendFileRangeToUpload(file_path, 0, kuint64max, base::Time()); |
313 } | 313 } |
314 | 314 |
315 // Appends the given bytes to the requests's POST data to be sent immediately | |
316 // and indicates that more data is yet to come. This is useful when the POST | |
317 // data is not available upfront when establishing the connection and as the | |
318 // data becomes available it can be sent to the server. | |
wtc
2011/01/14 03:09:31
Nit: change "POST data" to "upload data" (two occu
Satish
2011/01/14 18:09:29
Done.
| |
319 // | |
320 // This method can be called only after a call to |set_chunked_upload(true)| | |
wtc
2011/01/14 03:09:31
Typo: your set_chunked_upload method takes no argu
Satish
2011/01/14 18:09:29
Done.
| |
321 // and |Start()|. | |
322 void AppendChunkToUpload(const char* bytes, int bytes_len); | |
vandebo (ex-Chrome)
2011/01/14 05:53:44
This method seems different than the other AppendF
Satish
2011/01/14 18:09:29
Looking at the implementation I don't see why this
| |
323 | |
324 // Indicate the end of a chunked-transfer encoded request body. | |
wtc
2011/01/14 03:09:31
Nit: Indicate => Indicates
Satish
2011/01/14 18:09:29
Done.
| |
325 void MarkEndOfChunks(); | |
vandebo (ex-Chrome)
2011/01/14 05:53:44
Is it really worthwhile to provide this method? W
Satish
2011/01/14 18:09:29
The consumers of this class don't have to know abo
| |
326 | |
315 // Set the upload data directly. | 327 // Set the upload data directly. |
316 void set_upload(net::UploadData* upload); | 328 void set_upload(net::UploadData* upload); |
317 | 329 |
318 // Get the upload data directly. | 330 // Get the upload data directly. |
319 net::UploadData* get_upload(); | 331 net::UploadData* get_upload(); |
320 | 332 |
321 // Returns true if the request has a non-empty message body to upload. | 333 // Returns true if the request has a non-empty message body to upload. |
322 bool has_upload() const; | 334 bool has_upload() const; |
323 | 335 |
324 // Set an extra request header by ID or name. These methods may only be | 336 // Set an extra request header by ID or name. These methods may only be |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
422 // called. For non-HTTP requests, this method returns -1. | 434 // called. For non-HTTP requests, this method returns -1. |
423 int GetResponseCode(); | 435 int GetResponseCode(); |
424 | 436 |
425 // Get the HTTP response info in its entirety. | 437 // Get the HTTP response info in its entirety. |
426 const net::HttpResponseInfo& response_info() const { return response_info_; } | 438 const net::HttpResponseInfo& response_info() const { return response_info_; } |
427 | 439 |
428 // Access the net::LOAD_* flags modifying this request (see load_flags.h). | 440 // Access the net::LOAD_* flags modifying this request (see load_flags.h). |
429 int load_flags() const { return load_flags_; } | 441 int load_flags() const { return load_flags_; } |
430 void set_load_flags(int flags) { load_flags_ = flags; } | 442 void set_load_flags(int flags) { load_flags_ = flags; } |
431 | 443 |
444 // Indicates that the request body should be sent using Chunked-Transfer | |
445 // encoding. | |
446 void set_chunked_upload() { is_chunked_upload_ = true; } | |
wtc
2011/01/14 03:09:31
Nit: set_chunked_upload => enable_chunked_upload
vandebo (ex-Chrome)
2011/01/14 05:53:44
It seems that this logically belongs with the othe
Satish
2011/01/14 18:09:29
Renamed to EnableChunkedUpload(), moved to .cc fil
| |
447 | |
432 // Returns true if the request is "pending" (i.e., if Start() has been called, | 448 // Returns true if the request is "pending" (i.e., if Start() has been called, |
433 // and the response has not yet been called). | 449 // and the response has not yet been called). |
434 bool is_pending() const { return is_pending_; } | 450 bool is_pending() const { return is_pending_; } |
435 | 451 |
436 // Returns the error status of the request. | 452 // Returns the error status of the request. |
437 const net::URLRequestStatus& status() const { return status_; } | 453 const net::URLRequestStatus& status() const { return status_; } |
438 | 454 |
439 // This method is called to start the request. The delegate will receive | 455 // This method is called to start the request. The delegate will receive |
440 // a OnResponseStarted callback when the request is started. | 456 // a OnResponseStarted callback when the request is started. |
441 void Start(); | 457 void Start(); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
619 // whether the job is active. | 635 // whether the job is active. |
620 bool is_pending_; | 636 bool is_pending_; |
621 | 637 |
622 // Externally-defined data accessible by key | 638 // Externally-defined data accessible by key |
623 typedef std::map<const void*, linked_ptr<UserData> > UserDataMap; | 639 typedef std::map<const void*, linked_ptr<UserData> > UserDataMap; |
624 UserDataMap user_data_; | 640 UserDataMap user_data_; |
625 | 641 |
626 // Whether to enable performance profiling on the job serving this request. | 642 // Whether to enable performance profiling on the job serving this request. |
627 bool enable_profiling_; | 643 bool enable_profiling_; |
628 | 644 |
645 // Whether the upload data contains chunks of data (sent via | |
646 // Chunked-Transfer encoding). | |
647 bool is_chunked_upload_; | |
648 | |
629 // Number of times we're willing to redirect. Used to guard against | 649 // Number of times we're willing to redirect. Used to guard against |
630 // infinite redirects. | 650 // infinite redirects. |
631 int redirect_limit_; | 651 int redirect_limit_; |
632 | 652 |
633 // Cached value for use after we've orphaned the job handling the | 653 // Cached value for use after we've orphaned the job handling the |
634 // first transaction in a request involving redirects. | 654 // first transaction in a request involving redirects. |
635 uint64 final_upload_progress_; | 655 uint64 final_upload_progress_; |
636 | 656 |
637 // The priority level for this request. Objects like ClientSocketPool use | 657 // The priority level for this request. Objects like ClientSocketPool use |
638 // this to determine which URLRequest to allocate sockets to first. | 658 // this to determine which URLRequest to allocate sockets to first. |
639 net::RequestPriority priority_; | 659 net::RequestPriority priority_; |
640 | 660 |
641 base::debug::LeakTracker<URLRequest> leak_tracker_; | 661 base::debug::LeakTracker<URLRequest> leak_tracker_; |
642 | 662 |
643 DISALLOW_COPY_AND_ASSIGN(URLRequest); | 663 DISALLOW_COPY_AND_ASSIGN(URLRequest); |
644 }; | 664 }; |
645 | 665 |
646 } // namespace net | 666 } // namespace net |
647 | 667 |
648 #endif // NET_URL_REQUEST_URL_REQUEST_H_ | 668 #endif // NET_URL_REQUEST_URL_REQUEST_H_ |
OLD | NEW |