OLD | NEW |
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 // OpenSSL binding for SSLClientSocket. The class layout and general principle | 5 // OpenSSL binding for SSLClientSocket. The class layout and general principle |
6 // of operation is derived from SSLClientSocketNSS. | 6 // of operation is derived from SSLClientSocketNSS. |
7 | 7 |
8 #include "net/socket/ssl_client_socket_openssl.h" | 8 #include "net/socket/ssl_client_socket_openssl.h" |
9 | 9 |
10 #include <openssl/err.h> | 10 #include <openssl/err.h> |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 | 361 |
362 SSLClientSocketOpenSSL::~SSLClientSocketOpenSSL() { | 362 SSLClientSocketOpenSSL::~SSLClientSocketOpenSSL() { |
363 SSLContext* context = SSLContext::GetInstance(); | 363 SSLContext* context = SSLContext::GetInstance(); |
364 context->session_cache()->RemoveFromSSLToCallbackMap(ssl_); | 364 context->session_cache()->RemoveFromSSLToCallbackMap(ssl_); |
365 Disconnect(); | 365 Disconnect(); |
366 } | 366 } |
367 | 367 |
368 // Compute a unique key string for the SSL session cache. | 368 // Compute a unique key string for the SSL session cache. |
369 // Return a string. | 369 // Return a string. |
370 std::string SSLClientSocketOpenSSL::GetSessionCacheKey() const { | 370 std::string SSLClientSocketOpenSSL::GetSessionCacheKey() const { |
371 return FormatSessionCacheKey(host_and_port_.ToString(), | 371 std::string result = host_and_port_.ToString(); |
372 ssl_session_cache_shard_); | 372 result.append("/"); |
| 373 result.append(ssl_session_cache_shard_); |
| 374 return result; |
373 } | 375 } |
374 | 376 |
375 bool SSLClientSocketOpenSSL::InSessionCache() const { | 377 bool SSLClientSocketOpenSSL::InSessionCache() const { |
376 SSLContext* context = SSLContext::GetInstance(); | 378 SSLContext* context = SSLContext::GetInstance(); |
377 std::string cache_key = GetSessionCacheKey(); | 379 std::string cache_key = GetSessionCacheKey(); |
378 return context->session_cache()->SSLSessionIsInCache(cache_key); | 380 return context->session_cache()->SSLSessionIsInCache(cache_key); |
379 } | 381 } |
380 | 382 |
381 void SSLClientSocketOpenSSL::WatchSessionForCompletion( | 383 void SSLClientSocketOpenSSL::WatchSessionForCompletion( |
382 const base::Closure& callback) { | 384 const base::Closure& callback) { |
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1476 DVLOG(2) << "next protocol: '" << npn_proto_ << "' status: " << npn_status_; | 1478 DVLOG(2) << "next protocol: '" << npn_proto_ << "' status: " << npn_status_; |
1477 return SSL_TLSEXT_ERR_OK; | 1479 return SSL_TLSEXT_ERR_OK; |
1478 } | 1480 } |
1479 | 1481 |
1480 scoped_refptr<X509Certificate> | 1482 scoped_refptr<X509Certificate> |
1481 SSLClientSocketOpenSSL::GetUnverifiedServerCertificateChain() const { | 1483 SSLClientSocketOpenSSL::GetUnverifiedServerCertificateChain() const { |
1482 return server_cert_; | 1484 return server_cert_; |
1483 } | 1485 } |
1484 | 1486 |
1485 } // namespace net | 1487 } // namespace net |
OLD | NEW |