forked from premiere/premiere-libtorrent
fixed url parsing bug related to IPv6 addresses. fixes #66
This commit is contained in:
parent
92f4792ee7
commit
daba3196c3
|
@ -1,3 +1,8 @@
|
|||
* Fixed bug in URL parser that failed to parse IPv6 addresses
|
||||
* added peer download rate approximation
|
||||
* added port filter for outgoing connection (to prevent
|
||||
triggering firewalls)
|
||||
* made most parameters configurable via session_settings
|
||||
* added encryption support
|
||||
* added parole mode for peers whose data fails the hash check.
|
||||
* optimized heap usage in piece-picker and web seed downloader.
|
||||
|
@ -8,7 +13,7 @@
|
|||
* added a half-open tcp connection limit that takes all connections
|
||||
in to account, not just peer connections.
|
||||
* added alerts for filtered IPs.
|
||||
* added support for SOCKS5 proxies and HTTP CONNECT proxies.
|
||||
* added support for SOCKS4 and 5 proxies and HTTP CONNECT proxies.
|
||||
* fixed proper distributed copies calculation.
|
||||
* added option to use openssl for sha-1 calculations.
|
||||
* optimized the piece picker in the case where a peer is a seed.
|
||||
|
|
|
@ -467,8 +467,19 @@ namespace libtorrent
|
|||
++start;
|
||||
}
|
||||
|
||||
std::string::iterator port_pos
|
||||
= std::find(start, url.end(), ':');
|
||||
std::string::iterator port_pos;
|
||||
|
||||
// this is for IPv6 addresses
|
||||
if (start != url.end() && *start == '[')
|
||||
{
|
||||
port_pos = std::find(start, url.end(), ']');
|
||||
if (port_pos == url.end()) throw std::runtime_error("invalid hostname syntax");
|
||||
port_pos = std::find(port_pos, url.end(), ':');
|
||||
}
|
||||
else
|
||||
{
|
||||
port_pos = std::find(start, url.end(), ':');
|
||||
}
|
||||
|
||||
if (port_pos < end)
|
||||
{
|
||||
|
|
|
@ -40,6 +40,12 @@ int test_main()
|
|||
TEST_CHECK(parse_url_components("http://host.com/path?foo:bar@foo:")
|
||||
== make_tuple("http", "", "host.com", 80, "/path?foo:bar@foo:"));
|
||||
|
||||
TEST_CHECK(parse_url_components("http://192.168.0.1/path/to/file")
|
||||
== make_tuple("http", "", "192.168.0.1", 80, "/path/to/file"));
|
||||
|
||||
TEST_CHECK(parse_url_components("http://[::1]/path/to/file")
|
||||
== make_tuple("http", "", "[::1]", 80, "/path/to/file"));
|
||||
|
||||
// base64 test vectors from http://www.faqs.org/rfcs/rfc4648.html
|
||||
|
||||
TEST_CHECK(base64encode("") == "");
|
||||
|
|
Loading…
Reference in New Issue