Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(960)

Unified Diff: net/socket/socks5_client_socket.cc

Issue 507033: When talking to a SOCKS v5 proxy, default to sending addresses as raw domains... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Address wtc's comments Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/socket/socks5_client_socket.cc
===================================================================
--- net/socket/socks5_client_socket.cc (revision 34785)
+++ net/socket/socks5_client_socket.cc (working copy)
@@ -37,8 +37,9 @@
bytes_sent_(0),
bytes_received_(0),
read_header_size(kReadHeaderSize),
- host_resolver_(host_resolver),
host_request_info_(req_info) {
+ if (host_resolver)
+ host_resolver_.reset(new SingleRequestHostResolver(host_resolver));
}
SOCKS5ClientSocket::~SOCKS5ClientSocket() {
@@ -56,11 +57,18 @@
if (completed_handshake_)
return OK;
- next_state_ = STATE_RESOLVE_HOST;
load_log_ = load_log;
-
LoadLog::BeginEvent(load_log, LoadLog::TYPE_SOCKS5_CONNECT);
+ // If a host resolver was given, try to resolve the address locally.
+ // Otherwise let the proxy server handle the resolving.
+ if (host_resolver_.get()) {
+ next_state_ = STATE_RESOLVE_HOST;
+ } else {
+ next_state_ = STATE_GREET_WRITE;
+ address_type_ = kEndPointFailedDomain;
+ }
+
int rv = DoLoop(OK);
if (rv == ERR_IO_PENDING) {
user_callback_ = callback;
@@ -191,7 +199,7 @@
DCHECK_EQ(kEndPointUnresolved, address_type_);
next_state_ = STATE_RESOLVE_HOST_COMPLETE;
- return host_resolver_.Resolve(
+ return host_resolver_->Resolve(
host_request_info_, &addresses_, &io_callback_, load_log_);
}

Powered by Google App Engine
This is Rietveld 408576698