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 #include "net/socket/socks5_client_socket.h" | 5 #include "net/socket/socks5_client_socket.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 default: | 247 default: |
248 NOTREACHED() << "bad state"; | 248 NOTREACHED() << "bad state"; |
249 rv = ERR_UNEXPECTED; | 249 rv = ERR_UNEXPECTED; |
250 break; | 250 break; |
251 } | 251 } |
252 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); | 252 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); |
253 return rv; | 253 return rv; |
254 } | 254 } |
255 | 255 |
256 const char kSOCKS5GreetWriteData[] = { 0x05, 0x01, 0x00 }; // no authentication | 256 const char kSOCKS5GreetWriteData[] = { 0x05, 0x01, 0x00 }; // no authentication |
257 const char kSOCKS5GreetReadData[] = { 0x05, 0x00 }; | |
258 | 257 |
259 int SOCKS5ClientSocket::DoGreetWrite() { | 258 int SOCKS5ClientSocket::DoGreetWrite() { |
260 // Since we only have 1 byte to send the hostname length in, if the | 259 // Since we only have 1 byte to send the hostname length in, if the |
261 // URL has a hostname longer than 255 characters we can't send it. | 260 // URL has a hostname longer than 255 characters we can't send it. |
262 if (0xFF < host_request_info_.hostname().size()) { | 261 if (0xFF < host_request_info_.hostname().size()) { |
263 net_log_.AddEvent(NetLog::TYPE_SOCKS_HOSTNAME_TOO_BIG); | 262 net_log_.AddEvent(NetLog::TYPE_SOCKS_HOSTNAME_TOO_BIG); |
264 return ERR_SOCKS_CONNECTION_FAILED; | 263 return ERR_SOCKS_CONNECTION_FAILED; |
265 } | 264 } |
266 | 265 |
267 if (buffer_.empty()) { | 266 if (buffer_.empty()) { |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 | 477 |
479 int SOCKS5ClientSocket::GetPeerAddress(IPEndPoint* address) const { | 478 int SOCKS5ClientSocket::GetPeerAddress(IPEndPoint* address) const { |
480 return transport_->socket()->GetPeerAddress(address); | 479 return transport_->socket()->GetPeerAddress(address); |
481 } | 480 } |
482 | 481 |
483 int SOCKS5ClientSocket::GetLocalAddress(IPEndPoint* address) const { | 482 int SOCKS5ClientSocket::GetLocalAddress(IPEndPoint* address) const { |
484 return transport_->socket()->GetLocalAddress(address); | 483 return transport_->socket()->GetLocalAddress(address); |
485 } | 484 } |
486 | 485 |
487 } // namespace net | 486 } // namespace net |
OLD | NEW |