merged SOCKS4 fix into trunk

This commit is contained in:
Arvid Norberg 2014-07-20 19:46:15 +00:00
parent 6bd58da567
commit 4284606cbc
2 changed files with 9 additions and 0 deletions

View File

@ -89,6 +89,7 @@
* fix uTP edge case where udp socket buffer fills up
* fix nagle implementation in uTP
* SOCKS4 fix for trying to connect over IPv6
* fix saving resume data when removing all trackers
* fix bug in udp_socket when changing socks5 proxy quickly

View File

@ -293,6 +293,14 @@ namespace libtorrent
}
else if (m_version == 4)
{
// SOCKS4 only supports IPv4
if (!m_remote_endpoint.address().is_v4())
{
(*h)(error_code(boost::asio::error::address_family_not_supported));
error_code ec;
close(ec);
return;
}
m_buffer.resize(m_user.size() + 9);
char* p = &m_buffer[0];
write_uint8(4, p); // SOCKS VERSION 4