| 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 |
| 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 protocol_negotiated_(kProtoUnknown), | 14 protocol_negotiated_(kProtoUnknown), |
| 15 channel_id_sent_(false) { | 15 channel_id_sent_(false) { |
| 16 } | 16 } |
| 17 | 17 |
| 18 // static | 18 // static |
| 19 NextProto SSLClientSocket::NextProtoFromString( | 19 NextProto SSLClientSocket::NextProtoFromString( |
| 20 const std::string& proto_string) { | 20 const std::string& proto_string) { |
| 21 if (proto_string == "http1.1" || proto_string == "http/1.1") { | 21 if (proto_string == "http1.1" || proto_string == "http/1.1") { |
| 22 return kProtoHTTP11; | 22 return kProtoHTTP11; |
| 23 } else if (proto_string == "spdy/1") { | 23 } else if (proto_string == "spdy/1") { |
| 24 return kProtoSPDY1; | 24 return kProtoSPDY1; |
| 25 } else if (proto_string == "spdy/2") { | 25 } else if (proto_string == "spdy/2") { |
| 26 return kProtoSPDY2; | 26 return kProtoSPDY2; |
| 27 } else if (proto_string == "spdy/3") { | 27 } else if (proto_string == "spdy/3") { |
| 28 return kProtoSPDY3; | 28 return kProtoSPDY3; |
| 29 } else if (proto_string == "spdy/3.1") { |
| 30 return kProtoSPDY31; |
| 29 } else { | 31 } else { |
| 30 return kProtoUnknown; | 32 return kProtoUnknown; |
| 31 } | 33 } |
| 32 } | 34 } |
| 33 | 35 |
| 34 // static | 36 // static |
| 35 const char* SSLClientSocket::NextProtoToString(NextProto next_proto) { | 37 const char* SSLClientSocket::NextProtoToString(NextProto next_proto) { |
| 36 switch (next_proto) { | 38 switch (next_proto) { |
| 37 case kProtoHTTP11: | 39 case kProtoHTTP11: |
| 38 return "http/1.1"; | 40 return "http/1.1"; |
| 39 case kProtoSPDY1: | 41 case kProtoSPDY1: |
| 40 return "spdy/1"; | 42 return "spdy/1"; |
| 41 case kProtoSPDY2: | 43 case kProtoSPDY2: |
| 42 return "spdy/2"; | 44 return "spdy/2"; |
| 43 case kProtoSPDY3: | 45 case kProtoSPDY3: |
| 44 return "spdy/3"; | 46 return "spdy/3"; |
| 47 case kProtoSPDY31: |
| 48 return "spdy/3.1"; |
| 45 default: | 49 default: |
| 46 break; | 50 break; |
| 47 } | 51 } |
| 48 return "unknown"; | 52 return "unknown"; |
| 49 } | 53 } |
| 50 | 54 |
| 51 // static | 55 // static |
| 52 const char* SSLClientSocket::NextProtoStatusToString( | 56 const char* SSLClientSocket::NextProtoStatusToString( |
| 53 const SSLClientSocket::NextProtoStatus status) { | 57 const SSLClientSocket::NextProtoStatus status) { |
| 54 switch (status) { | 58 switch (status) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 126 |
| 123 bool SSLClientSocket::WasChannelIDSent() const { | 127 bool SSLClientSocket::WasChannelIDSent() const { |
| 124 return channel_id_sent_; | 128 return channel_id_sent_; |
| 125 } | 129 } |
| 126 | 130 |
| 127 void SSLClientSocket::set_channel_id_sent(bool channel_id_sent) { | 131 void SSLClientSocket::set_channel_id_sent(bool channel_id_sent) { |
| 128 channel_id_sent_ = channel_id_sent; | 132 channel_id_sent_ = channel_id_sent; |
| 129 } | 133 } |
| 130 | 134 |
| 131 } // namespace net | 135 } // namespace net |
| OLD | NEW |