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/strings/string_util.h" | 7 #include "base/strings/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/2") { | 23 } else if (proto_string == "spdy/2") { |
24 return kProtoSPDY2; | 24 return kProtoDeprecatedSPDY2; |
25 } else if (proto_string == "spdy/3") { | 25 } else if (proto_string == "spdy/3") { |
26 return kProtoSPDY3; | 26 return kProtoSPDY3; |
27 } else if (proto_string == "spdy/3.1") { | 27 } else if (proto_string == "spdy/3.1") { |
28 return kProtoSPDY31; | 28 return kProtoSPDY31; |
29 } else if (proto_string == "spdy/4a2") { | 29 } else if (proto_string == "spdy/4a2") { |
30 return kProtoSPDY4a2; | 30 return kProtoSPDY4a2; |
31 } else if (proto_string == "HTTP-draft-04/2.0") { | 31 } else if (proto_string == "HTTP-draft-04/2.0") { |
32 return kProtoHTTP2Draft04; | 32 return kProtoHTTP2Draft04; |
33 } else if (proto_string == "quic/1+spdy/3") { | 33 } else if (proto_string == "quic/1+spdy/3") { |
34 return kProtoQUIC1SPDY3; | 34 return kProtoQUIC1SPDY3; |
35 } else { | 35 } else { |
36 return kProtoUnknown; | 36 return kProtoUnknown; |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 // static | 40 // static |
41 const char* SSLClientSocket::NextProtoToString(NextProto next_proto) { | 41 const char* SSLClientSocket::NextProtoToString(NextProto next_proto) { |
42 switch (next_proto) { | 42 switch (next_proto) { |
43 case kProtoHTTP11: | 43 case kProtoHTTP11: |
44 return "http/1.1"; | 44 return "http/1.1"; |
45 case kProtoSPDY2: | 45 case kProtoDeprecatedSPDY2: |
46 return "spdy/2"; | 46 return "spdy/2"; |
47 case kProtoSPDY3: | 47 case kProtoSPDY3: |
48 return "spdy/3"; | 48 return "spdy/3"; |
49 case kProtoSPDY31: | 49 case kProtoSPDY31: |
50 return "spdy/3.1"; | 50 return "spdy/3.1"; |
51 case kProtoSPDY4a2: | 51 case kProtoSPDY4a2: |
52 return "spdy/4a2"; | 52 return "spdy/4a2"; |
53 case kProtoHTTP2Draft04: | 53 case kProtoHTTP2Draft04: |
54 return "HTTP-draft-04/2.0"; | 54 return "HTTP-draft-04/2.0"; |
55 case kProtoQUIC1SPDY3: | 55 case kProtoQUIC1SPDY3: |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 134 |
135 bool SSLClientSocket::WasChannelIDSent() const { | 135 bool SSLClientSocket::WasChannelIDSent() const { |
136 return channel_id_sent_; | 136 return channel_id_sent_; |
137 } | 137 } |
138 | 138 |
139 void SSLClientSocket::set_channel_id_sent(bool channel_id_sent) { | 139 void SSLClientSocket::set_channel_id_sent(bool channel_id_sent) { |
140 channel_id_sent_ = channel_id_sent; | 140 channel_id_sent_ = channel_id_sent; |
141 } | 141 } |
142 | 142 |
143 } // namespace net | 143 } // namespace net |
OLD | NEW |