mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
WEB-11542 File/Open URL: provide a way to post 'User-Agent' header
This commit is contained in:
+2
@@ -30,6 +30,7 @@ import com.intellij.util.Url;
|
||||
import com.intellij.util.io.UrlConnectionUtil;
|
||||
import com.intellij.util.net.ssl.CertificateManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.io.Responses;
|
||||
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
@@ -69,6 +70,7 @@ public class DefaultRemoteContentProvider extends RemoteContentProvider {
|
||||
String presentableUrl = StringUtil.trimMiddle(url.trimParameters().toDecodedForm(), 40);
|
||||
callback.setProgressText(VfsBundle.message("download.progress.connecting", presentableUrl), true);
|
||||
HttpURLConnection connection = (HttpURLConnection)new URL(url.toExternalForm()).openConnection();
|
||||
connection.setRequestProperty("User-Agent", Responses.getServerHeaderValue());
|
||||
connection.setConnectTimeout(CONNECT_TIMEOUT);
|
||||
connection.setReadTimeout(READ_TIMEOUT);
|
||||
if (connection instanceof HttpsURLConnection) {
|
||||
|
||||
Reference in New Issue
Block a user