| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
| 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "net/base/load_flags.h" |
| 11 #include "net/base/net_errors.h" |
| 10 #include "net/socket/client_socket.h" | 12 #include "net/socket/client_socket.h" |
| 11 | 13 |
| 12 namespace net { | 14 namespace net { |
| 13 | 15 |
| 14 class SSLCertRequestInfo; | 16 class SSLCertRequestInfo; |
| 15 class SSLInfo; | 17 class SSLInfo; |
| 16 | 18 |
| 17 // A client socket that uses SSL as the transport layer. | 19 // A client socket that uses SSL as the transport layer. |
| 18 // | 20 // |
| 19 // NOTE: The SSL handshake occurs within the Connect method after a TCP | 21 // NOTE: The SSL handshake occurs within the Connect method after a TCP |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 static NextProto NextProtoFromString(const std::string& proto_string) { | 66 static NextProto NextProtoFromString(const std::string& proto_string) { |
| 65 if (proto_string == "http1.1" || proto_string == "http/1.1") { | 67 if (proto_string == "http1.1" || proto_string == "http/1.1") { |
| 66 return kProtoHTTP11; | 68 return kProtoHTTP11; |
| 67 } else if (proto_string == "spdy" || proto_string == "spdy/1") { | 69 } else if (proto_string == "spdy" || proto_string == "spdy/1") { |
| 68 return kProtoSPDY1; | 70 return kProtoSPDY1; |
| 69 } else { | 71 } else { |
| 70 return kProtoUnknown; | 72 return kProtoUnknown; |
| 71 } | 73 } |
| 72 } | 74 } |
| 73 | 75 |
| 76 static bool IgnoreCertError(int error, int load_flags) { |
| 77 if (error == OK || load_flags & LOAD_IGNORE_ALL_CERT_ERRORS) |
| 78 return true; |
| 79 |
| 80 if (error == ERR_CERT_COMMON_NAME_INVALID && |
| 81 (load_flags & LOAD_IGNORE_CERT_COMMON_NAME_INVALID)) |
| 82 return true; |
| 83 if(error == ERR_CERT_DATE_INVALID && |
| 84 (load_flags & LOAD_IGNORE_CERT_DATE_INVALID)) |
| 85 return true; |
| 86 if(error == ERR_CERT_AUTHORITY_INVALID && |
| 87 (load_flags & LOAD_IGNORE_CERT_AUTHORITY_INVALID)) |
| 88 return true; |
| 89 |
| 90 return false; |
| 91 } |
| 92 |
| 74 virtual bool wasNpnNegotiated() const { | 93 virtual bool wasNpnNegotiated() const { |
| 75 return was_npn_negotiated_; | 94 return was_npn_negotiated_; |
| 76 } | 95 } |
| 77 | 96 |
| 78 virtual bool setWasNpnNegotiated(bool negotiated) { | 97 virtual bool setWasNpnNegotiated(bool negotiated) { |
| 79 return was_npn_negotiated_ = negotiated; | 98 return was_npn_negotiated_ = negotiated; |
| 80 } | 99 } |
| 81 | 100 |
| 82 private: | 101 private: |
| 83 // True if NPN was responded to, independent of selecting SPDY or HTTP. | 102 // True if NPN was responded to, independent of selecting SPDY or HTTP. |
| 84 bool was_npn_negotiated_; | 103 bool was_npn_negotiated_; |
| 85 }; | 104 }; |
| 86 | 105 |
| 87 } // namespace net | 106 } // namespace net |
| 88 | 107 |
| 89 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 108 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
| OLD | NEW |