fix error when not using proxy
This commit is contained in:
@@ -37,7 +37,12 @@ class ImageDownloader {
|
|||||||
try {
|
try {
|
||||||
HttpURLConnection.setFollowRedirects(true)
|
HttpURLConnection.setFollowRedirects(true)
|
||||||
var url = URL(imageUrl)
|
var url = URL(imageUrl)
|
||||||
var huc = url.openConnection(HttpClientManager.getDefaultProxy()) as HttpURLConnection
|
var huc =
|
||||||
|
if (HttpClientManager.getDefaultProxy() != null) {
|
||||||
|
url.openConnection(HttpClientManager.getDefaultProxy()) as HttpURLConnection
|
||||||
|
} else {
|
||||||
|
url.openConnection() as HttpURLConnection
|
||||||
|
}
|
||||||
huc.instanceFollowRedirects = true
|
huc.instanceFollowRedirects = true
|
||||||
var responseCode = huc.responseCode
|
var responseCode = huc.responseCode
|
||||||
|
|
||||||
@@ -46,7 +51,12 @@ class ImageDownloader {
|
|||||||
|
|
||||||
// open the new connnection again
|
// open the new connnection again
|
||||||
url = URL(newUrl)
|
url = URL(newUrl)
|
||||||
huc = url.openConnection(HttpClientManager.getDefaultProxy()) as HttpURLConnection
|
huc =
|
||||||
|
if (HttpClientManager.getDefaultProxy() != null) {
|
||||||
|
url.openConnection(HttpClientManager.getDefaultProxy()) as HttpURLConnection
|
||||||
|
} else {
|
||||||
|
url.openConnection() as HttpURLConnection
|
||||||
|
}
|
||||||
responseCode = huc.responseCode
|
responseCode = huc.responseCode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user