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 // This StreamSocket implementation is to be used with servers that | 5 // This StreamSocket implementation is to be used with servers that |
6 // accept connections on port 443 but don't really use SSL. For | 6 // accept connections on port 443 but don't really use SSL. For |
7 // example, the Google Talk servers do this to bypass proxies. (The | 7 // example, the Google Talk servers do this to bypass proxies. (The |
8 // connection is upgraded to TLS as part of the XMPP negotiation, so | 8 // connection is upgraded to TLS as part of the XMPP negotiation, so |
9 // security is preserved.) A "fake" SSL handshake is done immediately | 9 // security is preserved.) A "fake" SSL handshake is done immediately |
10 // after connection to fool proxies into thinking that this is a real | 10 // after connection to fool proxies into thinking that this is a real |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "base/compiler_specific.h" | 23 #include "base/compiler_specific.h" |
24 #include "base/memory/ref_counted.h" | 24 #include "base/memory/ref_counted.h" |
25 #include "base/memory/scoped_ptr.h" | 25 #include "base/memory/scoped_ptr.h" |
26 #include "base/string_piece.h" | 26 #include "base/string_piece.h" |
27 #include "net/base/completion_callback.h" | 27 #include "net/base/completion_callback.h" |
28 #include "net/base/net_errors.h" | 28 #include "net/base/net_errors.h" |
29 #include "net/socket/stream_socket.h" | 29 #include "net/socket/stream_socket.h" |
30 | 30 |
31 namespace net { | 31 namespace net { |
32 class DrainableIOBuffer; | 32 class DrainableIOBuffer; |
| 33 class SSLInfo; |
33 } // namespace net | 34 } // namespace net |
34 | 35 |
35 namespace notifier { | 36 namespace notifier { |
36 | 37 |
37 class FakeSSLClientSocket : public net::StreamSocket { | 38 class FakeSSLClientSocket : public net::StreamSocket { |
38 public: | 39 public: |
39 // Takes ownership of |transport_socket|. | 40 // Takes ownership of |transport_socket|. |
40 explicit FakeSSLClientSocket(net::StreamSocket* transport_socket); | 41 explicit FakeSSLClientSocket(net::StreamSocket* transport_socket); |
41 | 42 |
42 virtual ~FakeSSLClientSocket(); | 43 virtual ~FakeSSLClientSocket(); |
(...skipping 15 matching lines...) Expand all Loading... |
58 virtual bool IsConnectedAndIdle() const OVERRIDE; | 59 virtual bool IsConnectedAndIdle() const OVERRIDE; |
59 virtual int GetPeerAddress(net::IPEndPoint* address) const OVERRIDE; | 60 virtual int GetPeerAddress(net::IPEndPoint* address) const OVERRIDE; |
60 virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE; | 61 virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE; |
61 virtual const net::BoundNetLog& NetLog() const OVERRIDE; | 62 virtual const net::BoundNetLog& NetLog() const OVERRIDE; |
62 virtual void SetSubresourceSpeculation() OVERRIDE; | 63 virtual void SetSubresourceSpeculation() OVERRIDE; |
63 virtual void SetOmniboxSpeculation() OVERRIDE; | 64 virtual void SetOmniboxSpeculation() OVERRIDE; |
64 virtual bool WasEverUsed() const OVERRIDE; | 65 virtual bool WasEverUsed() const OVERRIDE; |
65 virtual bool UsingTCPFastOpen() const OVERRIDE; | 66 virtual bool UsingTCPFastOpen() const OVERRIDE; |
66 virtual int64 NumBytesRead() const OVERRIDE; | 67 virtual int64 NumBytesRead() const OVERRIDE; |
67 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; | 68 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; |
| 69 virtual bool WasNpnNegotiated() const OVERRIDE; |
68 virtual net::NextProto GetNegotiatedProtocol() const OVERRIDE; | 70 virtual net::NextProto GetNegotiatedProtocol() const OVERRIDE; |
| 71 virtual bool GetSSLInfo(net::SSLInfo* ssl_info) const OVERRIDE; |
69 | 72 |
70 private: | 73 private: |
71 enum HandshakeState { | 74 enum HandshakeState { |
72 STATE_NONE, | 75 STATE_NONE, |
73 STATE_CONNECT, | 76 STATE_CONNECT, |
74 STATE_SEND_CLIENT_HELLO, | 77 STATE_SEND_CLIENT_HELLO, |
75 STATE_VERIFY_SERVER_HELLO, | 78 STATE_VERIFY_SERVER_HELLO, |
76 }; | 79 }; |
77 | 80 |
78 int DoHandshakeLoop(); | 81 int DoHandshakeLoop(); |
(...skipping 24 matching lines...) Expand all Loading... |
103 // The callback passed to Connect(). | 106 // The callback passed to Connect(). |
104 net::CompletionCallback user_connect_callback_; | 107 net::CompletionCallback user_connect_callback_; |
105 | 108 |
106 scoped_refptr<net::DrainableIOBuffer> write_buf_; | 109 scoped_refptr<net::DrainableIOBuffer> write_buf_; |
107 scoped_refptr<net::DrainableIOBuffer> read_buf_; | 110 scoped_refptr<net::DrainableIOBuffer> read_buf_; |
108 }; | 111 }; |
109 | 112 |
110 } // namespace notifier | 113 } // namespace notifier |
111 | 114 |
112 #endif // JINGLE_NOTIFIER_BASE_FAKE_SSL_CLIENT_SOCKET_H_ | 115 #endif // JINGLE_NOTIFIER_BASE_FAKE_SSL_CLIENT_SOCKET_H_ |
OLD | NEW |