| OLD | NEW |
| 1 // Copyright (c) 2011 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 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 | 8 |
| 9 namespace net { | 9 namespace net { |
| 10 | 10 |
| 11 SSLClientSocket::SSLClientSocket() | 11 SSLClientSocket::SSLClientSocket() |
| 12 : was_npn_negotiated_(false), | 12 : was_npn_negotiated_(false), |
| 13 was_spdy_negotiated_(false), | 13 was_spdy_negotiated_(false), |
| 14 was_origin_bound_cert_sent_(false) { | 14 was_origin_bound_cert_sent_(false) { |
| 15 } | 15 } |
| 16 | 16 |
| 17 SSLClientSocket::NextProto SSLClientSocket::NextProtoFromString( | 17 SSLClientSocket::NextProto SSLClientSocket::NextProtoFromString( |
| 18 const std::string& proto_string) { | 18 const std::string& proto_string) { |
| 19 if (proto_string == "http1.1" || proto_string == "http/1.1") { | 19 if (proto_string == "http1.1" || proto_string == "http/1.1") { |
| 20 return kProtoHTTP11; | 20 return kProtoHTTP11; |
| 21 } else if (proto_string == "spdy/1") { | 21 } else if (proto_string == "spdy/1") { |
| 22 return kProtoSPDY1; | 22 return kProtoSPDY1; |
| 23 } else if (proto_string == "spdy/2") { | 23 } else if (proto_string == "spdy/2") { |
| 24 return kProtoSPDY2; | 24 return kProtoSPDY2; |
| 25 } else if (proto_string == "spdy/2.1") { |
| 26 return kProtoSPDY21; |
| 25 } else { | 27 } else { |
| 26 return kProtoUnknown; | 28 return kProtoUnknown; |
| 27 } | 29 } |
| 28 } | 30 } |
| 29 | 31 |
| 30 // static | 32 // static |
| 31 const char* SSLClientSocket::NextProtoStatusToString( | 33 const char* SSLClientSocket::NextProtoStatusToString( |
| 32 const SSLClientSocket::NextProtoStatus status) { | 34 const SSLClientSocket::NextProtoStatus status) { |
| 33 switch (status) { | 35 switch (status) { |
| 34 case kNextProtoUnsupported: | 36 case kNextProtoUnsupported: |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 } | 86 } |
| 85 | 87 |
| 86 bool SSLClientSocket::was_spdy_negotiated() const { | 88 bool SSLClientSocket::was_spdy_negotiated() const { |
| 87 return was_spdy_negotiated_; | 89 return was_spdy_negotiated_; |
| 88 } | 90 } |
| 89 | 91 |
| 90 bool SSLClientSocket::set_was_spdy_negotiated(bool negotiated) { | 92 bool SSLClientSocket::set_was_spdy_negotiated(bool negotiated) { |
| 91 return was_spdy_negotiated_ = negotiated; | 93 return was_spdy_negotiated_ = negotiated; |
| 92 } | 94 } |
| 93 | 95 |
| 96 SSLClientSocket::NextProto SSLClientSocket::next_protocol_negotiated() const { |
| 97 return next_protocol_; |
| 98 } |
| 99 |
| 100 void SSLClientSocket::set_next_protocol_negotiated( |
| 101 SSLClientSocket::NextProto next_protocol) { |
| 102 next_protocol_ = next_protocol; |
| 103 } |
| 104 |
| 94 bool SSLClientSocket::was_origin_bound_cert_sent() const { | 105 bool SSLClientSocket::was_origin_bound_cert_sent() const { |
| 95 return was_origin_bound_cert_sent_; | 106 return was_origin_bound_cert_sent_; |
| 96 } | 107 } |
| 97 | 108 |
| 98 bool SSLClientSocket::set_was_origin_bound_cert_sent(bool sent) { | 109 bool SSLClientSocket::set_was_origin_bound_cert_sent(bool sent) { |
| 99 return was_origin_bound_cert_sent_ = sent; | 110 return was_origin_bound_cert_sent_ = sent; |
| 100 } | 111 } |
| 101 | 112 |
| 102 } // namespace net | 113 } // namespace net |
| OLD | NEW |