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

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

Issue 9959033: Move NextProto enum to a new file net/socket/next_proto.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address wtc's comments Created 8 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 | Annotate | Revision Log
« no previous file with comments | « net/socket/ssl_client_socket.cc ('k') | net/socket/ssl_client_socket_pool_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) 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 std::string server_protos; 288 std::string server_protos;
289 // GetNextProto will fail and and trigger a NOTREACHED if we pass in a socket 289 // GetNextProto will fail and and trigger a NOTREACHED if we pass in a socket
290 // that hasn't had SSL_ImportFD called on it. If we get a certificate error 290 // that hasn't had SSL_ImportFD called on it. If we get a certificate error
291 // here, then we know that we called SSL_ImportFD. 291 // here, then we know that we called SSL_ImportFD.
292 if (result == OK || IsCertificateError(result)) 292 if (result == OK || IsCertificateError(result))
293 status = ssl_socket_->GetNextProto(&proto, &server_protos); 293 status = ssl_socket_->GetNextProto(&proto, &server_protos);
294 294
295 // If we want spdy over npn, make sure it succeeded. 295 // If we want spdy over npn, make sure it succeeded.
296 if (status == SSLClientSocket::kNextProtoNegotiated) { 296 if (status == SSLClientSocket::kNextProtoNegotiated) {
297 ssl_socket_->set_was_npn_negotiated(true); 297 ssl_socket_->set_was_npn_negotiated(true);
298 SSLClientSocket::NextProto protocol_negotiated = 298 NextProto protocol_negotiated =
299 SSLClientSocket::NextProtoFromString(proto); 299 SSLClientSocket::NextProtoFromString(proto);
300 ssl_socket_->set_protocol_negotiated(protocol_negotiated); 300 ssl_socket_->set_protocol_negotiated(protocol_negotiated);
301 // If we negotiated either version of SPDY, we must have 301 // If we negotiated either version of SPDY, we must have
302 // advertised it, so allow it. 302 // advertised it, so allow it.
303 // TODO(mbelshe): verify it was a protocol we advertised? 303 // TODO(mbelshe): verify it was a protocol we advertised?
304 if (protocol_negotiated == SSLClientSocket::kProtoSPDY1 || 304 if (protocol_negotiated == kProtoSPDY1 ||
305 protocol_negotiated == SSLClientSocket::kProtoSPDY2 || 305 protocol_negotiated == kProtoSPDY2 ||
306 protocol_negotiated == SSLClientSocket::kProtoSPDY21 || 306 protocol_negotiated == kProtoSPDY21 ||
307 protocol_negotiated == SSLClientSocket::kProtoSPDY3) { 307 protocol_negotiated == kProtoSPDY3) {
308 ssl_socket_->set_was_spdy_negotiated(true); 308 ssl_socket_->set_was_spdy_negotiated(true);
309 } 309 }
310 } 310 }
311 if (params_->want_spdy_over_npn() && !ssl_socket_->was_spdy_negotiated()) 311 if (params_->want_spdy_over_npn() && !ssl_socket_->was_spdy_negotiated())
312 return ERR_NPN_NEGOTIATION_FAILED; 312 return ERR_NPN_NEGOTIATION_FAILED;
313 313
314 // Spdy might be turned on by default, or it might be over npn. 314 // Spdy might be turned on by default, or it might be over npn.
315 bool using_spdy = params_->force_spdy_over_ssl() || 315 bool using_spdy = params_->force_spdy_over_ssl() ||
316 params_->want_spdy_over_npn(); 316 params_->want_spdy_over_npn();
317 317
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 585
586 ClientSocketPoolHistograms* SSLClientSocketPool::histograms() const { 586 ClientSocketPoolHistograms* SSLClientSocketPool::histograms() const {
587 return base_.histograms(); 587 return base_.histograms();
588 } 588 }
589 589
590 void SSLClientSocketPool::OnSSLConfigChanged() { 590 void SSLClientSocketPool::OnSSLConfigChanged() {
591 Flush(); 591 Flush();
592 } 592 }
593 593
594 } // namespace net 594 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket.cc ('k') | net/socket/ssl_client_socket_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698