blob: 796b289a6fc5ad3d2702101a82ab18e08ffae67e [file] [log] [blame]
[email protected]448d4ca52012-03-04 04:12:231// Copyright (c) 2012 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commit586acc5fe2008-07-26 22:42:524
5#ifndef NET_HTTP_HTTP_NETWORK_TRANSACTION_H_
6#define NET_HTTP_HTTP_NETWORK_TRANSACTION_H_
7
sclittlefb249892015-09-10 21:33:228#include <stdint.h>
9
danakj1fd259a02016-04-16 03:17:0910#include <memory>
[email protected]96d570e42008-08-05 22:43:0411#include <string>
12
[email protected]8822f382010-07-30 21:49:0313#include "base/gtest_prod_util.h"
Avi Drissman13fc8932015-12-20 04:40:4614#include "base/macros.h"
[email protected]3b63f8f42011-03-28 01:54:1515#include "base/memory/ref_counted.h"
[email protected]66e96c42013-06-28 15:20:3116#include "base/time/time.h"
nharperb7441ef2016-01-25 23:54:1417#include "crypto/ec_private_key.h"
Bence Béky61f756c2018-04-25 14:17:5318#include "net/base/completion_repeating_callback.h"
zhongyi48704c182015-12-07 07:52:0219#include "net/base/net_error_details.h"
bnc81c46c1f2016-10-04 16:25:5920#include "net/base/net_export.h"
[email protected]8e6441ca2010-08-19 05:56:3821#include "net/base/request_priority.h"
[email protected]c3b35c22008-09-27 03:19:4222#include "net/http/http_auth.h"
[email protected]b94f92d2010-10-27 16:45:2023#include "net/http/http_request_headers.h"
initial.commit586acc5fe2008-07-26 22:42:5224#include "net/http/http_response_info.h"
[email protected]102e27c2011-02-23 01:01:3125#include "net/http/http_stream_factory.h"
Bence Béky6b44abf2018-04-11 10:32:5126#include "net/http/http_stream_request.h"
initial.commit586acc5fe2008-07-26 22:42:5227#include "net/http/http_transaction.h"
mikecironef22f9812016-10-04 03:40:1928#include "net/log/net_log_with_source.h"
Lily Houghtonffe89daa02018-03-09 18:30:0329#include "net/proxy_resolution/proxy_resolution_service.h"
ttuttle1f2d7e92015-04-28 16:17:4730#include "net/socket/connection_attempts.h"
nharperb7441ef2016-01-25 23:54:1431#include "net/ssl/channel_id_service.h"
[email protected]536fd0b2013-03-14 17:41:5732#include "net/ssl/ssl_config_service.h"
[email protected]831e4a32013-11-14 02:14:4433#include "net/websockets/websocket_handshake_stream_base.h"
initial.commit586acc5fe2008-07-26 22:42:5234
nharperb7441ef2016-01-25 23:54:1435namespace crypto {
36class ECPrivateKey;
37}
38
initial.commit586acc5fe2008-07-26 22:42:5239namespace net {
40
xunjieli5749218c2016-03-22 16:43:0641class BidirectionalStreamImpl;
[email protected]8e6441ca2010-08-19 05:56:3842class HttpAuthController;
initial.commit586acc5fe2008-07-26 22:42:5243class HttpNetworkSession;
yhiranoa7e05bb2014-11-06 05:40:3944class HttpStream;
[email protected]8e6441ca2010-08-19 05:56:3845class IOBuffer;
[email protected]597a1ab2014-06-26 08:12:2746class ProxyInfo;
svaldez7872fd02015-11-19 21:10:5447class SSLPrivateKey;
[email protected]82918cc2010-08-25 17:24:5048struct HttpRequestInfo;
initial.commit586acc5fe2008-07-26 22:42:5249
[email protected]172da1b2011-08-12 15:52:2650class NET_EXPORT_PRIVATE HttpNetworkTransaction
51 : public HttpTransaction,
Helen Lib495c3802018-03-30 13:46:0952 public HttpStreamRequest::Delegate {
initial.commit586acc5fe2008-07-26 22:42:5253 public:
[email protected]262eec82013-03-19 21:01:3654 HttpNetworkTransaction(RequestPriority priority,
55 HttpNetworkSession* session);
initial.commit586acc5fe2008-07-26 22:42:5256
dchengb03027d2014-10-21 12:00:2057 ~HttpNetworkTransaction() override;
[email protected]af4876d2008-10-21 23:10:5758
initial.commit586acc5fe2008-07-26 22:42:5259 // HttpTransaction methods:
dchengb03027d2014-10-21 12:00:2060 int Start(const HttpRequestInfo* request_info,
61 const CompletionCallback& callback,
tfarina42834112016-09-22 13:38:2062 const NetLogWithSource& net_log) override;
dchengb03027d2014-10-21 12:00:2063 int RestartIgnoringLastError(const CompletionCallback& callback) override;
mattm436ccfe2017-06-19 20:24:0864 int RestartWithCertificate(scoped_refptr<X509Certificate> client_cert,
65 scoped_refptr<SSLPrivateKey> client_private_key,
dchengb03027d2014-10-21 12:00:2066 const CompletionCallback& callback) override;
67 int RestartWithAuth(const AuthCredentials& credentials,
68 const CompletionCallback& callback) override;
69 bool IsReadyToRestartForAuth() override;
[email protected]0757e7702009-03-27 04:00:2270
dchengb03027d2014-10-21 12:00:2071 int Read(IOBuffer* buf,
72 int buf_len,
73 const CompletionCallback& callback) override;
74 void StopCaching() override;
75 bool GetFullRequestHeaders(HttpRequestHeaders* headers) const override;
sclittle4de1bab92015-09-22 21:28:2476 int64_t GetTotalReceivedBytes() const override;
sclittlefb249892015-09-10 21:33:2277 int64_t GetTotalSentBytes() const override;
dchengb03027d2014-10-21 12:00:2078 void DoneReading() override;
79 const HttpResponseInfo* GetResponseInfo() const override;
80 LoadState GetLoadState() const override;
dchengb03027d2014-10-21 12:00:2081 void SetQuicServerInfo(QuicServerInfo* quic_server_info) override;
82 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override;
ttuttled9dbc652015-09-29 20:00:5983 bool GetRemoteEndpoint(IPEndPoint* endpoint) const override;
zhongyi48704c182015-12-07 07:52:0284 void PopulateNetErrorDetails(NetErrorDetails* details) const override;
dchengb03027d2014-10-21 12:00:2085 void SetPriority(RequestPriority priority) override;
86 void SetWebSocketHandshakeStreamCreateHelper(
mostynbba063d6032014-10-09 11:01:1387 WebSocketHandshakeStreamBase::CreateHelper* create_helper) override;
dchengb03027d2014-10-21 12:00:2088 void SetBeforeNetworkStartCallback(
mostynbba063d6032014-10-09 11:01:1389 const BeforeNetworkStartCallback& callback) override;
ryansturm49a8cb12016-06-15 16:51:0990 void SetBeforeHeadersSentCallback(
91 const BeforeHeadersSentCallback& callback) override;
Andrey Kosyakov2e893e62017-08-31 17:00:5292 void SetRequestHeadersCallback(RequestHeadersCallback callback) override;
93 void SetResponseHeadersCallback(ResponseHeadersCallback callback) override;
Andrey Kosyakov83a6eee2017-08-14 19:20:0494
dchengb03027d2014-10-21 12:00:2095 int ResumeNetworkStart() override;
initial.commit586acc5fe2008-07-26 22:42:5296
[email protected]102e27c2011-02-23 01:01:3197 // HttpStreamRequest::Delegate methods:
dchengb03027d2014-10-21 12:00:2098 void OnStreamReady(const SSLConfig& used_ssl_config,
99 const ProxyInfo& used_proxy_info,
bnc5029f4632017-06-08 16:19:00100 std::unique_ptr<HttpStream> stream) override;
101 void OnBidirectionalStreamImplReady(
102 const SSLConfig& used_ssl_config,
103 const ProxyInfo& used_proxy_info,
104 std::unique_ptr<BidirectionalStreamImpl> stream) override;
dchengb03027d2014-10-21 12:00:20105 void OnWebSocketHandshakeStreamReady(
[email protected]3732cea2013-06-21 06:50:50106 const SSLConfig& used_ssl_config,
107 const ProxyInfo& used_proxy_info,
bnc5029f4632017-06-08 16:19:00108 std::unique_ptr<WebSocketHandshakeStreamBase> stream) override;
Ryan Hamilton75f197262017-08-17 14:00:07109 void OnStreamFailed(int status,
110 const NetErrorDetails& net_error_details,
111 const SSLConfig& used_ssl_config) override;
dchengb03027d2014-10-21 12:00:20112 void OnCertificateError(int status,
113 const SSLConfig& used_ssl_config,
114 const SSLInfo& ssl_info) override;
115 void OnNeedsProxyAuth(const HttpResponseInfo& response_info,
116 const SSLConfig& used_ssl_config,
117 const ProxyInfo& used_proxy_info,
118 HttpAuthController* auth_controller) override;
119 void OnNeedsClientAuth(const SSLConfig& used_ssl_config,
120 SSLCertRequestInfo* cert_info) override;
121 void OnHttpsProxyTunnelResponse(const HttpResponseInfo& response_info,
[email protected]102e27c2011-02-23 01:01:31122 const SSLConfig& used_ssl_config,
dchengb03027d2014-10-21 12:00:20123 const ProxyInfo& used_proxy_info,
Bence Béky6d05ebd2017-05-16 00:09:01124 std::unique_ptr<HttpStream> stream) override;
[email protected]8e6441ca2010-08-19 05:56:38125
zhongyi48704c182015-12-07 07:52:02126 void OnQuicBroken() override;
ttuttle1f2d7e92015-04-28 16:17:47127 void GetConnectionAttempts(ConnectionAttempts* out) const override;
128
initial.commit586acc5fe2008-07-26 22:42:52129 private:
bnc1f61cdf2016-11-28 18:03:45130 FRIEND_TEST_ALL_PREFIXES(HttpNetworkTransactionTest, ResetStateForRestart);
Bence Béky2fcf4fa2018-04-06 20:06:01131 FRIEND_TEST_ALL_PREFIXES(HttpNetworkTransactionTest,
132 CreateWebSocketHandshakeStream);
bnc1f61cdf2016-11-28 18:03:45133 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, WindowUpdateReceived);
134 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, WindowUpdateSent);
135 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, WindowUpdateOverflow);
136 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, FlowControlStallResume);
[email protected]513963e2013-06-15 01:53:04137 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest,
[email protected]ca6459f862012-04-11 19:43:20138 FlowControlStallResumeAfterSettings);
[email protected]513963e2013-06-15 01:53:04139 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest,
[email protected]ca6459f862012-04-11 19:43:20140 FlowControlNegativeSendWindowSize);
[email protected]89ceba9a2009-03-21 03:46:06141
[email protected]d207a5f2009-06-04 05:28:40142 enum State {
[email protected]1826a402014-01-08 15:40:48143 STATE_NOTIFY_BEFORE_CREATE_STREAM,
[email protected]82918cc2010-08-25 17:24:50144 STATE_CREATE_STREAM,
145 STATE_CREATE_STREAM_COMPLETE,
[email protected]351ab642010-08-05 16:55:31146 STATE_INIT_STREAM,
147 STATE_INIT_STREAM_COMPLETE,
[email protected]044de0642010-06-17 10:42:15148 STATE_GENERATE_PROXY_AUTH_TOKEN,
149 STATE_GENERATE_PROXY_AUTH_TOKEN_COMPLETE,
150 STATE_GENERATE_SERVER_AUTH_TOKEN,
151 STATE_GENERATE_SERVER_AUTH_TOKEN_COMPLETE,
nharperd6e65822016-03-30 23:05:48152 STATE_GET_PROVIDED_TOKEN_BINDING_KEY,
153 STATE_GET_PROVIDED_TOKEN_BINDING_KEY_COMPLETE,
154 STATE_GET_REFERRED_TOKEN_BINDING_KEY,
155 STATE_GET_REFERRED_TOKEN_BINDING_KEY_COMPLETE,
[email protected]daddea62012-09-19 05:51:13156 STATE_INIT_REQUEST_BODY,
157 STATE_INIT_REQUEST_BODY_COMPLETE,
[email protected]4875ba12011-03-30 22:31:51158 STATE_BUILD_REQUEST,
159 STATE_BUILD_REQUEST_COMPLETE,
[email protected]0877e3d2009-10-17 22:29:57160 STATE_SEND_REQUEST,
161 STATE_SEND_REQUEST_COMPLETE,
[email protected]d207a5f2009-06-04 05:28:40162 STATE_READ_HEADERS,
163 STATE_READ_HEADERS_COMPLETE,
164 STATE_READ_BODY,
165 STATE_READ_BODY_COMPLETE,
166 STATE_DRAIN_BODY_FOR_AUTH_RESTART,
167 STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE,
168 STATE_NONE
169 };
170
Adam Ricecb76ac62015-02-20 05:33:25171 bool IsSecureRequest() const;
nharperb7441ef2016-01-25 23:54:14172 bool IsTokenBindingEnabled() const;
173 void RecordTokenBindingSupport() const;
[email protected]564b4912010-03-09 16:30:42174
Adam Rice425cf122015-01-19 06:18:24175 // Returns true if the request is using an HTTP(S) proxy without being
176 // tunneled via the CONNECT method.
177 bool UsingHttpProxyWithoutTunnel() const;
178
initial.commit586acc5fe2008-07-26 22:42:52179 void DoCallback(int result);
180 void OnIOComplete(int result);
181
182 // Runs the state transition loop.
183 int DoLoop(int result);
184
185 // Each of these methods corresponds to a State value. Those with an input
186 // argument receive the result from the previous state. If a method returns
187 // ERR_IO_PENDING, then the result from OnIOComplete will be passed to the
188 // next state method as the result arg.
[email protected]1826a402014-01-08 15:40:48189 int DoNotifyBeforeCreateStream();
[email protected]82918cc2010-08-25 17:24:50190 int DoCreateStream();
191 int DoCreateStreamComplete(int result);
[email protected]351ab642010-08-05 16:55:31192 int DoInitStream();
193 int DoInitStreamComplete(int result);
[email protected]044de0642010-06-17 10:42:15194 int DoGenerateProxyAuthToken();
195 int DoGenerateProxyAuthTokenComplete(int result);
196 int DoGenerateServerAuthToken();
197 int DoGenerateServerAuthTokenComplete(int result);
nharperd6e65822016-03-30 23:05:48198 int DoGetProvidedTokenBindingKey();
199 int DoGetProvidedTokenBindingKeyComplete(int result);
200 int DoGetReferredTokenBindingKey();
201 int DoGetReferredTokenBindingKeyComplete(int result);
[email protected]daddea62012-09-19 05:51:13202 int DoInitRequestBody();
203 int DoInitRequestBodyComplete(int result);
[email protected]4875ba12011-03-30 22:31:51204 int DoBuildRequest();
205 int DoBuildRequestComplete(int result);
[email protected]0877e3d2009-10-17 22:29:57206 int DoSendRequest();
207 int DoSendRequestComplete(int result);
initial.commit586acc5fe2008-07-26 22:42:52208 int DoReadHeaders();
209 int DoReadHeadersComplete(int result);
210 int DoReadBody();
211 int DoReadBodyComplete(int result);
[email protected]2d2697f92009-02-18 21:00:32212 int DoDrainBodyForAuthRestart();
213 int DoDrainBodyForAuthRestartComplete(int result);
initial.commit586acc5fe2008-07-26 22:42:52214
nharperb7441ef2016-01-25 23:54:14215 int BuildRequestHeaders(bool using_http_proxy_without_tunnel);
216 int BuildTokenBindingHeader(std::string* out);
[email protected]2979a492011-04-06 00:29:14217
[email protected]9f9f86c2009-03-12 22:32:42218 // Writes a log message to help debugging in the field when we block a proxy
219 // response to a CONNECT request.
[email protected]af89ba62009-03-16 20:26:38220 void LogBlockedTunnelResponse(int response_code) const;
[email protected]9f9f86c2009-03-12 22:32:42221
[email protected]0b45559b2009-06-12 21:45:11222 // Called to handle a client certificate request.
[email protected]5e363962009-06-19 19:57:01223 int HandleCertificateRequest(int error);
[email protected]0b45559b2009-06-12 21:45:11224
bncfacdd852015-01-09 19:22:54225 // Called wherever ERR_HTTP_1_1_REQUIRED or
226 // ERR_PROXY_HTTP_1_1_REQUIRED has to be handled.
227 int HandleHttp11Required(int error);
228
David Benjamin76a40ad2018-02-24 22:22:08229 // Called to possibly handle a client authentication error. Sets next_state_
[email protected]bd0b6772011-01-11 19:59:30230 // and returns OK if recovering from the error. Otherwise, the same error
231 // code is returned.
David Benjamin76a40ad2018-02-24 22:22:08232 int HandleSSLClientAuthError(int error);
[email protected]bd0b6772011-01-11 19:59:30233
initial.commit586acc5fe2008-07-26 22:42:52234 // Called to possibly recover from the given error. Sets next_state_ and
235 // returns OK if recovering from the error. Otherwise, the same error code
236 // is returned.
237 int HandleIOError(int error);
238
[email protected]0877e3d2009-10-17 22:29:57239 // Gets the response headers from the HttpStream.
240 HttpResponseHeaders* GetResponseHeaders() const;
241
[email protected]a34f61ee2014-03-18 20:59:49242 // Called when the socket is unexpectedly closed. Returns true if the request
243 // should be resent in case of a socket reuse/close race.
244 bool ShouldResendRequest() const;
[email protected]1c773ea12009-04-28 19:58:42245
Biljith Jayan45a41722017-08-16 18:43:14246 // Returns true if there have already been |kMaxRetryAttempts| retries for
247 // HTTP2 or QUIC network errors, and no further retries should be attempted.
248 bool HasExceededMaxRetries() const;
249
David Benjamin83ddfb32018-03-30 01:07:52250 // Increments the number of restarts and returns true if the restart may
251 // proceed.
252 bool CheckMaxRestarts();
253
[email protected]1c773ea12009-04-28 19:58:42254 // Resets the connection and the request headers for resend. Called when
255 // ShouldResendRequest() is true.
256 void ResetConnectionAndRequestForResend();
[email protected]2a5c76b2008-09-25 22:15:16257
[email protected]f9ee6b52008-11-08 06:46:23258 // Sets up the state machine to restart the transaction with auth.
259 void PrepareForAuthRestart(HttpAuth::Target target);
260
[email protected]2d2697f92009-02-18 21:00:32261 // Called when we don't need to drain the response body or have drained it.
262 // Resets |connection_| unless |keep_alive| is true, then calls
263 // ResetStateForRestart. Sets |next_state_| appropriately.
264 void DidDrainBodyForAuthRestart(bool keep_alive);
265
[email protected]f9ee6b52008-11-08 06:46:23266 // Resets the members of the transaction so it can be restarted.
[email protected]c3b35c22008-09-27 03:19:42267 void ResetStateForRestart();
268
[email protected]697ef4c2010-10-14 16:38:58269 // Resets the members of the transaction, except |stream_|, which needs
270 // to be maintained for multi-round auth.
271 void ResetStateForAuthRestart();
272
zhongyica364fbb2015-12-12 03:39:12273 // Caches network error details from the stream if available
274 // and resets the stream.
275 void CacheNetErrorDetailsAndResetStream();
276
[email protected]1c773ea12009-04-28 19:58:42277 // Returns true if we should try to add a Proxy-Authorization header
278 bool ShouldApplyProxyAuth() const;
[email protected]c3b35c22008-09-27 03:19:42279
[email protected]1c773ea12009-04-28 19:58:42280 // Returns true if we should try to add an Authorization header.
281 bool ShouldApplyServerAuth() const;
282
[email protected]f9ee6b52008-11-08 06:46:23283 // Handles HTTP status code 401 or 407.
[email protected]0757e7702009-03-27 04:00:22284 // HandleAuthChallenge() returns a network error code, or OK on success.
285 // May update |pending_auth_target_| or |response_.auth_challenge|.
[email protected]e772db3f2010-07-12 18:11:13286 int HandleAuthChallenge();
[email protected]f9ee6b52008-11-08 06:46:23287
[email protected]8e6441ca2010-08-19 05:56:38288 // Returns true if we have auth credentials for the given target.
289 bool HaveAuth(HttpAuth::Target target) const;
[email protected]c3b35c22008-09-27 03:19:42290
[email protected]228404f2010-06-24 04:31:41291 // Get the {scheme, host, path, port} for the authentication target
292 GURL AuthURL(HttpAuth::Target target) const;
[email protected]044de0642010-06-17 10:42:15293
[email protected]831e4a32013-11-14 02:14:44294 // Returns true if this transaction is for a WebSocket handshake
295 bool ForWebSocketHandshake() const;
296
ttuttle1f2d7e92015-04-28 16:17:47297 void CopyConnectionAttemptsFromStreamRequest();
298
eustasc7d27da2017-04-06 10:33:20299 // Returns true if response "Content-Encoding" headers respect
300 // "Accept-Encoding".
301 bool ContentEncodingsValid() const;
302
[email protected]e772db3f2010-07-12 18:11:13303 scoped_refptr<HttpAuthController>
304 auth_controllers_[HttpAuth::AUTH_NUM_TARGETS];
[email protected]c3b35c22008-09-27 03:19:42305
[email protected]0757e7702009-03-27 04:00:22306 // Whether this transaction is waiting for proxy auth, server auth, or is
307 // not waiting for any auth at all. |pending_auth_target_| is read and
308 // cleared by RestartWithAuth().
309 HttpAuth::Target pending_auth_target_;
310
Bence Béky61f756c2018-04-25 14:17:53311 CompletionRepeatingCallback io_callback_;
[email protected]49639fa2011-12-20 23:22:41312 CompletionCallback callback_;
initial.commit586acc5fe2008-07-26 22:42:52313
[email protected]3fe8d2f82013-10-17 08:56:07314 HttpNetworkSession* session_;
initial.commit586acc5fe2008-07-26 22:42:52315
tfarina42834112016-09-22 13:38:20316 NetLogWithSource net_log_;
shivanisha0b440852016-10-18 15:48:15317
318 // Reset to null at the start of the Read state machine.
initial.commit586acc5fe2008-07-26 22:42:52319 const HttpRequestInfo* request_;
shivanisha0b440852016-10-18 15:48:15320
321 // The requested URL.
322 GURL url_;
[email protected]262eec82013-03-19 21:01:36323 RequestPriority priority_;
[email protected]a7e41312009-12-16 23:18:14324 HttpResponseInfo response_;
initial.commit586acc5fe2008-07-26 22:42:52325
[email protected]102e27c2011-02-23 01:01:31326 // |proxy_info_| is the ProxyInfo used by the HttpStreamRequest.
[email protected]928fb582008-08-11 15:40:23327 ProxyInfo proxy_info_;
initial.commit586acc5fe2008-07-26 22:42:52328
danakj1fd259a02016-04-16 03:17:09329 std::unique_ptr<HttpStreamRequest> stream_request_;
330 std::unique_ptr<HttpStream> stream_;
[email protected]8e6441ca2010-08-19 05:56:38331
[email protected]0877e3d2009-10-17 22:29:57332 // True if we've validated the headers that the stream parser has returned.
333 bool headers_valid_;
334
Steven Valdezb4ff0412018-01-18 22:39:27335 // True if we can send the request over early data.
336 bool can_send_early_data_;
337
David Benjamin76a40ad2018-02-24 22:22:08338 // True if |server_ssl_config_.client_cert| was looked up from the
339 // SSLClientAuthCache, rather than provided externally by the caller.
340 bool server_ssl_client_cert_was_cached_;
341
David Benjamin5cb91132018-04-06 05:54:49342 // SSL configuration used for the server and proxy, respectively. Note
343 // |server_ssl_config_| may be updated from the HttpStreamFactory, which will
344 // be applied on retry.
345 //
346 // TODO(davidben): Mutating it is weird and relies on HttpStreamFactory
347 // modifications being idempotent. Address this as part of other work to make
348 // sense of SSLConfig (related to https://crbug.com/488043).
[email protected]102957f2011-09-02 17:10:14349 SSLConfig server_ssl_config_;
350 SSLConfig proxy_ssl_config_;
[email protected]c5949a32008-10-08 17:28:23351
nharperd6e65822016-03-30 23:05:48352 // Keys to use for signing message in Token Binding header.
danakj1fd259a02016-04-16 03:17:09353 std::unique_ptr<crypto::ECPrivateKey> provided_token_binding_key_;
354 std::unique_ptr<crypto::ECPrivateKey> referred_token_binding_key_;
nharperd6e65822016-03-30 23:05:48355 // Object to manage lookup of |provided_token_binding_key_| and
356 // |referred_token_binding_key_|.
nharperb7441ef2016-01-25 23:54:14357 ChannelIDService::Request token_binding_request_;
358
[email protected]b94f92d2010-10-27 16:45:20359 HttpRequestHeaders request_headers_;
[email protected]4ddaf2502008-10-23 18:26:19360
[email protected]2d2697f92009-02-18 21:00:32361 // The size in bytes of the buffer we use to drain the response body that
362 // we want to throw away. The response body is typically a small error
363 // page just a few hundred bytes long.
[email protected]81854c42010-09-22 03:39:36364 static const int kDrainBodyBufferSize = 1024;
[email protected]2d2697f92009-02-18 21:00:32365
initial.commit586acc5fe2008-07-26 22:42:52366 // User buffer and length passed to the Read method.
[email protected]9dea9e1f2009-01-29 00:30:47367 scoped_refptr<IOBuffer> read_buf_;
initial.commit586acc5fe2008-07-26 22:42:52368 int read_buf_len_;
369
sclittlefb249892015-09-10 21:33:22370 // Total number of bytes received on all destroyed HttpStreams for this
371 // transaction.
sclittle4de1bab92015-09-22 21:28:24372 int64_t total_received_bytes_;
[email protected]b8015c42013-12-24 15:18:19373
sclittlefb249892015-09-10 21:33:22374 // Total number of bytes sent on all destroyed HttpStreams for this
375 // transaction.
376 int64_t total_sent_bytes_;
377
[email protected]58e32bb2013-01-21 18:23:25378 // When the transaction started / finished sending the request, including
379 // the body, if present.
380 base::TimeTicks send_start_time_;
381 base::TimeTicks send_end_time_;
382
[email protected]d207a5f2009-06-04 05:28:40383 // The next state in the state machine.
initial.commit586acc5fe2008-07-26 22:42:52384 State next_state_;
[email protected]2ff8b312010-04-26 22:20:54385
[email protected]a7ea8832010-07-12 17:54:54386 // True when the tunnel is in the process of being established - we can't
387 // read from the socket until the tunnel is done.
388 bool establishing_tunnel_;
389
bnc8016c1f2017-03-31 02:11:29390 // Enable pooling to a SpdySession with matching IP and certificate
391 // even if the SpdySessionKey is different.
392 bool enable_ip_based_pooling_;
393
bncaccd4962017-04-06 21:00:26394 // Enable using alternative services for the request.
395 bool enable_alternative_services_;
396
rch2f2991c2017-04-13 19:28:17397 // When a request is retried because of errors with the alternative service,
398 // this will store the alternative service used.
399 AlternativeService retried_alternative_service_;
400
[email protected]831e4a32013-11-14 02:14:44401 // The helper object to use to create WebSocketHandshakeStreamBase
402 // objects. Only relevant when establishing a WebSocket connection.
403 WebSocketHandshakeStreamBase::CreateHelper*
404 websocket_handshake_stream_base_create_helper_;
405
[email protected]1826a402014-01-08 15:40:48406 BeforeNetworkStartCallback before_network_start_callback_;
ryansturm49a8cb12016-06-15 16:51:09407 BeforeHeadersSentCallback before_headers_sent_callback_;
Andrey Kosyakov83a6eee2017-08-14 19:20:04408 RequestHeadersCallback request_headers_callback_;
Andrey Kosyakov2e893e62017-08-31 17:00:52409 ResponseHeadersCallback response_headers_callback_;
[email protected]1826a402014-01-08 15:40:48410
ttuttle1f2d7e92015-04-28 16:17:47411 ConnectionAttempts connection_attempts_;
ttuttled9dbc652015-09-29 20:00:59412 IPEndPoint remote_endpoint_;
zhongyica364fbb2015-12-12 03:39:12413 // Network error details for this transaction.
414 NetErrorDetails net_error_details_;
rdsmith1d343be52016-10-21 20:37:50415
Biljith Jayan45a41722017-08-16 18:43:14416 // Number of retries made for network errors like ERR_SPDY_PING_FAILED,
417 // ERR_SPDY_SERVER_REFUSED_STREAM, ERR_QUIC_HANDSHAKE_FAILED and
418 // ERR_QUIC_PROTOCOL_ERROR. Currently we stop after 3 tries
419 // (including the initial request) and fail the request.
420 // This count excludes retries on reused sockets since a well
421 // behaved server may time those out and thus the number
422 // of times we can retry a request on reused sockets is limited.
423 size_t retry_attempts_;
424
David Benjamin83ddfb32018-03-30 01:07:52425 // Number of times the transaction was restarted via a RestartWith* call.
426 size_t num_restarts_;
427
David Benjamin5cb91132018-04-06 05:54:49428 // The net::Error which triggered a TLS 1.3 version interference probe, or OK
429 // if none was triggered.
430 int ssl_version_interference_error_;
431
[email protected]2ff8b312010-04-26 22:20:54432 DISALLOW_COPY_AND_ASSIGN(HttpNetworkTransaction);
initial.commit586acc5fe2008-07-26 22:42:52433};
434
435} // namespace net
436
437#endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_