| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_NETWORK_TRANSACTION_H_ | 5 #ifndef NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ |
| 6 #define NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ | 6 #define NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/ref_counted.h" | 13 #include "base/ref_counted.h" |
| 14 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
| 15 #include "base/time.h" | 15 #include "base/time.h" |
| 16 #include "net/base/auth.h" |
| 16 #include "net/base/net_log.h" | 17 #include "net/base/net_log.h" |
| 17 #include "net/base/request_priority.h" | 18 #include "net/base/request_priority.h" |
| 18 #include "net/base/ssl_config_service.h" | 19 #include "net/base/ssl_config_service.h" |
| 19 #include "net/http/http_auth.h" | 20 #include "net/http/http_auth.h" |
| 20 #include "net/http/http_request_headers.h" | 21 #include "net/http/http_request_headers.h" |
| 21 #include "net/http/http_response_info.h" | 22 #include "net/http/http_response_info.h" |
| 22 #include "net/http/http_transaction.h" | 23 #include "net/http/http_transaction.h" |
| 23 #include "net/http/stream_factory.h" | 24 #include "net/http/stream_factory.h" |
| 24 #include "net/proxy/proxy_service.h" | 25 #include "net/proxy/proxy_service.h" |
| 25 | 26 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 39 | 40 |
| 40 virtual ~HttpNetworkTransaction(); | 41 virtual ~HttpNetworkTransaction(); |
| 41 | 42 |
| 42 // HttpTransaction methods: | 43 // HttpTransaction methods: |
| 43 virtual int Start(const HttpRequestInfo* request_info, | 44 virtual int Start(const HttpRequestInfo* request_info, |
| 44 CompletionCallback* callback, | 45 CompletionCallback* callback, |
| 45 const BoundNetLog& net_log); | 46 const BoundNetLog& net_log); |
| 46 virtual int RestartIgnoringLastError(CompletionCallback* callback); | 47 virtual int RestartIgnoringLastError(CompletionCallback* callback); |
| 47 virtual int RestartWithCertificate(X509Certificate* client_cert, | 48 virtual int RestartWithCertificate(X509Certificate* client_cert, |
| 48 CompletionCallback* callback); | 49 CompletionCallback* callback); |
| 50 virtual void SetTLSLoginAuthData(AuthData* auth_data); |
| 51 virtual int RestartWithTLSLogin(CompletionCallback* callback); |
| 49 virtual int RestartWithAuth(const string16& username, | 52 virtual int RestartWithAuth(const string16& username, |
| 50 const string16& password, | 53 const string16& password, |
| 51 CompletionCallback* callback); | 54 CompletionCallback* callback); |
| 52 virtual bool IsReadyToRestartForAuth(); | 55 virtual bool IsReadyToRestartForAuth(); |
| 53 | 56 |
| 54 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); | 57 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); |
| 55 virtual void StopCaching() {} | 58 virtual void StopCaching() {} |
| 56 virtual const HttpResponseInfo* GetResponseInfo() const; | 59 virtual const HttpResponseInfo* GetResponseInfo() const; |
| 57 virtual LoadState GetLoadState() const; | 60 virtual LoadState GetLoadState() const; |
| 58 virtual uint64 GetUploadProgress() const; | 61 virtual uint64 GetUploadProgress() const; |
| 59 | 62 |
| 60 // StreamRequest::Delegate methods: | 63 // StreamRequest::Delegate methods: |
| 61 virtual void OnStreamReady(HttpStream* stream); | 64 virtual void OnStreamReady(HttpStream* stream); |
| 62 virtual void OnStreamFailed(int status); | 65 virtual void OnStreamFailed(int status); |
| 63 virtual void OnCertificateError(int status, const SSLInfo& ssl_info); | 66 virtual void OnCertificateError(int status, const SSLInfo& ssl_info); |
| 64 virtual void OnNeedsProxyAuth( | 67 virtual void OnNeedsProxyAuth( |
| 65 const HttpResponseInfo& response_info, | 68 const HttpResponseInfo& response_info, |
| 66 HttpAuthController* auth_controller); | 69 HttpAuthController* auth_controller); |
| 67 virtual void OnNeedsClientAuth(SSLCertRequestInfo* cert_info); | 70 virtual void OnNeedsClientAuth(SSLCertRequestInfo* cert_info); |
| 71 virtual void OnNeedsTLSLogin(AuthChallengeInfo* login_info); |
| 68 virtual void OnHttpsProxyTunnelResponse(const HttpResponseInfo& response_info, | 72 virtual void OnHttpsProxyTunnelResponse(const HttpResponseInfo& response_info, |
| 69 HttpStream* stream); | 73 HttpStream* stream); |
| 70 | 74 |
| 71 private: | 75 private: |
| 72 FRIEND_TEST_ALL_PREFIXES(HttpNetworkTransactionTest, ResetStateForRestart); | 76 FRIEND_TEST_ALL_PREFIXES(HttpNetworkTransactionTest, ResetStateForRestart); |
| 73 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, WindowUpdateReceived); | 77 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, WindowUpdateReceived); |
| 74 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, WindowUpdateSent); | 78 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, WindowUpdateSent); |
| 75 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, WindowUpdateOverflow); | 79 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, WindowUpdateOverflow); |
| 76 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, FlowControlStallResume); | 80 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, FlowControlStallResume); |
| 77 | 81 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 226 |
| 223 // True if we've validated the headers that the stream parser has returned. | 227 // True if we've validated the headers that the stream parser has returned. |
| 224 bool headers_valid_; | 228 bool headers_valid_; |
| 225 | 229 |
| 226 // True if we've logged the time of the first response byte. Used to | 230 // True if we've logged the time of the first response byte. Used to |
| 227 // prevent logging across authentication activity where we see multiple | 231 // prevent logging across authentication activity where we see multiple |
| 228 // responses. | 232 // responses. |
| 229 bool logged_response_time_; | 233 bool logged_response_time_; |
| 230 | 234 |
| 231 SSLConfig ssl_config_; | 235 SSLConfig ssl_config_; |
| 236 scoped_refptr<AuthData> tls_auth_data_; |
| 232 | 237 |
| 233 HttpRequestHeaders request_headers_; | 238 HttpRequestHeaders request_headers_; |
| 234 | 239 |
| 235 // The size in bytes of the buffer we use to drain the response body that | 240 // The size in bytes of the buffer we use to drain the response body that |
| 236 // we want to throw away. The response body is typically a small error | 241 // we want to throw away. The response body is typically a small error |
| 237 // page just a few hundred bytes long. | 242 // page just a few hundred bytes long. |
| 238 static const int kDrainBodyBufferSize = 1024; | 243 static const int kDrainBodyBufferSize = 1024; |
| 239 | 244 |
| 240 // User buffer and length passed to the Read method. | 245 // User buffer and length passed to the Read method. |
| 241 scoped_refptr<IOBuffer> read_buf_; | 246 scoped_refptr<IOBuffer> read_buf_; |
| 242 int read_buf_len_; | 247 int read_buf_len_; |
| 243 | 248 |
| 244 // The time the Start method was called. | 249 // The time the Start method was called. |
| 245 base::Time start_time_; | 250 base::Time start_time_; |
| 246 | 251 |
| 247 // The next state in the state machine. | 252 // The next state in the state machine. |
| 248 State next_state_; | 253 State next_state_; |
| 249 | 254 |
| 250 // True when the tunnel is in the process of being established - we can't | 255 // True when the tunnel is in the process of being established - we can't |
| 251 // read from the socket until the tunnel is done. | 256 // read from the socket until the tunnel is done. |
| 252 bool establishing_tunnel_; | 257 bool establishing_tunnel_; |
| 253 | 258 |
| 254 DISALLOW_COPY_AND_ASSIGN(HttpNetworkTransaction); | 259 DISALLOW_COPY_AND_ASSIGN(HttpNetworkTransaction); |
| 255 }; | 260 }; |
| 256 | 261 |
| 257 } // namespace net | 262 } // namespace net |
| 258 | 263 |
| 259 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ | 264 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ |
| OLD | NEW |