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 #include "net/socket/ssl_client_socket.h" | 5 #include "net/socket/ssl_client_socket.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 | 8 |
9 namespace net { | 9 namespace net { |
10 | 10 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 std::vector<std::string> server_protos_with_commas; | 70 std::vector<std::string> server_protos_with_commas; |
71 for (size_t i = 0; i < protos_len; ) { | 71 for (size_t i = 0; i < protos_len; ) { |
72 const size_t len = protos[i]; | 72 const size_t len = protos[i]; |
73 std::string proto_str(&protos[i + 1], len); | 73 std::string proto_str(&protos[i + 1], len); |
74 server_protos_with_commas.push_back(proto_str); | 74 server_protos_with_commas.push_back(proto_str); |
75 i += len + 1; | 75 i += len + 1; |
76 } | 76 } |
77 return JoinString(server_protos_with_commas, ','); | 77 return JoinString(server_protos_with_commas, ','); |
78 } | 78 } |
79 | 79 |
| 80 bool SSLClientSocket::WasNpnNegotiated() const { |
| 81 return was_npn_negotiated_; |
| 82 } |
| 83 |
80 NextProto SSLClientSocket::GetNegotiatedProtocol() const { | 84 NextProto SSLClientSocket::GetNegotiatedProtocol() const { |
81 return protocol_negotiated_; | 85 return protocol_negotiated_; |
82 } | 86 } |
83 | 87 |
84 bool SSLClientSocket::IgnoreCertError(int error, int load_flags) { | 88 bool SSLClientSocket::IgnoreCertError(int error, int load_flags) { |
85 if (error == OK || load_flags & LOAD_IGNORE_ALL_CERT_ERRORS) | 89 if (error == OK || load_flags & LOAD_IGNORE_ALL_CERT_ERRORS) |
86 return true; | 90 return true; |
87 | 91 |
88 if (error == ERR_CERT_COMMON_NAME_INVALID && | 92 if (error == ERR_CERT_COMMON_NAME_INVALID && |
89 (load_flags & LOAD_IGNORE_CERT_COMMON_NAME_INVALID)) | 93 (load_flags & LOAD_IGNORE_CERT_COMMON_NAME_INVALID)) |
90 return true; | 94 return true; |
91 | 95 |
92 if (error == ERR_CERT_DATE_INVALID && | 96 if (error == ERR_CERT_DATE_INVALID && |
93 (load_flags & LOAD_IGNORE_CERT_DATE_INVALID)) | 97 (load_flags & LOAD_IGNORE_CERT_DATE_INVALID)) |
94 return true; | 98 return true; |
95 | 99 |
96 if (error == ERR_CERT_AUTHORITY_INVALID && | 100 if (error == ERR_CERT_AUTHORITY_INVALID && |
97 (load_flags & LOAD_IGNORE_CERT_AUTHORITY_INVALID)) | 101 (load_flags & LOAD_IGNORE_CERT_AUTHORITY_INVALID)) |
98 return true; | 102 return true; |
99 | 103 |
100 return false; | 104 return false; |
101 } | 105 } |
102 | 106 |
103 bool SSLClientSocket::was_npn_negotiated() const { | |
104 return was_npn_negotiated_; | |
105 } | |
106 | |
107 bool SSLClientSocket::set_was_npn_negotiated(bool negotiated) { | 107 bool SSLClientSocket::set_was_npn_negotiated(bool negotiated) { |
108 return was_npn_negotiated_ = negotiated; | 108 return was_npn_negotiated_ = negotiated; |
109 } | 109 } |
110 | 110 |
111 bool SSLClientSocket::was_spdy_negotiated() const { | 111 bool SSLClientSocket::was_spdy_negotiated() const { |
112 return was_spdy_negotiated_; | 112 return was_spdy_negotiated_; |
113 } | 113 } |
114 | 114 |
115 bool SSLClientSocket::set_was_spdy_negotiated(bool negotiated) { | 115 bool SSLClientSocket::set_was_spdy_negotiated(bool negotiated) { |
116 return was_spdy_negotiated_ = negotiated; | 116 return was_spdy_negotiated_ = negotiated; |
117 } | 117 } |
118 | 118 |
119 void SSLClientSocket::set_protocol_negotiated(NextProto protocol_negotiated) { | 119 void SSLClientSocket::set_protocol_negotiated(NextProto protocol_negotiated) { |
120 protocol_negotiated_ = protocol_negotiated; | 120 protocol_negotiated_ = protocol_negotiated; |
121 } | 121 } |
122 | 122 |
123 bool SSLClientSocket::WasChannelIDSent() const { | 123 bool SSLClientSocket::WasChannelIDSent() const { |
124 return channel_id_sent_; | 124 return channel_id_sent_; |
125 } | 125 } |
126 | 126 |
127 void SSLClientSocket::set_channel_id_sent(bool channel_id_sent) { | 127 void SSLClientSocket::set_channel_id_sent(bool channel_id_sent) { |
128 channel_id_sent_ = channel_id_sent; | 128 channel_id_sent_ = channel_id_sent; |
129 } | 129 } |
130 | 130 |
131 } // namespace net | 131 } // namespace net |
OLD | NEW |