| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/client_socket_factory.h" | 5 #include "net/socket/client_socket_factory.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | |
| 8 #include "net/socket/ssl_client_socket_nss.h" | 7 #include "net/socket/ssl_client_socket_nss.h" |
| 9 #include "net/socket/ssl_host_info.h" | 8 #include "net/socket/ssl_host_info.h" |
| 10 #if defined(OS_WIN) | |
| 11 #include "net/socket/ssl_client_socket_win.h" | |
| 12 #endif | |
| 13 | 9 |
| 14 // This file is only used on platforms where NSS is not the system SSL | 10 // This file is only used on platforms where NSS is not the system SSL |
| 15 // library. When compiled, this file is the only object module that pulls | 11 // library. When compiled, this file is the only object module that pulls |
| 16 // in the dependency on NSPR and NSS. This allows us to control which | 12 // in the dependency on NSPR and NSS. This allows us to control which |
| 17 // projects depend on NSPR and NSS on those platforms. | 13 // projects depend on NSPR and NSS on those platforms. |
| 18 | 14 |
| 19 namespace net { | 15 namespace net { |
| 20 | 16 |
| 21 SSLClientSocket* SSLClientSocketNSSFactory( | 17 SSLClientSocket* SSLClientSocketNSSFactory( |
| 22 ClientSocketHandle* transport_socket, | 18 ClientSocketHandle* transport_socket, |
| 23 const std::string& hostname, | 19 const std::string& hostname, |
| 24 const SSLConfig& ssl_config, | 20 const SSLConfig& ssl_config, |
| 25 SSLHostInfo* ssl_host_info) { | 21 SSLHostInfo* ssl_host_info) { |
| 26 scoped_ptr<SSLHostInfo> shi(ssl_host_info); | 22 scoped_ptr<SSLHostInfo> shi(ssl_host_info); |
| 27 // TODO(wtc): SSLClientSocketNSS can't do SSL client authentication using | |
| 28 // CryptoAPI yet (http://crbug.com/37560), so we fall back on | |
| 29 // SSLClientSocketWin. | |
| 30 #if defined(OS_WIN) | |
| 31 if (ssl_config.send_client_cert) | |
| 32 return new SSLClientSocketWin(transport_socket, hostname, ssl_config); | |
| 33 #endif | |
| 34 | |
| 35 return new SSLClientSocketNSS(transport_socket, hostname, ssl_config, | 23 return new SSLClientSocketNSS(transport_socket, hostname, ssl_config, |
| 36 shi.release()); | 24 shi.release()); |
| 37 } | 25 } |
| 38 | 26 |
| 39 } // namespace net | 27 } // namespace net |
| OLD | NEW |