Chromium Code Reviews| Index: net/socket/socks_client_socket.cc |
| diff --git a/net/socket/socks_client_socket.cc b/net/socket/socks_client_socket.cc |
| index 01983d916b67e018dc080e4a0c6905df1ba32624..66a2763367ab872622e8ccc5145b06b5d4e86b44 100644 |
| --- a/net/socket/socks_client_socket.cc |
| +++ b/net/socket/socks_client_socket.cc |
| @@ -11,7 +11,6 @@ |
| #include "net/base/io_buffer.h" |
| #include "net/base/net_log.h" |
| #include "net/base/net_util.h" |
| -#include "net/base/sys_addrinfo.h" |
| #include "net/socket/client_socket_handle.h" |
| namespace net { |
| @@ -307,20 +306,18 @@ const std::string SOCKSClientSocket::BuildHandshakeWriteBuffer() const { |
| request.command = kSOCKSStreamRequest; |
| request.nw_port = base::HostToNet16(host_request_info_.port()); |
| - const struct addrinfo* ai = addresses_.head(); |
| - DCHECK(ai); |
| + DCHECK(!addresses_.empty()); |
| + const IPEndPoint& ipe = addresses_.front(); |
| // We disabled IPv6 results when resolving the hostname, so none of the |
| // results in the list will be IPv6. |
| // TODO(eroman): we only ever use the first address in the list. It would be |
| // more robust to try all the IP addresses we have before |
| // failing the connect attempt. |
| - CHECK_EQ(AF_INET, ai->ai_addr->sa_family); |
| - struct sockaddr_in* ipv4_host = |
| - reinterpret_cast<struct sockaddr_in*>(ai->ai_addr); |
| - memcpy(&request.ip, &ipv4_host->sin_addr, sizeof(ipv4_host->sin_addr)); |
| + CHECK_EQ(AF_INET, ipe.GetFamily()); |
| + memcpy(&request.ip, &ipe.address()[0], ipe.address().size()); |
|
eroman
2012/05/04 01:08:41
I'm not sure how I feel about this... The assumpti
szym
2012/05/04 02:38:29
Currently, IPAddressNumber stores data in same ord
eroman
2012/05/04 04:20:22
My paranoia stems from doing a memcpy() from a sou
|
| - DVLOG(1) << "Resolved Host is : " << NetAddressToString(ai); |
| + DVLOG(1) << "Resolved Host is : " << ipe.ToStringWithoutPort(); |
| std::string handshake_data(reinterpret_cast<char*>(&request), |
| sizeof(request)); |