Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(527)

Side by Side Diff: net/url_request/url_request.h

Issue 6134003: Prototype of chunked transfer encoded POST. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 and adds an indication
316 // that more is to come. This is useful when the POST data is not available
wtc 2011/01/12 02:39:02 I think "more is to come" is less useful info than
Satish 2011/01/13 17:43:27 Done
317 // upfront when establishing the connection and as the data becomes available
318 // it can be sent to the server.
319 // This method should be called ONLY after calling Start().
320 void AppendChunkToUpload(const char* bytes, int bytes_len);
321 void MarkEndOfChunks();
322
315 // Set the upload data directly. 323 // Set the upload data directly.
316 void set_upload(net::UploadData* upload); 324 void set_upload(net::UploadData* upload);
317 325
318 // Get the upload data directly. 326 // Get the upload data directly.
319 net::UploadData* get_upload(); 327 net::UploadData* get_upload();
320 328
321 // Returns true if the request has a non-empty message body to upload. 329 // Returns true if the request has a non-empty message body to upload.
322 bool has_upload() const; 330 bool has_upload() const;
323 331
324 // Set an extra request header by ID or name. These methods may only be 332 // 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
422 // called. For non-HTTP requests, this method returns -1. 430 // called. For non-HTTP requests, this method returns -1.
423 int GetResponseCode(); 431 int GetResponseCode();
424 432
425 // Get the HTTP response info in its entirety. 433 // Get the HTTP response info in its entirety.
426 const net::HttpResponseInfo& response_info() const { return response_info_; } 434 const net::HttpResponseInfo& response_info() const { return response_info_; }
427 435
428 // Access the net::LOAD_* flags modifying this request (see load_flags.h). 436 // Access the net::LOAD_* flags modifying this request (see load_flags.h).
429 int load_flags() const { return load_flags_; } 437 int load_flags() const { return load_flags_; }
430 void set_load_flags(int flags) { load_flags_ = flags; } 438 void set_load_flags(int flags) { load_flags_ = flags; }
431 439
440 void set_chunked_transfer_upload() { chunked_transfer_upload_ = true; }
441
432 // Returns true if the request is "pending" (i.e., if Start() has been called, 442 // Returns true if the request is "pending" (i.e., if Start() has been called,
433 // and the response has not yet been called). 443 // and the response has not yet been called).
434 bool is_pending() const { return is_pending_; } 444 bool is_pending() const { return is_pending_; }
435 445
436 // Returns the error status of the request. 446 // Returns the error status of the request.
437 const net::URLRequestStatus& status() const { return status_; } 447 const net::URLRequestStatus& status() const { return status_; }
438 448
439 // This method is called to start the request. The delegate will receive 449 // This method is called to start the request. The delegate will receive
440 // a OnResponseStarted callback when the request is started. 450 // a OnResponseStarted callback when the request is started.
441 void Start(); 451 void Start();
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 // whether the job is active. 629 // whether the job is active.
620 bool is_pending_; 630 bool is_pending_;
621 631
622 // Externally-defined data accessible by key 632 // Externally-defined data accessible by key
623 typedef std::map<const void*, linked_ptr<UserData> > UserDataMap; 633 typedef std::map<const void*, linked_ptr<UserData> > UserDataMap;
624 UserDataMap user_data_; 634 UserDataMap user_data_;
625 635
626 // Whether to enable performance profiling on the job serving this request. 636 // Whether to enable performance profiling on the job serving this request.
627 bool enable_profiling_; 637 bool enable_profiling_;
628 638
639 // Whether the upload data contains chunks of data (sent via
640 // Chunked-Transfer encoding).
641 bool chunked_transfer_upload_;
wtc 2011/01/12 02:39:02 Nit: shorten this to chunked_upload_ (and the sett
Satish 2011/01/13 17:43:27 Done.
642
629 // Number of times we're willing to redirect. Used to guard against 643 // Number of times we're willing to redirect. Used to guard against
630 // infinite redirects. 644 // infinite redirects.
631 int redirect_limit_; 645 int redirect_limit_;
632 646
633 // Cached value for use after we've orphaned the job handling the 647 // Cached value for use after we've orphaned the job handling the
634 // first transaction in a request involving redirects. 648 // first transaction in a request involving redirects.
635 uint64 final_upload_progress_; 649 uint64 final_upload_progress_;
636 650
637 // The priority level for this request. Objects like ClientSocketPool use 651 // The priority level for this request. Objects like ClientSocketPool use
638 // this to determine which URLRequest to allocate sockets to first. 652 // this to determine which URLRequest to allocate sockets to first.
639 net::RequestPriority priority_; 653 net::RequestPriority priority_;
640 654
641 base::debug::LeakTracker<URLRequest> leak_tracker_; 655 base::debug::LeakTracker<URLRequest> leak_tracker_;
642 656
643 DISALLOW_COPY_AND_ASSIGN(URLRequest); 657 DISALLOW_COPY_AND_ASSIGN(URLRequest);
644 }; 658 };
645 659
646 } // namespace net 660 } // namespace net
647 661
648 #endif // NET_URL_REQUEST_URL_REQUEST_H_ 662 #endif // NET_URL_REQUEST_URL_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698