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_HTTP_HTTP_TRANSACTION_H_ | 5 #ifndef NET_HTTP_HTTP_TRANSACTION_H_ |
6 #define NET_HTTP_HTTP_TRANSACTION_H_ | 6 #define NET_HTTP_HTTP_TRANSACTION_H_ |
7 | 7 |
8 #include "net/base/completion_callback.h" | 8 #include "net/base/completion_callback.h" |
9 #include "net/base/load_states.h" | 9 #include "net/base/load_states.h" |
10 | 10 |
11 namespace net { | 11 namespace net { |
12 | 12 |
13 class HttpRequestInfo; | 13 class HttpRequestInfo; |
14 class HttpResponseInfo; | 14 class HttpResponseInfo; |
15 class IOBuffer; | 15 class IOBuffer; |
| 16 class X509Certificate; |
16 | 17 |
17 // Represents a single HTTP transaction (i.e., a single request/response pair). | 18 // Represents a single HTTP transaction (i.e., a single request/response pair). |
18 // HTTP redirects are not followed and authentication challenges are not | 19 // HTTP redirects are not followed and authentication challenges are not |
19 // answered. Cookies are assumed to be managed by the caller. | 20 // answered. Cookies are assumed to be managed by the caller. |
20 class HttpTransaction { | 21 class HttpTransaction { |
21 public: | 22 public: |
22 // Stops any pending IO and destroys the transaction object. | 23 // Stops any pending IO and destroys the transaction object. |
23 virtual ~HttpTransaction() {} | 24 virtual ~HttpTransaction() {} |
24 | 25 |
25 // Starts the HTTP transaction (i.e., sends the HTTP request). | 26 // Starts the HTTP transaction (i.e., sends the HTTP request). |
(...skipping 17 matching lines...) Expand all Loading... |
43 // Once Read has been called, this method cannot be called. This method is | 44 // Once Read has been called, this method cannot be called. This method is |
44 // used, for example, to continue past various SSL related errors. | 45 // used, for example, to continue past various SSL related errors. |
45 // | 46 // |
46 // Not all errors can be ignored using this method. See error code | 47 // Not all errors can be ignored using this method. See error code |
47 // descriptions for details about errors that can be ignored. | 48 // descriptions for details about errors that can be ignored. |
48 // | 49 // |
49 // NOTE: The transaction is not responsible for deleting the callback object. | 50 // NOTE: The transaction is not responsible for deleting the callback object. |
50 // | 51 // |
51 virtual int RestartIgnoringLastError(CompletionCallback* callback) = 0; | 52 virtual int RestartIgnoringLastError(CompletionCallback* callback) = 0; |
52 | 53 |
| 54 // Restarts the HTTP transaction with a client certificate. |
| 55 virtual int RestartWithCertificate(X509Certificate* client_cert, |
| 56 CompletionCallback* callback) = 0; |
| 57 |
53 // Restarts the HTTP transaction with authentication credentials. | 58 // Restarts the HTTP transaction with authentication credentials. |
54 virtual int RestartWithAuth(const std::wstring& username, | 59 virtual int RestartWithAuth(const std::wstring& username, |
55 const std::wstring& password, | 60 const std::wstring& password, |
56 CompletionCallback* callback) = 0; | 61 CompletionCallback* callback) = 0; |
57 | 62 |
58 // Returns true if auth is ready to be continued. Callers should check | 63 // Returns true if auth is ready to be continued. Callers should check |
59 // this value anytime Start() completes: if it is true, the transaction | 64 // this value anytime Start() completes: if it is true, the transaction |
60 // can be resumed with RestartWithAuth(L"", L"", callback) to resume | 65 // can be resumed with RestartWithAuth(L"", L"", callback) to resume |
61 // the automatic auth exchange. This notification gives the caller a | 66 // the automatic auth exchange. This notification gives the caller a |
62 // chance to process the response headers from all of the intermediate | 67 // chance to process the response headers from all of the intermediate |
(...skipping 26 matching lines...) Expand all Loading... |
89 virtual LoadState GetLoadState() const = 0; | 94 virtual LoadState GetLoadState() const = 0; |
90 | 95 |
91 // Returns the upload progress in bytes. If there is no upload data, | 96 // Returns the upload progress in bytes. If there is no upload data, |
92 // zero will be returned. This does not include the request headers. | 97 // zero will be returned. This does not include the request headers. |
93 virtual uint64 GetUploadProgress() const = 0; | 98 virtual uint64 GetUploadProgress() const = 0; |
94 }; | 99 }; |
95 | 100 |
96 } // namespace net | 101 } // namespace net |
97 | 102 |
98 #endif // NET_HTTP_HTTP_TRANSACTION_H_ | 103 #endif // NET_HTTP_HTTP_TRANSACTION_H_ |
OLD | NEW |