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 |
11 // SSL connection. | 11 // SSL connection. |
12 // | 12 // |
13 // NOTE: This StreamSocket implementation does *not* do a real SSL | 13 // NOTE: This StreamSocket implementation does *not* do a real SSL |
14 // handshake nor does it do any encryption! | 14 // handshake nor does it do any encryption! |
15 | 15 |
16 #ifndef JINGLE_NOTIFIER_BASE_FAKE_SSL_CLIENT_SOCKET_H_ | 16 #ifndef JINGLE_GLUE_FAKE_SSL_CLIENT_SOCKET_H_ |
17 #define JINGLE_NOTIFIER_BASE_FAKE_SSL_CLIENT_SOCKET_H_ | 17 #define JINGLE_GLUE_FAKE_SSL_CLIENT_SOCKET_H_ |
18 | 18 |
19 #include <cstddef> | 19 #include <cstddef> |
20 | 20 |
21 #include "base/basictypes.h" | 21 #include "base/basictypes.h" |
22 #include "base/compiler_specific.h" | 22 #include "base/compiler_specific.h" |
23 #include "base/memory/ref_counted.h" | 23 #include "base/memory/ref_counted.h" |
24 #include "base/memory/scoped_ptr.h" | 24 #include "base/memory/scoped_ptr.h" |
25 #include "base/string_piece.h" | 25 #include "base/string_piece.h" |
26 #include "net/base/completion_callback.h" | 26 #include "net/base/completion_callback.h" |
27 #include "net/base/net_errors.h" | 27 #include "net/base/net_errors.h" |
28 #include "net/socket/stream_socket.h" | 28 #include "net/socket/stream_socket.h" |
29 | 29 |
30 namespace net { | 30 namespace net { |
31 class DrainableIOBuffer; | 31 class DrainableIOBuffer; |
32 class SSLInfo; | 32 class SSLInfo; |
33 } // namespace net | 33 } // namespace net |
34 | 34 |
35 namespace notifier { | 35 namespace jingle_glue { |
36 | 36 |
37 class FakeSSLClientSocket : public net::StreamSocket { | 37 class FakeSSLClientSocket : public net::StreamSocket { |
38 public: | 38 public: |
39 // Takes ownership of |transport_socket|. | 39 // Takes ownership of |transport_socket|. |
40 explicit FakeSSLClientSocket(net::StreamSocket* transport_socket); | 40 explicit FakeSSLClientSocket(net::StreamSocket* transport_socket); |
41 | 41 |
42 virtual ~FakeSSLClientSocket(); | 42 virtual ~FakeSSLClientSocket(); |
43 | 43 |
44 // Exposed for testing. | 44 // Exposed for testing. |
45 static base::StringPiece GetSslClientHello(); | 45 static base::StringPiece GetSslClientHello(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // True iff we're connected and we've finished the handshake. | 102 // True iff we're connected and we've finished the handshake. |
103 bool handshake_completed_; | 103 bool handshake_completed_; |
104 | 104 |
105 // The callback passed to Connect(). | 105 // The callback passed to Connect(). |
106 net::CompletionCallback user_connect_callback_; | 106 net::CompletionCallback user_connect_callback_; |
107 | 107 |
108 scoped_refptr<net::DrainableIOBuffer> write_buf_; | 108 scoped_refptr<net::DrainableIOBuffer> write_buf_; |
109 scoped_refptr<net::DrainableIOBuffer> read_buf_; | 109 scoped_refptr<net::DrainableIOBuffer> read_buf_; |
110 }; | 110 }; |
111 | 111 |
112 } // namespace notifier | 112 } // namespace jingle_glue |
113 | 113 |
114 #endif // JINGLE_NOTIFIER_BASE_FAKE_SSL_CLIENT_SOCKET_H_ | 114 #endif // JINGLE_GLUE_FAKE_SSL_CLIENT_SOCKET_H_ |
OLD | NEW |