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

Side by Side Diff: net/socket/ssl_client_socket_nss.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_nss.h ('k') | net/socket/ssl_client_socket_unittest.cc » ('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 // This file includes code SSLClientSocketNSS::DoVerifyCertComplete() derived 5 // This file includes code SSLClientSocketNSS::DoVerifyCertComplete() derived
6 // from AuthCertificateCallback() in 6 // from AuthCertificateCallback() in
7 // mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp. 7 // mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp.
8 8
9 /* ***** BEGIN LICENSE BLOCK ***** 9 /* ***** BEGIN LICENSE BLOCK *****
10 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 10 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 #include <pk11pub.h> 60 #include <pk11pub.h>
61 61
62 #include "base/compiler_specific.h" 62 #include "base/compiler_specific.h"
63 #include "base/logging.h" 63 #include "base/logging.h"
64 #include "base/nss_util.h" 64 #include "base/nss_util.h"
65 #include "base/singleton.h" 65 #include "base/singleton.h"
66 #include "base/string_util.h" 66 #include "base/string_util.h"
67 #include "net/base/address_list.h" 67 #include "net/base/address_list.h"
68 #include "net/base/cert_verifier.h" 68 #include "net/base/cert_verifier.h"
69 #include "net/base/io_buffer.h" 69 #include "net/base/io_buffer.h"
70 #include "net/base/load_log.h" 70 #include "net/base/net_log.h"
71 #include "net/base/net_errors.h" 71 #include "net/base/net_errors.h"
72 #include "net/base/ssl_cert_request_info.h" 72 #include "net/base/ssl_cert_request_info.h"
73 #include "net/base/ssl_info.h" 73 #include "net/base/ssl_info.h"
74 #include "net/base/sys_addrinfo.h" 74 #include "net/base/sys_addrinfo.h"
75 #include "net/ocsp/nss_ocsp.h" 75 #include "net/ocsp/nss_ocsp.h"
76 76
77 static const int kRecvBufferSize = 4096; 77 static const int kRecvBufferSize = 4096;
78 78
79 namespace net { 79 namespace net {
80 80
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 // by MessageLoopForIO::current(). 264 // by MessageLoopForIO::current().
265 // X509Certificate::Verify() runs on a worker thread of CertVerifier. 265 // X509Certificate::Verify() runs on a worker thread of CertVerifier.
266 EnsureOCSPInit(); 266 EnsureOCSPInit();
267 #endif 267 #endif
268 268
269 LeaveFunction(""); 269 LeaveFunction("");
270 return OK; 270 return OK;
271 } 271 }
272 272
273 int SSLClientSocketNSS::Connect(CompletionCallback* callback, 273 int SSLClientSocketNSS::Connect(CompletionCallback* callback,
274 LoadLog* load_log) { 274 const BoundNetLog& net_log) {
275 EnterFunction(""); 275 EnterFunction("");
276 DCHECK(transport_.get()); 276 DCHECK(transport_.get());
277 DCHECK(next_handshake_state_ == STATE_NONE); 277 DCHECK(next_handshake_state_ == STATE_NONE);
278 DCHECK(!user_read_callback_); 278 DCHECK(!user_read_callback_);
279 DCHECK(!user_write_callback_); 279 DCHECK(!user_write_callback_);
280 DCHECK(!user_connect_callback_); 280 DCHECK(!user_connect_callback_);
281 DCHECK(!user_read_buf_); 281 DCHECK(!user_read_buf_);
282 DCHECK(!user_write_buf_); 282 DCHECK(!user_write_buf_);
283 283
284 LoadLog::BeginEvent(load_log, LoadLog::TYPE_SSL_CONNECT); 284 net_log.BeginEvent(NetLog::TYPE_SSL_CONNECT);
285 285
286 if (Init() != OK) { 286 if (Init() != OK) {
287 NOTREACHED() << "Couldn't initialize nss"; 287 NOTREACHED() << "Couldn't initialize nss";
288 } 288 }
289 289
290 int rv = InitializeSSLOptions(); 290 int rv = InitializeSSLOptions();
291 if (rv != OK) { 291 if (rv != OK) {
292 LoadLog::EndEvent(load_log, LoadLog::TYPE_SSL_CONNECT); 292 net_log.EndEvent(NetLog::TYPE_SSL_CONNECT);
293 return rv; 293 return rv;
294 } 294 }
295 295
296 GotoState(STATE_HANDSHAKE); 296 GotoState(STATE_HANDSHAKE);
297 rv = DoHandshakeLoop(OK); 297 rv = DoHandshakeLoop(OK);
298 if (rv == ERR_IO_PENDING) { 298 if (rv == ERR_IO_PENDING) {
299 user_connect_callback_ = callback; 299 user_connect_callback_ = callback;
300 load_log_ = load_log; 300 net_log_ = net_log;
301 } else { 301 } else {
302 LoadLog::EndEvent(load_log, LoadLog::TYPE_SSL_CONNECT); 302 net_log.EndEvent(NetLog::TYPE_SSL_CONNECT);
303 } 303 }
304 304
305 LeaveFunction(""); 305 LeaveFunction("");
306 return rv > OK ? OK : rv; 306 return rv > OK ? OK : rv;
307 } 307 }
308 308
309 int SSLClientSocketNSS::InitializeSSLOptions() { 309 int SSLClientSocketNSS::InitializeSSLOptions() {
310 // Transport connected, now hook it up to nss 310 // Transport connected, now hook it up to nss
311 // TODO(port): specify rx and tx buffer sizes separately 311 // TODO(port): specify rx and tx buffer sizes separately
312 nss_fd_ = memio_CreateIOLayer(kRecvBufferSize); 312 nss_fd_ = memio_CreateIOLayer(kRecvBufferSize);
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 CompletionCallback* c = user_connect_callback_; 784 CompletionCallback* c = user_connect_callback_;
785 user_connect_callback_ = NULL; 785 user_connect_callback_ = NULL;
786 c->Run(rv > OK ? OK : rv); 786 c->Run(rv > OK ? OK : rv);
787 LeaveFunction(""); 787 LeaveFunction("");
788 } 788 }
789 789
790 void SSLClientSocketNSS::OnHandshakeIOComplete(int result) { 790 void SSLClientSocketNSS::OnHandshakeIOComplete(int result) {
791 EnterFunction(result); 791 EnterFunction(result);
792 int rv = DoHandshakeLoop(result); 792 int rv = DoHandshakeLoop(result);
793 if (rv != ERR_IO_PENDING) { 793 if (rv != ERR_IO_PENDING) {
794 LoadLog::EndEvent(load_log_, net::LoadLog::TYPE_SSL_CONNECT); 794 net_log_.EndEvent(net::NetLog::TYPE_SSL_CONNECT);
795 load_log_ = NULL; 795 net_log_ = BoundNetLog();
796 DoConnectCallback(rv); 796 DoConnectCallback(rv);
797 } 797 }
798 LeaveFunction(""); 798 LeaveFunction("");
799 } 799 }
800 800
801 void SSLClientSocketNSS::OnSendComplete(int result) { 801 void SSLClientSocketNSS::OnSendComplete(int result) {
802 EnterFunction(result); 802 EnterFunction(result);
803 if (next_handshake_state_ == STATE_HANDSHAKE) { 803 if (next_handshake_state_ == STATE_HANDSHAKE) {
804 // In handshake phase. 804 // In handshake phase.
805 OnHandshakeIOComplete(result); 805 OnHandshakeIOComplete(result);
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
1408 } 1408 }
1409 PRErrorCode prerr = PR_GetError(); 1409 PRErrorCode prerr = PR_GetError();
1410 if (prerr == PR_WOULD_BLOCK_ERROR) { 1410 if (prerr == PR_WOULD_BLOCK_ERROR) {
1411 return ERR_IO_PENDING; 1411 return ERR_IO_PENDING;
1412 } 1412 }
1413 LeaveFunction(""); 1413 LeaveFunction("");
1414 return MapNSPRError(prerr); 1414 return MapNSPRError(prerr);
1415 } 1415 }
1416 1416
1417 } // namespace net 1417 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_nss.h ('k') | net/socket/ssl_client_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698