mirror of
https://github.com/anthonyraymond/joal.git
synced 2024-11-10 09:02:31 +08:00
ipv6 placeholder is replaced by url encoded value
This commit is contained in:
parent
dfebbd9504
commit
50e5137f52
2 changed files with 2 additions and 2 deletions
|
@ -74,7 +74,7 @@ public class BitTorrentClient {
|
|||
if (connectionHandler.getIpAddress() instanceof Inet4Address) {
|
||||
emulatedClientQuery = emulatedClientQuery.replaceAll("\\{ip}", connectionHandler.getIpAddress().getHostAddress());
|
||||
} else if(connectionHandler.getIpAddress() instanceof Inet6Address) {
|
||||
emulatedClientQuery = emulatedClientQuery.replaceAll("\\{ipv6}", connectionHandler.getIpAddress().getHostAddress());
|
||||
emulatedClientQuery = emulatedClientQuery.replaceAll("\\{ipv6}", URLEncoder.encode(connectionHandler.getIpAddress().getHostAddress(), Torrent.BYTE_ENCODING));
|
||||
}
|
||||
emulatedClientQuery = emulatedClientQuery.replaceAll("[&]*[a-zA-Z0-9]+=\\{ipv6}", "");
|
||||
emulatedClientQuery = emulatedClientQuery.replaceAll("[&]*[a-zA-Z0-9]+=\\{ip}", "");
|
||||
|
|
|
@ -176,7 +176,7 @@ public class BitTorrentClientUrlBuilderTest {
|
|||
final URL announceURL = client.buildAnnounceURL(new URL("http://my.tracker.com/announce"), RequestEvent.STARTED, torrent, connHandler);
|
||||
|
||||
assertThat(announceURL.getQuery())
|
||||
.isEqualTo("ipv6=" + connHandler.getIpAddress().getHostAddress());
|
||||
.isEqualTo("ipv6=" + URLEncoder.encode(connHandler.getIpAddress().getHostAddress(), Torrent.BYTE_ENCODING));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in a new issue