| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/linked_ptr.h" | 12 #include "base/linked_ptr.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/ref_counted.h" | 14 #include "base/ref_counted.h" |
| 15 #include "base/scoped_ptr.h" | 15 #include "base/scoped_ptr.h" |
| 16 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
| 17 #include "net/base/load_states.h" | 17 #include "net/base/load_states.h" |
| 18 #include "net/http/http_response_info.h" | 18 #include "net/http/http_response_info.h" |
| 19 #include "net/url_request/url_request_status.h" | 19 #include "net/url_request/url_request_status.h" |
| 20 | 20 |
| 21 namespace base { | 21 namespace base { |
| 22 class Time; | 22 class Time; |
| 23 } // namespace base | 23 } // namespace base |
| 24 | 24 |
| 25 namespace net { | 25 namespace net { |
| 26 class IOBuffer; | 26 class IOBuffer; |
| 27 class SSLCertRequestInfo; |
| 27 class UploadData; | 28 class UploadData; |
| 28 class X509Certificate; | 29 class X509Certificate; |
| 29 } // namespace net | 30 } // namespace net |
| 30 | 31 |
| 31 class FilePath; | 32 class FilePath; |
| 32 class URLRequestContext; | 33 class URLRequestContext; |
| 33 class URLRequestJob; | 34 class URLRequestJob; |
| 34 | 35 |
| 35 // This stores the values of the Set-Cookie headers received during the request. | 36 // This stores the values of the Set-Cookie headers received during the request. |
| 36 // Each item in the vector corresponds to a Set-Cookie: line received, | 37 // Each item in the vector corresponds to a Set-Cookie: line received, |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 // Called when we receive an authentication failure. The delegate should | 139 // Called when we receive an authentication failure. The delegate should |
| 139 // call request->SetAuth() with the user's credentials once it obtains them, | 140 // call request->SetAuth() with the user's credentials once it obtains them, |
| 140 // or request->CancelAuth() to cancel the login and display the error page. | 141 // or request->CancelAuth() to cancel the login and display the error page. |
| 141 // When it does so, the request will be reissued, restarting the sequence | 142 // When it does so, the request will be reissued, restarting the sequence |
| 142 // of On* callbacks. | 143 // of On* callbacks. |
| 143 virtual void OnAuthRequired(URLRequest* request, | 144 virtual void OnAuthRequired(URLRequest* request, |
| 144 net::AuthChallengeInfo* auth_info) { | 145 net::AuthChallengeInfo* auth_info) { |
| 145 request->CancelAuth(); | 146 request->CancelAuth(); |
| 146 } | 147 } |
| 147 | 148 |
| 149 // Called when we receive an SSL CertificateRequest message for client |
| 150 // authentication. The delegate should call |
| 151 // request->ContinueWithCertificate() with the client certificate the user |
| 152 // selected, or request->ContinueWithCertificate(NULL) to continue the SSL |
| 153 // handshake without a client certificate. |
| 154 virtual void OnCertificateRequested( |
| 155 URLRequest* request, |
| 156 net::SSLCertRequestInfo* cert_request_info) { |
| 157 request->ContinueWithCertificate(NULL); |
| 158 } |
| 159 |
| 148 // Called when using SSL and the server responds with a certificate with | 160 // Called when using SSL and the server responds with a certificate with |
| 149 // an error, for example, whose common name does not match the common name | 161 // an error, for example, whose common name does not match the common name |
| 150 // we were expecting for that host. The delegate should either do the | 162 // we were expecting for that host. The delegate should either do the |
| 151 // safe thing and Cancel() the request or decide to proceed by calling | 163 // safe thing and Cancel() the request or decide to proceed by calling |
| 152 // ContinueDespiteLastError(). cert_error is a net::ERR_* error code | 164 // ContinueDespiteLastError(). cert_error is a net::ERR_* error code |
| 153 // indicating what's wrong with the certificate. | 165 // indicating what's wrong with the certificate. |
| 154 virtual void OnSSLCertificateError(URLRequest* request, | 166 virtual void OnSSLCertificateError(URLRequest* request, |
| 155 int cert_error, | 167 int cert_error, |
| 156 net::X509Certificate* cert) { | 168 net::X509Certificate* cert) { |
| 157 request->Cancel(); | 169 request->Cancel(); |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 // will be set to an error. | 428 // will be set to an error. |
| 417 bool Read(net::IOBuffer* buf, int max_bytes, int *bytes_read); | 429 bool Read(net::IOBuffer* buf, int max_bytes, int *bytes_read); |
| 418 | 430 |
| 419 // One of the following two methods should be called in response to an | 431 // One of the following two methods should be called in response to an |
| 420 // OnAuthRequired() callback (and only then). | 432 // OnAuthRequired() callback (and only then). |
| 421 // SetAuth will reissue the request with the given credentials. | 433 // SetAuth will reissue the request with the given credentials. |
| 422 // CancelAuth will give up and display the error page. | 434 // CancelAuth will give up and display the error page. |
| 423 void SetAuth(const std::wstring& username, const std::wstring& password); | 435 void SetAuth(const std::wstring& username, const std::wstring& password); |
| 424 void CancelAuth(); | 436 void CancelAuth(); |
| 425 | 437 |
| 438 // This method can be called after the user selects a client certificate to |
| 439 // instruct this URLRequest to continue with the request with the |
| 440 // certificate. Pass NULL if the user doesn't have a client certificate. |
| 441 void ContinueWithCertificate(net::X509Certificate* client_cert); |
| 442 |
| 426 // This method can be called after some error notifications to instruct this | 443 // This method can be called after some error notifications to instruct this |
| 427 // URLRequest to ignore the current error and continue with the request. To | 444 // URLRequest to ignore the current error and continue with the request. To |
| 428 // cancel the request instead, call Cancel(). | 445 // cancel the request instead, call Cancel(). |
| 429 void ContinueDespiteLastError(); | 446 void ContinueDespiteLastError(); |
| 430 | 447 |
| 431 // HTTP request/response header IDs (via some preprocessor fun) for use with | 448 // HTTP request/response header IDs (via some preprocessor fun) for use with |
| 432 // SetRequestHeaderById and GetResponseHeaderById. | 449 // SetRequestHeaderById and GetResponseHeaderById. |
| 433 enum { | 450 enum { |
| 434 #define HTTP_ATOM(x) HTTP_ ## x, | 451 #define HTTP_ATOM(x) HTTP_ ## x, |
| 435 #include "net/http/http_atom_list.h" | 452 #include "net/http/http_atom_list.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 #define URLREQUEST_COUNT_DTOR() url_request_metrics.object_count-- | 589 #define URLREQUEST_COUNT_DTOR() url_request_metrics.object_count-- |
| 573 | 590 |
| 574 #else // disable leak checking in release builds... | 591 #else // disable leak checking in release builds... |
| 575 | 592 |
| 576 #define URLREQUEST_COUNT_CTOR() | 593 #define URLREQUEST_COUNT_CTOR() |
| 577 #define URLREQUEST_COUNT_DTOR() | 594 #define URLREQUEST_COUNT_DTOR() |
| 578 | 595 |
| 579 #endif // #ifndef NDEBUG | 596 #endif // #ifndef NDEBUG |
| 580 | 597 |
| 581 #endif // NET_URL_REQUEST_URL_REQUEST_H_ | 598 #endif // NET_URL_REQUEST_URL_REQUEST_H_ |
| OLD | NEW |