| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 358 |
| 359 // This method is called to start the request. The delegate will receive | 359 // This method is called to start the request. The delegate will receive |
| 360 // a OnResponseStarted callback when the request is started. | 360 // a OnResponseStarted callback when the request is started. |
| 361 void Start(); | 361 void Start(); |
| 362 | 362 |
| 363 // This method may be called at any time after Start() has been called to | 363 // This method may be called at any time after Start() has been called to |
| 364 // cancel the request. This method may be called many times, and it has | 364 // cancel the request. This method may be called many times, and it has |
| 365 // no effect once the response has completed. | 365 // no effect once the response has completed. |
| 366 void Cancel(); | 366 void Cancel(); |
| 367 | 367 |
| 368 // Similar to Cancel but sets the error to |os_error| (see net_error_list.h | 368 // Cancels the request and sets the error to |os_error| (see net_error_list.h |
| 369 // for values) instead of net::ERR_ABORTED. | 369 // for values). |
| 370 // Used to attach a reason for canceling a request. | 370 void SimulateError(int os_error); |
| 371 void CancelWithError(int os_error); | 371 |
| 372 // Cancels the request and sets the error to |os_error| (see net_error_list.h |
| 373 // for values) and attaches |ssl_info| as the SSLInfo for that request. This |
| 374 // is useful to attach a certificate and certificate error to a canceled |
| 375 // request. |
| 376 void SimulateSSLError(int os_error, const net::SSLInfo& ssl_info); |
| 372 | 377 |
| 373 // Read initiates an asynchronous read from the response, and must only | 378 // Read initiates an asynchronous read from the response, and must only |
| 374 // be called after the OnResponseStarted callback is received with a | 379 // be called after the OnResponseStarted callback is received with a |
| 375 // successful status. | 380 // successful status. |
| 376 // If data is available, Read will return true, and the data and length will | 381 // If data is available, Read will return true, and the data and length will |
| 377 // be returned immediately. If data is not available, Read returns false, | 382 // be returned immediately. If data is not available, Read returns false, |
| 378 // and an asynchronous Read is initiated. The Read is finished when | 383 // and an asynchronous Read is initiated. The Read is finished when |
| 379 // the caller receives the OnReadComplete callback. OnReadComplete will be | 384 // the caller receives the OnReadComplete callback. OnReadComplete will be |
| 380 // always be called, even if there was a failure. | 385 // always be called, even if there was a failure. |
| 381 // | 386 // |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 int Redirect(const GURL& location, int http_status_code); | 444 int Redirect(const GURL& location, int http_status_code); |
| 440 | 445 |
| 441 private: | 446 private: |
| 442 friend class URLRequestJob; | 447 friend class URLRequestJob; |
| 443 | 448 |
| 444 // Detaches the job from this request in preparation for this object going | 449 // Detaches the job from this request in preparation for this object going |
| 445 // away or the job being replaced. The job will not call us back when it has | 450 // away or the job being replaced. The job will not call us back when it has |
| 446 // been orphaned. | 451 // been orphaned. |
| 447 void OrphanJob(); | 452 void OrphanJob(); |
| 448 | 453 |
| 454 // Cancels the request and set the error and ssl info for this request to the |
| 455 // passed values. |
| 456 void DoCancel(int os_error, const net::SSLInfo& ssl_info); |
| 457 |
| 449 // Discard headers which have meaning in POST (Content-Length, Content-Type, | 458 // Discard headers which have meaning in POST (Content-Length, Content-Type, |
| 450 // Origin). | 459 // Origin). |
| 451 static std::string StripPostSpecificHeaders(const std::string& headers); | 460 static std::string StripPostSpecificHeaders(const std::string& headers); |
| 452 | 461 |
| 453 scoped_refptr<URLRequestJob> job_; | 462 scoped_refptr<URLRequestJob> job_; |
| 454 scoped_refptr<net::UploadData> upload_; | 463 scoped_refptr<net::UploadData> upload_; |
| 455 GURL url_; | 464 GURL url_; |
| 456 GURL original_url_; | 465 GURL original_url_; |
| 457 GURL policy_url_; | 466 GURL policy_url_; |
| 458 std::string method_; // "GET", "POST", etc. Should be all uppercase. | 467 std::string method_; // "GET", "POST", etc. Should be all uppercase. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 #else // disable leak checking in release builds... | 533 #else // disable leak checking in release builds... |
| 525 | 534 |
| 526 #define URLREQUEST_COUNT_CTOR() | 535 #define URLREQUEST_COUNT_CTOR() |
| 527 #define URLREQUEST_COUNT_DTOR() | 536 #define URLREQUEST_COUNT_DTOR() |
| 528 | 537 |
| 529 #endif | 538 #endif |
| 530 | 539 |
| 531 | 540 |
| 532 #endif // NET_URL_REQUEST_URL_REQUEST_H_ | 541 #endif // NET_URL_REQUEST_URL_REQUEST_H_ |
| 533 | 542 |
| OLD | NEW |