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

Unified Diff: net/socket/socks_client_socket.cc

Issue 567030: Add specific error codes for when SOCKS connect fails.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: rename ERR_SOCKS_CONNECT_* --> ERR_SOCKS_CONNECTION_* Created 10 years, 11 months 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
« no previous file with comments | « net/socket/socks5_client_socket_unittest.cc ('k') | net/socket/socks_client_socket_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/socks_client_socket.cc
===================================================================
--- net/socket/socks_client_socket.cc (revision 38060)
+++ net/socket/socks_client_socket.cc (working copy)
@@ -355,8 +355,10 @@
if (result == 0)
return ERR_CONNECTION_CLOSED;
- if (bytes_received_ + result > kReadHeaderSize)
- return ERR_INVALID_RESPONSE;
+ if (bytes_received_ + result > kReadHeaderSize) {
+ // TODO(eroman): Describe failure in LoadLog.
+ return ERR_SOCKS_CONNECTION_FAILED;
+ }
buffer_.append(handshake_buf_->data(), result);
bytes_received_ += result;
@@ -370,28 +372,27 @@
if (response->reserved_null != 0x00) {
LOG(ERROR) << "Unknown response from SOCKS server.";
- return ERR_INVALID_RESPONSE;
+ return ERR_SOCKS_CONNECTION_FAILED;
}
- // TODO(arindam): Add SOCKS specific failure codes in net_error_list.h
switch (response->code) {
case kServerResponseOk:
completed_handshake_ = true;
return OK;
case kServerResponseRejected:
LOG(ERROR) << "SOCKS request rejected or failed";
- return ERR_FAILED;
+ return ERR_SOCKS_CONNECTION_FAILED;
case kServerResponseNotReachable:
LOG(ERROR) << "SOCKS request failed because client is not running "
<< "identd (or not reachable from the server)";
- return ERR_NAME_NOT_RESOLVED;
+ return ERR_SOCKS_CONNECTION_HOST_UNREACHABLE;
case kServerResponseMismatchedUserId:
LOG(ERROR) << "SOCKS request failed because client's identd could "
<< "not confirm the user ID string in the request";
- return ERR_FAILED;
+ return ERR_SOCKS_CONNECTION_FAILED;
default:
LOG(ERROR) << "SOCKS server sent unknown response";
- return ERR_INVALID_RESPONSE;
+ return ERR_SOCKS_CONNECTION_FAILED;
}
// Note: we ignore the last 6 bytes as specified by the SOCKS protocol
« no previous file with comments | « net/socket/socks5_client_socket_unittest.cc ('k') | net/socket/socks_client_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698