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

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

Issue 1097773003: Clean up NPN/ALPN-related SSLClientSocket bits. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: const Created 5 years, 8 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
« no previous file with comments | « net/socket/ssl_client_socket_openssl.cc ('k') | no next file » | 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) 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 #include "net/socket/ssl_client_socket_pool.h" 5 #include "net/socket/ssl_client_socket_pool.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 } 322 }
323 323
324 int SSLConnectJob::DoSSLConnectComplete(int result) { 324 int SSLConnectJob::DoSSLConnectComplete(int result) {
325 // TODO(rvargas): Remove ScopedTracker below once crbug.com/462784 is fixed. 325 // TODO(rvargas): Remove ScopedTracker below once crbug.com/462784 is fixed.
326 tracked_objects::ScopedTracker tracking_profile( 326 tracked_objects::ScopedTracker tracking_profile(
327 FROM_HERE_WITH_EXPLICIT_FUNCTION( 327 FROM_HERE_WITH_EXPLICIT_FUNCTION(
328 "462784 SSLConnectJob::DoSSLConnectComplete")); 328 "462784 SSLConnectJob::DoSSLConnectComplete"));
329 329
330 connect_timing_.ssl_end = base::TimeTicks::Now(); 330 connect_timing_.ssl_end = base::TimeTicks::Now();
331 331
332 SSLClientSocket::NextProtoStatus status = 332 if (params_->want_spdy_over_npn() &&
333 SSLClientSocket::kNextProtoUnsupported; 333 !NextProtoIsSPDY(ssl_socket_->GetNegotiatedProtocol())) {
334 std::string proto; 334 return ERR_NPN_NEGOTIATION_FAILED;
335 // GetNextProto will fail and and trigger a NOTREACHED if we pass in a socket
336 // that hasn't had SSL_ImportFD called on it. If we get a certificate error
337 // here, then we know that we called SSL_ImportFD.
338 if (result == OK || IsCertificateError(result)) {
339 status = ssl_socket_->GetNextProto(&proto);
340 ssl_socket_->RecordNegotiationExtension();
341 } 335 }
342 336
343 // If we want spdy over npn, make sure it succeeded.
Ryan Sleevi 2015/04/17 19:19:30 Kinda sad to lose this comment?
davidben 2015/04/17 19:43:11 Oh. Yeah, that comment was attached to the wrong b
344 if (status == SSLClientSocket::kNextProtoNegotiated) {
345 ssl_socket_->set_was_npn_negotiated(true);
346 NextProto protocol_negotiated =
347 SSLClientSocket::NextProtoFromString(proto);
348 ssl_socket_->set_protocol_negotiated(protocol_negotiated);
349 // If we negotiated a SPDY version, it must have been present in
350 // SSLConfig::next_protos.
351 // TODO(mbelshe): Verify this.
352 if (protocol_negotiated >= kProtoSPDYMinimumVersion &&
353 protocol_negotiated <= kProtoSPDYMaximumVersion) {
354 ssl_socket_->set_was_spdy_negotiated(true);
355 }
356 }
357 if (params_->want_spdy_over_npn() && !ssl_socket_->was_spdy_negotiated())
358 return ERR_NPN_NEGOTIATION_FAILED;
359
360 if (result == OK || 337 if (result == OK ||
361 ssl_socket_->IgnoreCertError(result, params_->load_flags())) { 338 ssl_socket_->IgnoreCertError(result, params_->load_flags())) {
362 DCHECK(!connect_timing_.ssl_start.is_null()); 339 DCHECK(!connect_timing_.ssl_start.is_null());
363 base::TimeDelta connect_duration = 340 base::TimeDelta connect_duration =
364 connect_timing_.ssl_end - connect_timing_.ssl_start; 341 connect_timing_.ssl_end - connect_timing_.ssl_start;
365 if (params_->want_spdy_over_npn()) { 342 if (params_->want_spdy_over_npn()) {
366 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SpdyConnectionLatency_2", 343 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SpdyConnectionLatency_2",
367 connect_duration, 344 connect_duration,
368 base::TimeDelta::FromMilliseconds(1), 345 base::TimeDelta::FromMilliseconds(1),
369 base::TimeDelta::FromMinutes(1), 346 base::TimeDelta::FromMinutes(1),
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 if (base_.CloseOneIdleSocket()) 655 if (base_.CloseOneIdleSocket())
679 return true; 656 return true;
680 return base_.CloseOneIdleConnectionInHigherLayeredPool(); 657 return base_.CloseOneIdleConnectionInHigherLayeredPool();
681 } 658 }
682 659
683 void SSLClientSocketPool::OnSSLConfigChanged() { 660 void SSLClientSocketPool::OnSSLConfigChanged() {
684 FlushWithError(ERR_NETWORK_CHANGED); 661 FlushWithError(ERR_NETWORK_CHANGED);
685 } 662 }
686 663
687 } // namespace net 664 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_openssl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698