summaryrefslogtreecommitdiffstats
path: root/net/socket/socks_client_socket.h
diff options
context:
space:
mode:
authorarindam@chromium.org <arindam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-28 07:58:58 +0000
committerarindam@chromium.org <arindam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-28 07:58:58 +0000
commit76a51ac85ab739064c2c6b224d489cfa1767ae8a (patch)
tree25c176f934eff63c9849729ce77fa6671fc5d8c8 /net/socket/socks_client_socket.h
parentb87946e2b4fb718e62091a4b79f423c6c5750d2a (diff)
downloadchromium_src-76a51ac85ab739064c2c6b224d489cfa1767ae8a.zip
chromium_src-76a51ac85ab739064c2c6b224d489cfa1767ae8a.tar.gz
chromium_src-76a51ac85ab739064c2c6b224d489cfa1767ae8a.tar.bz2
Tests for socks4/4a implementation.
Refactoring of void BuildHandshakeWriteBuffer() to const std::string BuildHandshakeWriteBuffer() const,and removing private members handshake_buf_len_ and buffer_len_ (since buffer_ is now std::string, buffer_.size()) is more than sufficient for buffer size. TEST=unittests BUG=469 Review URL: http://codereview.chromium.org/139009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19474 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/socks_client_socket.h')
-rw-r--r--net/socket/socks_client_socket.h22
1 files changed, 12 insertions, 10 deletions
diff --git a/net/socket/socks_client_socket.h b/net/socket/socks_client_socket.h
index 03925ba..575f263 100644
--- a/net/socket/socks_client_socket.h
+++ b/net/socket/socks_client_socket.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef NET_BASE_SOCKS_CLIENT_SOCKET_H_
-#define NET_BASE_SOCKS_CLIENT_SOCKET_H_
+#ifndef NET_SOCKET_SOCKS_CLIENT_SOCKET_H_
+#define NET_SOCKET_SOCKS_CLIENT_SOCKET_H_
#include <string>
@@ -54,6 +54,10 @@ class SOCKSClientSocket : public ClientSocket {
#endif
private:
+ FRIEND_TEST(SOCKSClientSocketTest, CompleteHandshake);
+ FRIEND_TEST(SOCKSClientSocketTest, SOCKS4AFailedDNS);
+ FRIEND_TEST(SOCKSClientSocketTest, SOCKS4AIfDomainInIPv6);
+
enum State {
STATE_RESOLVE_HOST,
STATE_RESOLVE_HOST_COMPLETE,
@@ -85,7 +89,7 @@ class SOCKSClientSocket : public ClientSocket {
int DoHandshakeWrite();
int DoHandshakeWriteComplete(int result);
- void BuildHandshakeWriteBuffer();
+ const std::string BuildHandshakeWriteBuffer() const;
CompletionCallbackImpl<SOCKSClientSocket> io_callback_;
@@ -102,23 +106,21 @@ class SOCKSClientSocket : public ClientSocket {
// SOCKS handshake data. The length contains the expected size to
// read or write.
scoped_refptr<IOBuffer> handshake_buf_;
- int handshake_buf_len_;
// While writing, this buffer stores the complete write handshake data.
// While reading, it stores the handshake information received so far.
- scoped_array<char> buffer_;
- int buffer_len_;
+ std::string buffer_;
// This becomes true when the SOCKS handshake has completed and the
// overlying connection is free to communicate.
bool completed_handshake_;
// These contain the bytes sent / received by the SOCKS handshake.
- int bytes_sent_;
- int bytes_received_;
+ size_t bytes_sent_;
+ size_t bytes_received_;
// Used to resolve the hostname to which the SOCKS proxy will connect.
- SingleRequestHostResolver resolver_;
+ SingleRequestHostResolver host_resolver_;
AddressList addresses_;
HostResolver::RequestInfo host_request_info_;
@@ -127,5 +129,5 @@ class SOCKSClientSocket : public ClientSocket {
} // namespace net
-#endif // NET_BASE_SOCKS_CLIENT_SOCKET_H_
+#endif // NET_SOCKET_SOCKS_CLIENT_SOCKET_H_