Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: net/http/http_network_transaction.h

Issue 1378613004: Set Token-Binding HTTP header (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tb-tls-ext-new
Patch Set: Remove sequence numbers from mock reads Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "crypto/ec_private_key.h"
17 #include "net/base/net_error_details.h" 18 #include "net/base/net_error_details.h"
18 #include "net/base/request_priority.h" 19 #include "net/base/request_priority.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_stream_factory.h" 23 #include "net/http/http_stream_factory.h"
23 #include "net/http/http_transaction.h" 24 #include "net/http/http_transaction.h"
24 #include "net/log/net_log.h" 25 #include "net/log/net_log.h"
25 #include "net/proxy/proxy_service.h" 26 #include "net/proxy/proxy_service.h"
26 #include "net/socket/connection_attempts.h" 27 #include "net/socket/connection_attempts.h"
28 #include "net/ssl/channel_id_service.h"
27 #include "net/ssl/ssl_config_service.h" 29 #include "net/ssl/ssl_config_service.h"
28 #include "net/ssl/ssl_failure_state.h" 30 #include "net/ssl/ssl_failure_state.h"
29 #include "net/websockets/websocket_handshake_stream_base.h" 31 #include "net/websockets/websocket_handshake_stream_base.h"
30 32
33 namespace crypto {
34 class ECPrivateKey;
35 }
36
31 namespace net { 37 namespace net {
32 38
33 class BidirectionalStreamJob; 39 class BidirectionalStreamJob;
34 class ClientSocketHandle; 40 class ClientSocketHandle;
35 class HttpAuthController; 41 class HttpAuthController;
36 class HttpNetworkSession; 42 class HttpNetworkSession;
37 class HttpStream; 43 class HttpStream;
38 class HttpStreamRequest; 44 class HttpStreamRequest;
39 class IOBuffer; 45 class IOBuffer;
40 class ProxyInfo; 46 class ProxyInfo;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 enum State { 148 enum State {
143 STATE_NOTIFY_BEFORE_CREATE_STREAM, 149 STATE_NOTIFY_BEFORE_CREATE_STREAM,
144 STATE_CREATE_STREAM, 150 STATE_CREATE_STREAM,
145 STATE_CREATE_STREAM_COMPLETE, 151 STATE_CREATE_STREAM_COMPLETE,
146 STATE_INIT_STREAM, 152 STATE_INIT_STREAM,
147 STATE_INIT_STREAM_COMPLETE, 153 STATE_INIT_STREAM_COMPLETE,
148 STATE_GENERATE_PROXY_AUTH_TOKEN, 154 STATE_GENERATE_PROXY_AUTH_TOKEN,
149 STATE_GENERATE_PROXY_AUTH_TOKEN_COMPLETE, 155 STATE_GENERATE_PROXY_AUTH_TOKEN_COMPLETE,
150 STATE_GENERATE_SERVER_AUTH_TOKEN, 156 STATE_GENERATE_SERVER_AUTH_TOKEN,
151 STATE_GENERATE_SERVER_AUTH_TOKEN_COMPLETE, 157 STATE_GENERATE_SERVER_AUTH_TOKEN_COMPLETE,
158 STATE_GET_TOKEN_BINDING_KEY,
159 STATE_GET_TOKEN_BINDING_KEY_COMPLETE,
152 STATE_INIT_REQUEST_BODY, 160 STATE_INIT_REQUEST_BODY,
153 STATE_INIT_REQUEST_BODY_COMPLETE, 161 STATE_INIT_REQUEST_BODY_COMPLETE,
154 STATE_BUILD_REQUEST, 162 STATE_BUILD_REQUEST,
155 STATE_BUILD_REQUEST_COMPLETE, 163 STATE_BUILD_REQUEST_COMPLETE,
156 STATE_SEND_REQUEST, 164 STATE_SEND_REQUEST,
157 STATE_SEND_REQUEST_COMPLETE, 165 STATE_SEND_REQUEST_COMPLETE,
158 STATE_READ_HEADERS, 166 STATE_READ_HEADERS,
159 STATE_READ_HEADERS_COMPLETE, 167 STATE_READ_HEADERS_COMPLETE,
160 STATE_READ_BODY, 168 STATE_READ_BODY,
161 STATE_READ_BODY_COMPLETE, 169 STATE_READ_BODY_COMPLETE,
162 STATE_DRAIN_BODY_FOR_AUTH_RESTART, 170 STATE_DRAIN_BODY_FOR_AUTH_RESTART,
163 STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE, 171 STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE,
164 STATE_NONE 172 STATE_NONE
165 }; 173 };
166 174
167 bool IsSecureRequest() const; 175 bool IsSecureRequest() const;
176 bool IsTokenBindingEnabled() const;
177 void RecordTokenBindingSupport() const;
168 178
169 // Returns true if the request is using an HTTP(S) proxy without being 179 // Returns true if the request is using an HTTP(S) proxy without being
170 // tunneled via the CONNECT method. 180 // tunneled via the CONNECT method.
171 bool UsingHttpProxyWithoutTunnel() const; 181 bool UsingHttpProxyWithoutTunnel() const;
172 182
173 void DoCallback(int result); 183 void DoCallback(int result);
174 void OnIOComplete(int result); 184 void OnIOComplete(int result);
175 185
176 // Runs the state transition loop. 186 // Runs the state transition loop.
177 int DoLoop(int result); 187 int DoLoop(int result);
178 188
179 // Each of these methods corresponds to a State value. Those with an input 189 // Each of these methods corresponds to a State value. Those with an input
180 // argument receive the result from the previous state. If a method returns 190 // argument receive the result from the previous state. If a method returns
181 // ERR_IO_PENDING, then the result from OnIOComplete will be passed to the 191 // ERR_IO_PENDING, then the result from OnIOComplete will be passed to the
182 // next state method as the result arg. 192 // next state method as the result arg.
183 int DoNotifyBeforeCreateStream(); 193 int DoNotifyBeforeCreateStream();
184 int DoCreateStream(); 194 int DoCreateStream();
185 int DoCreateStreamComplete(int result); 195 int DoCreateStreamComplete(int result);
186 int DoInitStream(); 196 int DoInitStream();
187 int DoInitStreamComplete(int result); 197 int DoInitStreamComplete(int result);
188 int DoGenerateProxyAuthToken(); 198 int DoGenerateProxyAuthToken();
189 int DoGenerateProxyAuthTokenComplete(int result); 199 int DoGenerateProxyAuthTokenComplete(int result);
190 int DoGenerateServerAuthToken(); 200 int DoGenerateServerAuthToken();
191 int DoGenerateServerAuthTokenComplete(int result); 201 int DoGenerateServerAuthTokenComplete(int result);
202 int DoGetTokenBindingKey();
203 int DoGetTokenBindingKeyComplete(int result);
192 int DoInitRequestBody(); 204 int DoInitRequestBody();
193 int DoInitRequestBodyComplete(int result); 205 int DoInitRequestBodyComplete(int result);
194 int DoBuildRequest(); 206 int DoBuildRequest();
195 int DoBuildRequestComplete(int result); 207 int DoBuildRequestComplete(int result);
196 int DoSendRequest(); 208 int DoSendRequest();
197 int DoSendRequestComplete(int result); 209 int DoSendRequestComplete(int result);
198 int DoReadHeaders(); 210 int DoReadHeaders();
199 int DoReadHeadersComplete(int result); 211 int DoReadHeadersComplete(int result);
200 int DoReadBody(); 212 int DoReadBody();
201 int DoReadBodyComplete(int result); 213 int DoReadBodyComplete(int result);
202 int DoDrainBodyForAuthRestart(); 214 int DoDrainBodyForAuthRestart();
203 int DoDrainBodyForAuthRestartComplete(int result); 215 int DoDrainBodyForAuthRestartComplete(int result);
204 216
205 void BuildRequestHeaders(bool using_http_proxy_without_tunnel); 217 int BuildRequestHeaders(bool using_http_proxy_without_tunnel);
218 int BuildTokenBindingHeader(std::string* out);
206 219
207 // Writes a log message to help debugging in the field when we block a proxy 220 // Writes a log message to help debugging in the field when we block a proxy
208 // response to a CONNECT request. 221 // response to a CONNECT request.
209 void LogBlockedTunnelResponse(int response_code) const; 222 void LogBlockedTunnelResponse(int response_code) const;
210 223
211 // Called to handle a client certificate request. 224 // Called to handle a client certificate request.
212 int HandleCertificateRequest(int error); 225 int HandleCertificateRequest(int error);
213 226
214 // Called wherever ERR_HTTP_1_1_REQUIRED or 227 // Called wherever ERR_HTTP_1_1_REQUIRED or
215 // ERR_PROXY_HTTP_1_1_REQUIRED has to be handled. 228 // ERR_PROXY_HTTP_1_1_REQUIRED has to be handled.
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 SSLFailureState server_ssl_failure_state_; 334 SSLFailureState server_ssl_failure_state_;
322 // fallback_error_code contains the error code that caused the last TLS 335 // fallback_error_code contains the error code that caused the last TLS
323 // fallback. If the fallback connection results in 336 // fallback. If the fallback connection results in
324 // ERR_SSL_INAPPROPRIATE_FALLBACK (i.e. the server indicated that the 337 // ERR_SSL_INAPPROPRIATE_FALLBACK (i.e. the server indicated that the
325 // fallback should not have been needed) then we use this value to return the 338 // fallback should not have been needed) then we use this value to return the
326 // original error that triggered the fallback. 339 // original error that triggered the fallback.
327 int fallback_error_code_; 340 int fallback_error_code_;
328 // The SSLFailureState which caused the last TLS version fallback. 341 // The SSLFailureState which caused the last TLS version fallback.
329 SSLFailureState fallback_failure_state_; 342 SSLFailureState fallback_failure_state_;
330 343
344 // Key to use for signing message in Token Binding header.
345 scoped_ptr<crypto::ECPrivateKey> token_binding_key_;
346 // Object to manage lookup of |token_binding_key_|.
347 ChannelIDService::Request token_binding_request_;
348
331 HttpRequestHeaders request_headers_; 349 HttpRequestHeaders request_headers_;
332 350
333 // The size in bytes of the buffer we use to drain the response body that 351 // The size in bytes of the buffer we use to drain the response body that
334 // we want to throw away. The response body is typically a small error 352 // we want to throw away. The response body is typically a small error
335 // page just a few hundred bytes long. 353 // page just a few hundred bytes long.
336 static const int kDrainBodyBufferSize = 1024; 354 static const int kDrainBodyBufferSize = 1024;
337 355
338 // User buffer and length passed to the Read method. 356 // User buffer and length passed to the Read method.
339 scoped_refptr<IOBuffer> read_buf_; 357 scoped_refptr<IOBuffer> read_buf_;
340 int read_buf_len_; 358 int read_buf_len_;
(...skipping 29 matching lines...) Expand all
370 ConnectionAttempts connection_attempts_; 388 ConnectionAttempts connection_attempts_;
371 IPEndPoint remote_endpoint_; 389 IPEndPoint remote_endpoint_;
372 // Network error details for this transaction. 390 // Network error details for this transaction.
373 NetErrorDetails net_error_details_; 391 NetErrorDetails net_error_details_;
374 DISALLOW_COPY_AND_ASSIGN(HttpNetworkTransaction); 392 DISALLOW_COPY_AND_ASSIGN(HttpNetworkTransaction);
375 }; 393 };
376 394
377 } // namespace net 395 } // namespace net
378 396
379 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ 397 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698