| 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/socket/client_socket.h" | 10 #include "net/socket/client_socket.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // the first protocol in our list. | 32 // the first protocol in our list. |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 // Next Protocol Negotiation (NPN), if successful, results in agreement on an | 35 // Next Protocol Negotiation (NPN), if successful, results in agreement on an |
| 36 // application-level string that specifies the application level protocol to | 36 // application-level string that specifies the application level protocol to |
| 37 // use over the TLS connection. NextProto enumerates the application level | 37 // use over the TLS connection. NextProto enumerates the application level |
| 38 // protocols that we recognise. | 38 // protocols that we recognise. |
| 39 enum NextProto { | 39 enum NextProto { |
| 40 kProtoUnknown = 0, | 40 kProtoUnknown = 0, |
| 41 kProtoHTTP11 = 1, | 41 kProtoHTTP11 = 1, |
| 42 kProtoSPDY = 2, | 42 kProtoSPDY1 = 2, |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 // Gets the SSL connection information of the socket. | 45 // Gets the SSL connection information of the socket. |
| 46 virtual void GetSSLInfo(SSLInfo* ssl_info) = 0; | 46 virtual void GetSSLInfo(SSLInfo* ssl_info) = 0; |
| 47 | 47 |
| 48 // Gets the SSL CertificateRequest info of the socket after Connect failed | 48 // Gets the SSL CertificateRequest info of the socket after Connect failed |
| 49 // with ERR_SSL_CLIENT_AUTH_CERT_NEEDED. | 49 // with ERR_SSL_CLIENT_AUTH_CERT_NEEDED. |
| 50 virtual void GetSSLCertRequestInfo( | 50 virtual void GetSSLCertRequestInfo( |
| 51 SSLCertRequestInfo* cert_request_info) = 0; | 51 SSLCertRequestInfo* cert_request_info) = 0; |
| 52 | 52 |
| 53 // Get the application level protocol that we negotiated with the server. | 53 // Get the application level protocol that we negotiated with the server. |
| 54 // *proto is set to the resulting protocol (n.b. that the string may have | 54 // *proto is set to the resulting protocol (n.b. that the string may have |
| 55 // embedded NULs). | 55 // embedded NULs). |
| 56 // kNextProtoUnsupported: *proto is cleared. | 56 // kNextProtoUnsupported: *proto is cleared. |
| 57 // kNextProtoNegotiated: *proto is set to the negotiated protocol. | 57 // kNextProtoNegotiated: *proto is set to the negotiated protocol. |
| 58 // kNextProtoNoOverlap: *proto is set to the first protocol in the | 58 // kNextProtoNoOverlap: *proto is set to the first protocol in the |
| 59 // supported list. | 59 // supported list. |
| 60 virtual NextProtoStatus GetNextProto(std::string* proto) = 0; | 60 virtual NextProtoStatus GetNextProto(std::string* proto) = 0; |
| 61 | 61 |
| 62 static NextProto NextProtoFromString(const std::string& proto_string) { | 62 static NextProto NextProtoFromString(const std::string& proto_string) { |
| 63 if (proto_string == "http1.1") { | 63 if (proto_string == "http1.1" || proto_string == "http/1.1") { |
| 64 return kProtoHTTP11; | 64 return kProtoHTTP11; |
| 65 } else if (proto_string == "spdy") { | 65 } else if (proto_string == "spdy" || proto_string == "spdy/1") { |
| 66 return kProtoSPDY; | 66 return kProtoSPDY1; |
| 67 } else { | 67 } else { |
| 68 return kProtoUnknown; | 68 return kProtoUnknown; |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 } // namespace net | 73 } // namespace net |
| 74 | 74 |
| 75 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 75 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
| OLD | NEW |