Skip to content

Commit 916de93

Browse files
author
Federico Fissore
committed
Using new CustomProxySelector in FileDownloader
1 parent 708da3b commit 916de93

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

arduino-core/src/cc/arduino/utils/network/FileDownloader.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@
2929

3030
package cc.arduino.utils.network;
3131

32+
import cc.arduino.net.CustomProxySelector;
3233
import org.apache.commons.codec.binary.Base64;
3334
import org.apache.commons.compress.utils.IOUtils;
35+
import processing.app.PreferencesData;
3436

3537
import java.io.File;
3638
import java.io.IOException;
@@ -120,7 +122,10 @@ public void download() throws InterruptedException {
120122

121123
setStatus(Status.CONNECTING);
122124

123-
Proxy proxy = ProxySelector.getDefault().select(downloadUrl.toURI()).get(0);
125+
Proxy proxy = new CustomProxySelector(PreferencesData.getMap()).getProxyFor(downloadUrl.toURI());
126+
if ("true".equals(System.getProperty("DEBUG"))) {
127+
System.err.println("Using proxy " + proxy);
128+
}
124129

125130
HttpURLConnection connection = (HttpURLConnection) downloadUrl.openConnection(proxy);
126131

0 commit comments

Comments
 (0)