From 5e34d9fde8188e181e648da95a41afdd80ce5172 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Mon, 23 Jun 2014 11:11:31 +0200 Subject: [PATCH] WEB-11542 File/Open URL: provide a way to post 'User-Agent' header --- .../openapi/vfs/impl/http/DefaultRemoteContentProvider.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/http/DefaultRemoteContentProvider.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/http/DefaultRemoteContentProvider.java index e2a43ce4a52f..6684090a218d 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/http/DefaultRemoteContentProvider.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/http/DefaultRemoteContentProvider.java @@ -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) {