| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "net/socket/ssl_client_socket.h" |
| 6 | 6 |
| 7 namespace net { | 7 namespace net { |
| 8 | 8 |
| 9 SSLClientSocket::SSLClientSocket() | 9 SSLClientSocket::SSLClientSocket() |
| 10 : was_npn_negotiated_(false), | 10 : was_npn_negotiated_(false), |
| 11 was_spdy_negotiated_(false) { | 11 was_spdy_negotiated_(false) { |
| 12 } | 12 } |
| 13 | 13 |
| 14 SSLClientSocket::NextProto SSLClientSocket::NextProtoFromString( | 14 SSLClientSocket::NextProto SSLClientSocket::NextProtoFromString( |
| 15 const std::string& proto_string) { | 15 const std::string& proto_string) { |
| 16 if (proto_string == "http1.1" || proto_string == "http/1.1") { | 16 if (proto_string == "http1.1" || proto_string == "http/1.1") { |
| 17 return kProtoHTTP11; | 17 return kProtoHTTP11; |
| 18 } else if (proto_string == "spdy/1") { | 18 } else if (proto_string == "spdy/1") { |
| 19 return kProtoSPDY1; | 19 return kProtoSPDY1; |
| 20 } else if (proto_string == "spdy/2") { | 20 } else if (proto_string == "spdy/2") { |
| 21 return kProtoSPDY2; | 21 return kProtoSPDY2; |
| 22 } else { | 22 } else { |
| 23 return kProtoUnknown; | 23 return kProtoUnknown; |
| 24 } | 24 } |
| 25 } | 25 } |
| 26 | 26 |
| 27 // static |
| 28 const char* SSLClientSocket::NextProtoStatusToString( |
| 29 const SSLClientSocket::NextProtoStatus status) { |
| 30 switch (status) { |
| 31 case kNextProtoUnsupported: |
| 32 return "Unsupported"; |
| 33 case kNextProtoNegotiated: |
| 34 return "Negotiated"; |
| 35 case kNextProtoNoOverlap: |
| 36 return "No overlap"; |
| 37 } |
| 38 return NULL; |
| 39 } |
| 40 |
| 27 bool SSLClientSocket::IgnoreCertError(int error, int load_flags) { | 41 bool SSLClientSocket::IgnoreCertError(int error, int load_flags) { |
| 28 if (error == OK || load_flags & LOAD_IGNORE_ALL_CERT_ERRORS) | 42 if (error == OK || load_flags & LOAD_IGNORE_ALL_CERT_ERRORS) |
| 29 return true; | 43 return true; |
| 30 | 44 |
| 31 if (error == ERR_CERT_COMMON_NAME_INVALID && | 45 if (error == ERR_CERT_COMMON_NAME_INVALID && |
| 32 (load_flags & LOAD_IGNORE_CERT_COMMON_NAME_INVALID)) | 46 (load_flags & LOAD_IGNORE_CERT_COMMON_NAME_INVALID)) |
| 33 return true; | 47 return true; |
| 34 | 48 |
| 35 if (error == ERR_CERT_DATE_INVALID && | 49 if (error == ERR_CERT_DATE_INVALID && |
| 36 (load_flags & LOAD_IGNORE_CERT_DATE_INVALID)) | 50 (load_flags & LOAD_IGNORE_CERT_DATE_INVALID)) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 53 | 67 |
| 54 bool SSLClientSocket::was_spdy_negotiated() const { | 68 bool SSLClientSocket::was_spdy_negotiated() const { |
| 55 return was_spdy_negotiated_; | 69 return was_spdy_negotiated_; |
| 56 } | 70 } |
| 57 | 71 |
| 58 bool SSLClientSocket::set_was_spdy_negotiated(bool negotiated) { | 72 bool SSLClientSocket::set_was_spdy_negotiated(bool negotiated) { |
| 59 return was_spdy_negotiated_ = negotiated; | 73 return was_spdy_negotiated_ = negotiated; |
| 60 } | 74 } |
| 61 | 75 |
| 62 } // namespace net | 76 } // namespace net |
| OLD | NEW |