mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-20 11:33:06 +00:00
Fix IPv6 incompatibility in HTTP code due to using raw IPv6 addresses in string format
This commit is contained in:
parent
7947d8b75d
commit
bd9b37a5a0
@ -3,6 +3,7 @@ package com.limelight.nvstream.http;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
import java.net.Inet6Address;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
@ -26,7 +27,17 @@ public class NvHTTP {
|
|||||||
public NvHTTP(InetAddress host, String uniqueId, String deviceName) {
|
public NvHTTP(InetAddress host, String uniqueId, String deviceName) {
|
||||||
this.uniqueId = uniqueId;
|
this.uniqueId = uniqueId;
|
||||||
this.deviceName = deviceName;
|
this.deviceName = deviceName;
|
||||||
this.baseUrl = "http://" + host.getHostAddress() + ":" + PORT;
|
|
||||||
|
String safeAddress;
|
||||||
|
if (host instanceof Inet6Address) {
|
||||||
|
// RFC2732-formatted IPv6 address for use in URL
|
||||||
|
safeAddress = "["+host.getHostAddress()+"]";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
safeAddress = host.getHostAddress();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.baseUrl = "http://" + safeAddress + ":" + PORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getXmlString(InputStream in, String tagname)
|
private String getXmlString(InputStream in, String tagname)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user