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

Side by Side Diff: net/socket/ssl_client_socket_win.cc

Issue 848006: Generalize the net module's LoadLog facility from a passive container, to an event stream (NetLog). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Split up RequestTracker into ConnectJobTracker+RequestTracker+RequestTrackerBase, address comments Created 10 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « net/socket/ssl_client_socket_win.h ('k') | net/socket/tcp_client_socket_libevent.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2009 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 #include "net/socket/ssl_client_socket_win.h" 5 #include "net/socket/ssl_client_socket_win.h"
6 6
7 #include <schnlsp.h> 7 #include <schnlsp.h>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/lock.h" 10 #include "base/lock.h"
11 #include "base/singleton.h" 11 #include "base/singleton.h"
12 #include "base/stl_util-inl.h" 12 #include "base/stl_util-inl.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "net/base/cert_verifier.h" 14 #include "net/base/cert_verifier.h"
15 #include "net/base/connection_type_histograms.h" 15 #include "net/base/connection_type_histograms.h"
16 #include "net/base/io_buffer.h" 16 #include "net/base/io_buffer.h"
17 #include "net/base/load_log.h" 17 #include "net/base/net_log.h"
18 #include "net/base/net_errors.h" 18 #include "net/base/net_errors.h"
19 #include "net/base/ssl_cert_request_info.h" 19 #include "net/base/ssl_cert_request_info.h"
20 #include "net/base/ssl_info.h" 20 #include "net/base/ssl_info.h"
21 21
22 #pragma comment(lib, "secur32.lib") 22 #pragma comment(lib, "secur32.lib")
23 23
24 namespace net { 24 namespace net {
25 25
26 //----------------------------------------------------------------------------- 26 //-----------------------------------------------------------------------------
27 27
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 DCHECK(ok); 424 DCHECK(ok);
425 } 425 }
426 426
427 SSLClientSocket::NextProtoStatus 427 SSLClientSocket::NextProtoStatus
428 SSLClientSocketWin::GetNextProto(std::string* proto) { 428 SSLClientSocketWin::GetNextProto(std::string* proto) {
429 proto->clear(); 429 proto->clear();
430 return kNextProtoUnsupported; 430 return kNextProtoUnsupported;
431 } 431 }
432 432
433 int SSLClientSocketWin::Connect(CompletionCallback* callback, 433 int SSLClientSocketWin::Connect(CompletionCallback* callback,
434 LoadLog* load_log) { 434 const BoundNetLog& net_log) {
435 DCHECK(transport_.get()); 435 DCHECK(transport_.get());
436 DCHECK(next_state_ == STATE_NONE); 436 DCHECK(next_state_ == STATE_NONE);
437 DCHECK(!user_connect_callback_); 437 DCHECK(!user_connect_callback_);
438 438
439 LoadLog::BeginEvent(load_log, LoadLog::TYPE_SSL_CONNECT); 439 net_log.BeginEvent(NetLog::TYPE_SSL_CONNECT);
440 440
441 int rv = InitializeSSLContext(); 441 int rv = InitializeSSLContext();
442 if (rv != OK) { 442 if (rv != OK) {
443 LoadLog::EndEvent(load_log, LoadLog::TYPE_SSL_CONNECT); 443 net_log.EndEvent(NetLog::TYPE_SSL_CONNECT);
444 return rv; 444 return rv;
445 } 445 }
446 446
447 writing_first_token_ = true; 447 writing_first_token_ = true;
448 next_state_ = STATE_HANDSHAKE_WRITE; 448 next_state_ = STATE_HANDSHAKE_WRITE;
449 rv = DoLoop(OK); 449 rv = DoLoop(OK);
450 if (rv == ERR_IO_PENDING) { 450 if (rv == ERR_IO_PENDING) {
451 user_connect_callback_ = callback; 451 user_connect_callback_ = callback;
452 load_log_ = load_log; 452 net_log_ = net_log;
453 } else { 453 } else {
454 LoadLog::EndEvent(load_log, LoadLog::TYPE_SSL_CONNECT); 454 net_log.EndEvent(NetLog::TYPE_SSL_CONNECT);
455 } 455 }
456 return rv; 456 return rv;
457 } 457 }
458 458
459 int SSLClientSocketWin::InitializeSSLContext() { 459 int SSLClientSocketWin::InitializeSSLContext() {
460 int ssl_version_mask = 0; 460 int ssl_version_mask = 0;
461 if (ssl_config_.ssl2_enabled) 461 if (ssl_config_.ssl2_enabled)
462 ssl_version_mask |= SSL2; 462 ssl_version_mask |= SSL2;
463 if (ssl_config_.ssl3_enabled) 463 if (ssl_config_.ssl3_enabled)
464 ssl_version_mask |= SSL3; 464 ssl_version_mask |= SSL3;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 // (which occurs because we are in the middle of a Read when the 648 // (which occurs because we are in the middle of a Read when the
649 // renegotiation process starts). So we complete the Read here. 649 // renegotiation process starts). So we complete the Read here.
650 if (!user_connect_callback_) { 650 if (!user_connect_callback_) {
651 CompletionCallback* c = user_read_callback_; 651 CompletionCallback* c = user_read_callback_;
652 user_read_callback_ = NULL; 652 user_read_callback_ = NULL;
653 user_read_buf_ = NULL; 653 user_read_buf_ = NULL;
654 user_read_buf_len_ = 0; 654 user_read_buf_len_ = 0;
655 c->Run(rv); 655 c->Run(rv);
656 return; 656 return;
657 } 657 }
658 LoadLog::EndEvent(load_log_, LoadLog::TYPE_SSL_CONNECT); 658 net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT);
659 load_log_ = NULL; 659 net_log_ = BoundNetLog();
660 CompletionCallback* c = user_connect_callback_; 660 CompletionCallback* c = user_connect_callback_;
661 user_connect_callback_ = NULL; 661 user_connect_callback_ = NULL;
662 c->Run(rv); 662 c->Run(rv);
663 } 663 }
664 } 664 }
665 665
666 void SSLClientSocketWin::OnReadComplete(int result) { 666 void SSLClientSocketWin::OnReadComplete(int result) {
667 DCHECK(completed_handshake()); 667 DCHECK(completed_handshake());
668 668
669 result = DoPayloadReadComplete(result); 669 result = DoPayloadReadComplete(result);
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 UpdateConnectionTypeHistograms(CONNECTION_SSL_MD2_CA); 1338 UpdateConnectionTypeHistograms(CONNECTION_SSL_MD2_CA);
1339 } 1339 }
1340 1340
1341 void SSLClientSocketWin::FreeSendBuffer() { 1341 void SSLClientSocketWin::FreeSendBuffer() {
1342 SECURITY_STATUS status = FreeContextBuffer(send_buffer_.pvBuffer); 1342 SECURITY_STATUS status = FreeContextBuffer(send_buffer_.pvBuffer);
1343 DCHECK(status == SEC_E_OK); 1343 DCHECK(status == SEC_E_OK);
1344 memset(&send_buffer_, 0, sizeof(send_buffer_)); 1344 memset(&send_buffer_, 0, sizeof(send_buffer_));
1345 } 1345 }
1346 1346
1347 } // namespace net 1347 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_win.h ('k') | net/socket/tcp_client_socket_libevent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698