Bug 578341 - Network Settings - Missing Entry "Dynamic" in Network
Settings
Improve multiple architecture support:
- add new o.e.core.net.win32 fragment that is implemented using
JNA and can support multiple architectures
- make o.e.core.net.win32.x86_64 an empty fragment that requires
new o.e.core.net.win32
- remove WindowsProxyProvider as it is no longer used
- remove C code for windows proxy support
Improve caching and performance
- re-use winhttp session to allow caching autoproxy by the OS
- let the OS decide if WPAD or PAC url should be used
- stop caching autoproxy results in ProxyProvider to support updated
proxy settings when connection or setting change
- Only set fAutoLogonIfChallenged true when login is really required
Change-Id: I845cca5cbe917c170ffaaf79ca5c0e3ce675f1c0
Signed-off-by: Rolf Theunissen <rolf.theunissen@gmail.com>
Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.team/+/190552
Tested-by: Platform Bot <platform-bot@eclipse.org>
diff --git a/bundles/org.eclipse.core.net.win32.x86_64/.classpath b/bundles/org.eclipse.core.net.win32.x86_64/.classpath
index eca7bdb..075009d 100644
--- a/bundles/org.eclipse.core.net.win32.x86_64/.classpath
+++ b/bundles/org.eclipse.core.net.win32.x86_64/.classpath
@@ -2,6 +2,5 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/bundles/org.eclipse.core.net.win32.x86_64/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.net.win32.x86_64/META-INF/MANIFEST.MF
index a484e85..6c475ec 100644
--- a/bundles/org.eclipse.core.net.win32.x86_64/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.core.net.win32.x86_64/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@
Bundle-Vendor: %providerName
Bundle-Localization: fragment
Bundle-SymbolicName: org.eclipse.core.net.win32.x86_64;singleton:=true
-Bundle-Version: 1.1.500.qualifier
+Bundle-Version: 1.1.600.qualifier
Fragment-Host: org.eclipse.core.net;bundle-version="1.1.0"
Eclipse-PlatformFilter: (& (osgi.os=win32) (osgi.arch=x86_64))
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/bundles/org.eclipse.core.net.win32.x86_64/META-INF/p2.inf b/bundles/org.eclipse.core.net.win32.x86_64/META-INF/p2.inf
new file mode 100644
index 0000000..bb8ec12
--- /dev/null
+++ b/bundles/org.eclipse.core.net.win32.x86_64/META-INF/p2.inf
@@ -0,0 +1,2 @@
+requires.0.namespace=org.eclipse.equinox.p2.iu
+requires.0.name=org.eclipse.core.net.win32
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.net.win32.x86_64/build.properties b/bundles/org.eclipse.core.net.win32.x86_64/build.properties
index 4560b2b..a8599f0 100644
--- a/bundles/org.eclipse.core.net.win32.x86_64/build.properties
+++ b/bundles/org.eclipse.core.net.win32.x86_64/build.properties
@@ -14,7 +14,5 @@
bin.includes = fragment.properties,\
.,\
about.html,\
- META-INF/,\
- jWinHttp-1.0.0.dll
+ META-INF/
src.includes = about.html
-source.. = src/
diff --git a/bundles/org.eclipse.core.net.win32.x86_64/jWinHttp-1.0.0.dll b/bundles/org.eclipse.core.net.win32.x86_64/jWinHttp-1.0.0.dll
deleted file mode 100644
index 7279d5a..0000000
--- a/bundles/org.eclipse.core.net.win32.x86_64/jWinHttp-1.0.0.dll
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.core.net.win32.x86_64/pom.xml b/bundles/org.eclipse.core.net.win32.x86_64/pom.xml
index c1fc55c..e4b1de1 100644
--- a/bundles/org.eclipse.core.net.win32.x86_64/pom.xml
+++ b/bundles/org.eclipse.core.net.win32.x86_64/pom.xml
@@ -19,7 +19,7 @@
</parent>
<groupId>org.eclipse.core</groupId>
<artifactId>org.eclipse.core.net.win32.x86_64</artifactId>
- <version>1.1.500-SNAPSHOT</version>
+ <version>1.1.600-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>
diff --git a/bundles/org.eclipse.core.net.win32.x86_64/src/org/eclipse/core/net/ProxyProvider.java b/bundles/org.eclipse.core.net.win32.x86_64/src/org/eclipse/core/net/ProxyProvider.java
deleted file mode 100644
index e32aae2..0000000
--- a/bundles/org.eclipse.core.net.win32.x86_64/src/org/eclipse/core/net/ProxyProvider.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.net;
-
-import org.eclipse.core.internal.net.WindowsProxyProvider;
-
-public class ProxyProvider extends WindowsProxyProvider {
-}
diff --git a/bundles/org.eclipse.core.net.win32/.classpath b/bundles/org.eclipse.core.net.win32/.classpath
new file mode 100644
index 0000000..eca7bdb
--- /dev/null
+++ b/bundles/org.eclipse.core.net.win32/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.core.net.win32/.project b/bundles/org.eclipse.core.net.win32/.project
new file mode 100644
index 0000000..d57569d
--- /dev/null
+++ b/bundles/org.eclipse.core.net.win32/.project
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.core.net.win32</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
+
diff --git a/bundles/org.eclipse.core.net.win32/.settings/org.eclipse.core.runtime.prefs b/bundles/org.eclipse.core.net.win32/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 0000000..5a0ad22
--- /dev/null
+++ b/bundles/org.eclipse.core.net.win32/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/bundles/org.eclipse.core.net.win32/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.core.net.win32/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..a698e59
--- /dev/null
+++ b/bundles/org.eclipse.core.net.win32/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/bundles/org.eclipse.core.net.win32/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.net.win32/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..fe35f4b
--- /dev/null
+++ b/bundles/org.eclipse.core.net.win32/META-INF/MANIFEST.MF
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %fragmentName
+Bundle-Vendor: %providerName
+Bundle-Localization: fragment
+Bundle-SymbolicName: org.eclipse.core.net.win32;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Fragment-Host: org.eclipse.core.net;bundle-version="1.1.0"
+Eclipse-PlatformFilter: (osgi.os=win32)
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Automatic-Module-Name: org.eclipse.core.net.win32
+Require-Bundle: com.sun.jna,
+ com.sun.jna.platform
diff --git a/bundles/org.eclipse.core.net.win32/about.html b/bundles/org.eclipse.core.net.win32/about.html
new file mode 100644
index 0000000..164f781
--- /dev/null
+++ b/bundles/org.eclipse.core.net.win32/about.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>About</title>
+</head>
+<body lang="EN-US">
+ <h2>About This Content</h2>
+
+ <p>November 30, 2017</p>
+ <h3>License</h3>
+
+ <p>
+ The Eclipse Foundation makes available all content in this plug-in
+ ("Content"). Unless otherwise indicated below, the Content
+ is provided to you under the terms and conditions of the Eclipse
+ Public License Version 2.0 ("EPL"). A copy of the EPL is
+ available at <a href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
+ For purposes of the EPL, "Program" will mean the Content.
+ </p>
+
+ <p>
+ If you did not receive this Content directly from the Eclipse
+ Foundation, the Content is being redistributed by another party
+ ("Redistributor") and different terms and conditions may
+ apply to your use of any object code in the Content. Check the
+ Redistributor's license that was provided with the Content. If no such
+ license exists, contact the Redistributor. Unless otherwise indicated
+ below, the terms and conditions of the EPL still apply to any source
+ code in the Content and such source code may be obtained at <a
+ href="http://www.eclipse.org/">http://www.eclipse.org</a>.
+ </p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.net.win32/build.properties b/bundles/org.eclipse.core.net.win32/build.properties
new file mode 100644
index 0000000..b05379f
--- /dev/null
+++ b/bundles/org.eclipse.core.net.win32/build.properties
@@ -0,0 +1,19 @@
+###############################################################################
+# Copyright (c) 2009, 2022 IBM Corporation and others.
+#
+# This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+bin.includes = fragment.properties,\
+ .,\
+ about.html,\
+ META-INF/
+src.includes = about.html
+source.. = src/
diff --git a/bundles/org.eclipse.core.net.win32/fragment.properties b/bundles/org.eclipse.core.net.win32/fragment.properties
new file mode 100644
index 0000000..ff4e4de
--- /dev/null
+++ b/bundles/org.eclipse.core.net.win32/fragment.properties
@@ -0,0 +1,15 @@
+###############################################################################
+# Copyright (c) 2009 IBM Corporation and others.
+#
+# This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+fragmentName = Proxy for Windows
+providerName = Eclipse.org
diff --git a/bundles/org.eclipse.core.net.win32/pom.xml b/bundles/org.eclipse.core.net.win32/pom.xml
new file mode 100644
index 0000000..496f985
--- /dev/null
+++ b/bundles/org.eclipse.core.net.win32/pom.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2012, 2022 Eclipse Foundation and others.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Distribution License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/org/documents/edl-v10.php
+
+ Contributors:
+ Igor Fedorenko - initial implementation
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>eclipse.platform.team</artifactId>
+ <groupId>eclipse.platform.team</groupId>
+ <version>4.24.0-SNAPSHOT</version>
+ <relativePath>../../</relativePath>
+ </parent>
+ <groupId>org.eclipse.core</groupId>
+ <artifactId>org.eclipse.core.net.win32</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+
+ <properties>
+ <skipAPIAnalysis>true</skipAPIAnalysis>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>target-platform-configuration</artifactId>
+ <configuration>
+ <environments>
+ <environment>
+ <os>win32</os>
+ <ws>win32</ws>
+ </environment>
+ </environments>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/ProxyBypass.java b/bundles/org.eclipse.core.net.win32/src/org/eclipse/core/internal/net/proxy/win32/winhttp/ProxyBypass.java
similarity index 100%
rename from bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/ProxyBypass.java
rename to bundles/org.eclipse.core.net.win32/src/org/eclipse/core/internal/net/proxy/win32/winhttp/ProxyBypass.java
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/ProxyProviderUtil.java b/bundles/org.eclipse.core.net.win32/src/org/eclipse/core/internal/net/proxy/win32/winhttp/ProxyProviderUtil.java
similarity index 100%
rename from bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/ProxyProviderUtil.java
rename to bundles/org.eclipse.core.net.win32/src/org/eclipse/core/internal/net/proxy/win32/winhttp/ProxyProviderUtil.java
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/StaticProxyConfig.java b/bundles/org.eclipse.core.net.win32/src/org/eclipse/core/internal/net/proxy/win32/winhttp/StaticProxyConfig.java
similarity index 100%
rename from bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/StaticProxyConfig.java
rename to bundles/org.eclipse.core.net.win32/src/org/eclipse/core/internal/net/proxy/win32/winhttp/StaticProxyConfig.java
diff --git a/bundles/org.eclipse.core.net.win32/src/org/eclipse/core/net/ProxyProvider.java b/bundles/org.eclipse.core.net.win32/src/org/eclipse/core/net/ProxyProvider.java
new file mode 100644
index 0000000..6529ae3
--- /dev/null
+++ b/bundles/org.eclipse.core.net.win32/src/org/eclipse/core/net/ProxyProvider.java
@@ -0,0 +1,456 @@
+/*******************************************************************************
+ * Copyright (c) 2022 Rolf Theunissen and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Rolf Theunissen <rolf.theunissen@gmail.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.core.net;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.internal.net.AbstractProxyProvider;
+import org.eclipse.core.internal.net.Activator;
+import org.eclipse.core.internal.net.Policy;
+import org.eclipse.core.internal.net.ProxyData;
+import org.eclipse.core.internal.net.StringUtil;
+import org.eclipse.core.internal.net.proxy.win32.winhttp.ProxyBypass;
+import org.eclipse.core.internal.net.proxy.win32.winhttp.ProxyProviderUtil;
+import org.eclipse.core.internal.net.proxy.win32.winhttp.StaticProxyConfig;
+import org.eclipse.core.net.proxy.IProxyData;
+
+import com.sun.jna.LastErrorException;
+import com.sun.jna.Native;
+import com.sun.jna.Pointer;
+import com.sun.jna.Structure;
+import com.sun.jna.Structure.FieldOrder;
+import com.sun.jna.platform.win32.Kernel32;
+import com.sun.jna.platform.win32.Kernel32Util;
+import com.sun.jna.platform.win32.WTypes.LPWSTR;
+import com.sun.jna.platform.win32.WinBase;
+import com.sun.jna.platform.win32.WinDef.HMODULE;
+import com.sun.jna.platform.win32.WinNT;
+import com.sun.jna.ptr.PointerByReference;
+import com.sun.jna.win32.StdCallLibrary;
+import com.sun.jna.win32.W32APIOptions;
+
+/**
+ * The <code>ProxyProvivider</code> gets its settings from the "internet options
+ * >> connection settings". For this it uses the Windows WinHttp API.
+ *
+ * @see "http://msdn2.microsoft.com/en-us/library/aa382925(VS.85).aspx"
+ */
+public class ProxyProvider extends AbstractProxyProvider {
+
+ private static final String LIBRARY_NAME = "winhttp";
+ private static final String USER_AGENT = "WinHttpProxyProvider";
+ private static final ProxyData[] EMPTY_PROXIES = new ProxyData[0];
+
+ private static WinHttp fWinHttp;
+ private static boolean isWinHttpLoaded = false;
+
+ private Pointer hHttpSession;
+ private boolean isWinHttpInitialized = false;
+
+ /* Cache static configuration */
+ private StaticProxyConfig fStaticProxyConfig;
+ private String fProxiesString;
+ private String fProxyBypassString;
+
+ static {
+ try {
+ fWinHttp = Native.load(LIBRARY_NAME, WinHttp.class, W32APIOptions.UNICODE_OPTIONS);
+ fWinHttp = (WinHttp) Native.synchronizedLibrary(fWinHttp);
+ if (Policy.DEBUG_SYSTEM_PROVIDERS) {
+ Policy.debug("Loaded library " + System.mapLibraryName(LIBRARY_NAME));
+ }
+ isWinHttpLoaded = true;
+ } catch (UnsatisfiedLinkError e) {
+ if (Policy.DEBUG_SYSTEM_PROVIDERS) {
+ Policy.debug("Could not load library " + System.mapLibraryName(LIBRARY_NAME));
+ }
+ Activator.logError("Problem during initializing system proxy configuration.", e);
+ }
+ }
+
+ public ProxyProvider() {
+ if (isWinHttpLoaded) {
+ initialize();
+ }
+ }
+
+ @Override
+ public IProxyData[] select(URI uri) {
+ IProxyData[] proxies = getSystemProxyInfo(uri);
+ if (Policy.DEBUG) {
+ Policy.debug("WindowsProxyProvider#select result for [" + uri + "]");
+ for (IProxyData proxy : proxies) {
+ System.out.println(" " + proxy);
+ }
+ }
+ return proxies;
+ }
+
+ protected IProxyData[] getSystemProxyInfo(URI uri) {
+ WinHttp.WinHttpCurrentUserIEProxyConfig proxyConfig = getProxyConfig();
+ if (proxyConfig == null) {
+ if (Policy.DEBUG_SYSTEM_PROVIDERS) {
+ Policy.debug("Error getting proxy configuration");
+ }
+ return EMPTY_PROXIES;
+ }
+
+ try {
+ // Dynamic configuration - WPAD and/or PAC
+ // WinHTTP PAC only supports 'http[s]:', see ERROR_WINHTTP_UNRECOGNIZED_SCHEME
+ if (isWinHttpInitialized && (proxyConfig.fAutoDetect || proxyConfig.lpszAutoConfigUrl != null)
+ && (IProxyData.HTTP_PROXY_TYPE.equalsIgnoreCase(uri.getScheme())
+ || IProxyData.HTTPS_PROXY_TYPE.equalsIgnoreCase(uri.getScheme()))) {
+ WinHttp.WinHttpAutoProxyOptions autoProxyOptions = new WinHttp.WinHttpAutoProxyOptions();
+ WinHttp.WinHttpProxyInfo proxyInfo = new WinHttp.WinHttpProxyInfo();
+
+ // WPAD: Web Proxy Auto-Discovery configuration
+ if (proxyConfig.fAutoDetect) {
+ if (Policy.DEBUG_SYSTEM_PROVIDERS) {
+ Policy.debug("Dynamic proxy configuration using WPAD");
+ }
+ autoProxyOptions.dwFlags = WinHttp.AUTOPROXY_AUTO_DETECT;
+ autoProxyOptions.dwAutoDetectFlags = WinHttp.AUTO_DETECT_TYPE_DHCP | WinHttp.AUTO_DETECT_TYPE_DNS_A;
+ }
+ // PAC: Proxy-Auto Configuration
+ // When both WPAD and PAC are set, WinHTTP tries PAC only after WPAD failed
+ if (proxyConfig.lpszAutoConfigUrl != null) {
+ if (Policy.DEBUG_SYSTEM_PROVIDERS) {
+ Policy.debug("Dynamic proxy configuration using PAC url");
+ }
+ autoProxyOptions.dwFlags |= WinHttp.AUTOPROXY_CONFIG_URL;
+ autoProxyOptions.lpszAutoConfigUrl = proxyConfig.getAutoConfigUrl();
+ }
+ autoProxyOptions.fAutoLogonIfChallenged = true;
+
+ try {
+ getProxyForUrl(hHttpSession, uri.toString(), autoProxyOptions, proxyInfo);
+ if (Policy.DEBUG_SYSTEM_PROVIDERS) {
+ Policy.debug("Dynamic proxy configuration returned: Proxy '" + proxyInfo.getProxy()
+ + "'; ProxyByPass '" + proxyInfo.getProxyBypass() + "';");
+ }
+
+ ProxyBypass proxyBypass = new ProxyBypass(proxyInfo.getProxyBypass());
+ if (proxyBypass.bypassProxyFor(uri)) {
+ return EMPTY_PROXIES;
+ }
+ return toArray(ProxyProviderUtil.getProxies(proxyInfo.getProxy()));
+ } catch (LastErrorException e) {
+ // WPAD/PAC errors are intermittent, they can disappear when network
+ // configuration changes. Ignore errors, continue to static configuration.
+ if (Policy.DEBUG_SYSTEM_PROVIDERS) {
+ Policy.debug("Dynamic proxy configuration returned error: " + formatMessage(e.getErrorCode()));
+ }
+ } finally {
+ proxyInfo.free();
+ }
+
+ }
+ // Static configuration
+ if (proxyConfig.lpszProxy != null) {
+ if (Policy.DEBUG_SYSTEM_PROVIDERS) {
+ Policy.debug("Static proxy configuration: Proxy '" + proxyConfig.getProxy() + "'; ProxyByPass '"
+ + proxyConfig.getProxyBypass() + "';");
+ }
+ StaticProxyConfig staticProxyConfig = getStaticConfig(proxyConfig.getProxy(),
+ proxyConfig.getProxyBypass());
+
+ List<IProxyData> proxies = new ArrayList<>();
+ staticProxyConfig.select(uri, proxies);
+ return toArray(proxies);
+ }
+
+ // Default configuration direct connection
+ if (Policy.DEBUG_SYSTEM_PROVIDERS) {
+ Policy.debug("No proxy configuration");
+ }
+ return EMPTY_PROXIES;
+
+ } finally {
+ proxyConfig.free();
+ }
+ }
+
+ @Override
+ protected IProxyData[] getProxyData() {
+ WinHttp.WinHttpCurrentUserIEProxyConfig proxyConfig = getProxyConfig();
+ if (proxyConfig == null) {
+ if (Policy.DEBUG_SYSTEM_PROVIDERS) {
+ Policy.debug("Error getting proxy configuration");
+ }
+ return EMPTY_PROXIES;
+ }
+
+ try {
+ if (isWinHttpInitialized && (proxyConfig.fAutoDetect || proxyConfig.lpszAutoConfigUrl != null)) {
+ // Dynamic configuration
+ if (Policy.DEBUG_SYSTEM_PROVIDERS) {
+ Policy.debug("Dynamic proxy configuration");
+ }
+ ProxyData data = new ProxyData(IProxyData.HTTP_PROXY_TYPE, "", -1, false, "WINDOWS_IE");
+ data.setDynamic(true);
+ return new IProxyData[] { data };
+ } else {
+ // Static Configuration
+ if (Policy.DEBUG_SYSTEM_PROVIDERS) {
+ Policy.debug("Static proxy configuration");
+ }
+ if (proxyConfig.lpszProxy != null) {
+ StaticProxyConfig staticProxyConfig = getStaticConfig(proxyConfig.getProxy(),
+ proxyConfig.getProxyBypass());
+ return staticProxyConfig.getProxyData();
+ }
+ }
+ } finally {
+ proxyConfig.free();
+ }
+ // Default configuration direct connection
+ if (Policy.DEBUG_SYSTEM_PROVIDERS) {
+ Policy.debug("No proxy configuration");
+ }
+ return EMPTY_PROXIES;
+ }
+
+ @Override
+ protected String[] getNonProxiedHosts() {
+ WinHttp.WinHttpCurrentUserIEProxyConfig proxyConfig = getProxyConfig();
+ if (proxyConfig == null) {
+ // No configuration
+ return null;
+ }
+
+ try {
+ if (isWinHttpInitialized && (proxyConfig.fAutoDetect || proxyConfig.lpszAutoConfigUrl != null)) {
+ // Dynamic configuration
+ if (Policy.DEBUG_SYSTEM_PROVIDERS) {
+ Policy.debug("Dynamic proxy configuration");
+ }
+ return null;
+ } else if (proxyConfig.lpszProxy != null) {
+ // Static configuration
+ if (Policy.DEBUG_SYSTEM_PROVIDERS) {
+ Policy.debug("Static proxy configuration");
+ }
+ StaticProxyConfig staticProxyConfig = getStaticConfig(proxyConfig.getProxy(),
+ proxyConfig.getProxyBypass());
+ return staticProxyConfig.getNonProxiedHosts();
+ }
+ } finally {
+ proxyConfig.free();
+ }
+ if (Policy.DEBUG_SYSTEM_PROVIDERS) {
+ Policy.debug("No proxy configuration");
+ }
+ return null;
+ }
+
+ private void initialize() {
+ try {
+ hHttpSession = fWinHttp.WinHttpOpen(USER_AGENT, WinHttp.ACCESS_TYPE_NO_PROXY, WinHttp.NO_PROXY_NAME,
+ WinHttp.NO_PROXY_BYPASS, 0);
+ isWinHttpInitialized = true;
+ } catch (LastErrorException e) {
+ isWinHttpInitialized = false;
+ Activator.logError("Problem during initializing WinHTTP session:" + formatMessage(e.getErrorCode()), null);
+ }
+
+ }
+
+ private WinHttp.WinHttpCurrentUserIEProxyConfig getProxyConfig() {
+ if (isWinHttpLoaded) {
+ WinHttp.WinHttpCurrentUserIEProxyConfig proxyConfig = new WinHttp.WinHttpCurrentUserIEProxyConfig();
+ try {
+ fWinHttp.WinHttpGetIEProxyConfigForCurrentUser(proxyConfig);
+ return proxyConfig;
+ } catch (LastErrorException e) {
+ proxyConfig.free();
+ Activator.logError("Problem during loading proxy configuration: " + formatMessage(e.getErrorCode()),
+ null);
+ }
+ }
+ return null;
+ }
+
+ private StaticProxyConfig getStaticConfig(String proxyString, String proxyBypassString) {
+ if (fStaticProxyConfig == null || !StringUtil.equals(fProxiesString, proxyString)
+ || !StringUtil.equals(fProxyBypassString, proxyBypassString)) {
+ fStaticProxyConfig = new StaticProxyConfig(proxyString, proxyBypassString);
+ fProxiesString = proxyString;
+ fProxyBypassString = proxyBypassString;
+ }
+ return fStaticProxyConfig;
+ }
+
+ /**
+ * https://docs.microsoft.com/en-us/windows/win32/winhttp/autoproxy-cache To
+ * improve performance when WinHTTP uses the out-of-process resolver, it is
+ * necessary to first try resolving with fAutoLogonIfChallenged set to false.
+ */
+ private static boolean getProxyForUrl(Pointer hSession, String lpcwszUrl,
+ WinHttp.WinHttpAutoProxyOptions pAutoProxyOptions, WinHttp.WinHttpProxyInfo pProxyInfo)
+ throws LastErrorException {
+ try {
+ return fWinHttp.WinHttpGetProxyForUrl(hSession, lpcwszUrl, pAutoProxyOptions, pProxyInfo);
+ } catch (LastErrorException e) {
+ if (e.getErrorCode() == WinHttp.ERROR_LOGIN_FAILURE) {
+ pAutoProxyOptions.fAutoLogonIfChallenged = true;
+ return fWinHttp.WinHttpGetProxyForUrl(hSession, lpcwszUrl, pAutoProxyOptions, pProxyInfo);
+ }
+ throw e;
+ }
+ }
+
+ private static IProxyData[] toArray(List<IProxyData> proxies) {
+ return proxies.toArray(new IProxyData[proxies.size()]);
+ }
+
+ private interface WinHttp extends StdCallLibrary {
+ // WinHttp error codes
+ int ERROR_BASE = 12000;
+ int ERROR_LOGIN_FAILURE = ERROR_BASE + 15;
+ int ERROR_LAST = ERROR_BASE + 186;
+
+ // Values for WinHttpOpen dwAccessType
+ int ACCESS_TYPE_NO_PROXY = 1;
+
+ // Prettifiers for optional parameters WinHttpOpen pszProxy and pszProxyBypass
+ String NO_PROXY_NAME = null;
+ String NO_PROXY_BYPASS = null;
+
+ // Flags for WINHTTP_AUTOPROXY_OPTIONS::dwFlags
+ int AUTOPROXY_AUTO_DETECT = 0x00000001;;
+ int AUTOPROXY_CONFIG_URL = 0x00000002;
+
+ // Flags for WINHTTP_AUTOPROXY_OPTIONS::dwAutoDetectFlags
+ int AUTO_DETECT_TYPE_DHCP = 0x00000001;
+ int AUTO_DETECT_TYPE_DNS_A = 0x00000002;
+
+ boolean WinHttpCloseHandle(Pointer hInternet) throws LastErrorException;
+
+ Pointer WinHttpOpen(String pszAgent, int dwAccessType, String pszProxy, String pszProxyByPass, int dwFlags)
+ throws LastErrorException;
+
+ boolean WinHttpGetIEProxyConfigForCurrentUser(WinHttpCurrentUserIEProxyConfig pProxyConfig)
+ throws LastErrorException;
+
+ boolean WinHttpGetProxyForUrl(Pointer hSession, String lpcwszUrl, WinHttpAutoProxyOptions pAutoProxyOptions,
+ WinHttpProxyInfo pProxyInfo) throws LastErrorException;
+
+ @FieldOrder({ "dwFlags", "dwAutoDetectFlags", "lpszAutoConfigUrl", "lpvReserved", "dwReserved",
+ "fAutoLogonIfChallenged" })
+ @SuppressWarnings("unused")
+ static class WinHttpAutoProxyOptions extends Structure {
+ public int dwFlags;
+ public int dwAutoDetectFlags;
+ public String lpszAutoConfigUrl;
+ public Pointer lpvReserved;
+ public int dwReserved;
+ public boolean fAutoLogonIfChallenged;
+ }
+
+ @FieldOrder({ "dwAccessType", "lpszProxy", "lpszProxyBypass" })
+ @SuppressWarnings("unused")
+ static class WinHttpProxyInfo extends Structure {
+ public int dwAccessType;
+ public LPWSTR lpszProxy;
+ public LPWSTR lpszProxyBypass;
+
+ public String getProxy() {
+ return lpszProxy == null ? null : lpszProxy.getValue();
+ }
+
+ public String getProxyBypass() {
+ return lpszProxyBypass == null ? null : lpszProxyBypass.getValue();
+ }
+
+ public void free() {
+ if (lpszProxy != null) {
+ Kernel32Util.freeGlobalMemory(lpszProxy.getPointer());
+ }
+ if (lpszProxyBypass != null) {
+ Kernel32Util.freeGlobalMemory(lpszProxyBypass.getPointer());
+ }
+ }
+ }
+
+ @FieldOrder({ "fAutoDetect", "lpszAutoConfigUrl", "lpszProxy", "lpszProxyBypass" })
+ static class WinHttpCurrentUserIEProxyConfig extends Structure {
+ public boolean fAutoDetect;
+ public LPWSTR lpszAutoConfigUrl;
+ public LPWSTR lpszProxy;
+ public LPWSTR lpszProxyBypass;
+
+ public String getAutoConfigUrl() {
+ return lpszAutoConfigUrl == null ? null : lpszAutoConfigUrl.getValue();
+ }
+
+ public String getProxy() {
+ return lpszProxy == null ? null : lpszProxy.getValue();
+ }
+
+ public String getProxyBypass() {
+ return lpszProxyBypass == null ? null : lpszProxyBypass.getValue();
+ }
+
+ public void free() {
+ if (lpszAutoConfigUrl != null) {
+ Kernel32Util.freeGlobalMemory(lpszAutoConfigUrl.getPointer());
+ }
+ if (lpszProxy != null) {
+ Kernel32Util.freeGlobalMemory(lpszProxy.getPointer());
+ }
+ if (lpszProxyBypass != null) {
+ Kernel32Util.freeGlobalMemory(lpszProxyBypass.getPointer());
+ }
+ }
+ }
+ }
+
+ private static String formatMessage(int code) {
+ if (code >= WinHttp.ERROR_BASE && code <= WinHttp.ERROR_LAST) {
+ HMODULE hmodule = Kernel32.INSTANCE.GetModuleHandle(System.mapLibraryName(LIBRARY_NAME));
+
+ if (hmodule == null) {
+ return "Error code " + code + "; No error message due to failure of ´GetModuleHandle("
+ + System.mapLibraryName(LIBRARY_NAME) + ")´.";
+ } else {
+ PointerByReference msgBuf = new PointerByReference();
+ int size = Kernel32.INSTANCE.FormatMessage(
+ WinBase.FORMAT_MESSAGE_ALLOCATE_BUFFER | WinBase.FORMAT_MESSAGE_FROM_HMODULE
+ | WinBase.FORMAT_MESSAGE_IGNORE_INSERTS,
+ hmodule.getPointer(), code, WinNT.LANG_USER_DEFAULT, msgBuf, 0, null);
+ if (size == 0) {
+ return "Error code " + code + "; No error message due to error " + Native.getLastError();
+ }
+
+ Pointer ptr = msgBuf.getValue();
+ try {
+ String str = ptr.getWideString(0);
+ return str.trim();
+ } finally {
+ Kernel32Util.freeLocalMemory(ptr);
+ }
+ }
+ }
+
+ try {
+ return Kernel32Util.formatMessage(code);
+ } catch (LastErrorException e) {
+ return "Error code " + code + "; No error message due to error " + e.getErrorCode();
+ }
+ }
+
+}
diff --git a/bundles/org.eclipse.core.net/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.net/META-INF/MANIFEST.MF
index e53b3c4..df95f6f 100644
--- a/bundles/org.eclipse.core.net/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.core.net/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %PLUGIN_NAME
Bundle-SymbolicName: org.eclipse.core.net;singleton:=true
-Bundle-Version: 1.3.1100.qualifier
+Bundle-Version: 1.3.1200.qualifier
Bundle-Activator: org.eclipse.core.internal.net.Activator
Bundle-Vendor: %PLUGIN_PROVIDER
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.core.net/natives/win32/jWinHttp.cpp b/bundles/org.eclipse.core.net/natives/win32/jWinHttp.cpp
deleted file mode 100644
index 01f0420..0000000
--- a/bundles/org.eclipse.core.net/natives/win32/jWinHttp.cpp
+++ /dev/null
@@ -1,482 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 compeople AG and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * compeople AG (Stefan Liebig) - initial API and implementation
- *******************************************************************************/
-
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-
-#define WIN32_LEAN_AND_MEAN
-
-#include <stdio.h>
-#include <iostream>
-#include <windows.h>
-#include <winhttp.h>
-#include <objbase.h>
-
-#include "jWinHttp.h"
-
-using namespace std;
-
-// Remember the GetLastError() after a failed WinHttp... call.
-static int lastError;
-
-BOOL APIENTRY DllMain( HANDLE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved
- ) {
- switch (ul_reason_for_call) {
- case DLL_PROCESS_ATTACH:
- #ifdef _DEBUG
- cout << "DLL_PROCESS_ATTACH - jWinHttp" << endl;
- #endif
- break;
- case DLL_THREAD_ATTACH:
- #ifdef _DEBUG
- cout << "DLL_THREAD_ATTACH - jWinHttp" << endl;
- #endif
- break;
- case DLL_THREAD_DETACH:
- #ifdef _DEBUG
- cout << "DLL_THREAD_DETACH - jWinHttp" << endl;
- #endif
- break;
- case DLL_PROCESS_DETACH:
- #ifdef _DEBUG
- cout << "DLL_PROCESS_DETACH - jWinHttp" << endl;
- #endif
- break;
- }
- return TRUE;
-}
-
-
-/*
- * Helper for some ugly things!
- * ............................
- */
-
-const jchar * getStringChars( JNIEnv * env, jstring jString ) {
- if ( jString != NULL ) {
- return env->GetStringChars( jString, NULL );
- } else {
- return NULL;
- }
-}
-
-void releaseStringChars( JNIEnv * env, jstring jString, const jchar * jCharString ) {
- if ( jString != NULL ) {
- env->ReleaseStringChars( jString, jCharString );
- }
-}
-
-jobject newString( JNIEnv * env, LPWSTR string ) {
- return env->NewString( (const jchar *)string, lstrlenW( string ) );
-}
-
-void setStringField( JNIEnv * env, jclass jClass, jobject jObject, const char * field, LPWSTR value ) {
- if ( value != NULL ) {
- jfieldID jFieldId = env->GetFieldID( jClass, field, "Ljava/lang/String;" );
- env->SetObjectField( jObject, jFieldId, newString( env, value ) );
- GlobalFree( value );
- }
-}
-
-jstring getStringField( JNIEnv * env, jclass jClass, jobject jObject, const char * field ) {
- jfieldID jFieldId = env->GetFieldID( jClass, field, "Ljava/lang/String;" );
- return (jstring)env->GetObjectField( jObject, jFieldId );
-}
-
-void setBooleanField( JNIEnv * env, jclass jClass, jobject jObject, const char * field, BOOL value ) {
- jfieldID jFieldId = env->GetFieldID( jClass, field, "Z" );
- env->SetBooleanField( jObject, jFieldId, value );
-}
-
-jboolean getBooleanField( JNIEnv * env, jclass jClass, jobject jObject, const char * field ) {
- jfieldID jFieldId = env->GetFieldID( jClass, field, "Z" );
- return env->GetBooleanField( jObject, jFieldId );
-}
-
-void setIntField( JNIEnv * env, jclass jClass, jobject jObject, const char * field, jint value ) {
- jfieldID jFieldId = env->GetFieldID( jClass, field, "I" );
- env->SetIntField( jObject, jFieldId, value );
-}
-
-jint getIntField( JNIEnv * env, jclass jClass, jobject jObject, const char * field ) {
- jfieldID jFieldId = env->GetFieldID( jClass, field, "I" );
- return env->GetIntField( jObject, jFieldId );
-}
-
-#ifdef _DEBUG
- LPCWSTR null( const LPCWSTR string ) {
- if ( string == NULL ) {
- return (LPCWSTR) L"null";
- } else {
- return string;
- }
- }
-
- LPWSTR null( const LPWSTR string ) {
- if ( string == NULL ) {
- return (LPWSTR) L"null";
- } else {
- return string;
- }
- }
-#endif
-
-/*
- * The real ugly work goes on here!
- * ................................
- */
-
-
-/*
- * Class: org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp
- * Method: open
- * Signature: (Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp_open
- (JNIEnv * env, jclass jClass, jstring jUserAgent, jint jAccessType, jstring jProxyName, jstring jProxyBypass, jint jFlags ) {
-
- #ifdef _DEBUG
- cout << "WinHttp_open - entered" << endl;
- #endif
-
- const jchar * userAgent = (const jchar *) L"jWinHttp Java Wrapper";
- const jchar * proxyName = NULL;
- const jchar * proxyBypass = NULL;
-
- userAgent = getStringChars( env, jUserAgent );
- proxyName = getStringChars( env, jProxyName );
- proxyBypass = getStringChars( env, jProxyBypass );
-
- CoInitialize( NULL ); // --> http://support.microsoft.com/?kbid=834742
-
- int hInternet = (int) WinHttpOpen( (LPCWSTR)userAgent, jAccessType, (LPCWSTR)proxyName, (LPCWSTR)proxyBypass, jFlags );
-
- if ( hInternet == NULL ) {
- lastError = GetLastError();
- #ifdef _DEBUG
- cout << "WinHttpOpen() failed with " << lastError << endl;
- #endif
- } else {
- lastError = 0;
- }
-
-
- #ifdef _DEBUG
- cout << "WinHttpOpen() returned: " << hInternet << endl;
- #endif
-
-
- releaseStringChars( env, jUserAgent, userAgent );
- releaseStringChars( env, jProxyName, proxyName );
- releaseStringChars( env, jProxyBypass, proxyBypass );
-
- #ifdef _DEBUG
- cout << "WinHttp_open - exit" << endl;
- #endif
-
- return hInternet;
-}
-
-/*
- * Class: org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp
- * Method: closeHandle
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp_closeHandle
- (JNIEnv * env, jclass jClass, jint jInternet) {
-
- #ifdef _DEBUG
- cout << "WinHttp_closeHandle - entered" << endl;
- #endif
-
- BOOL ok = WinHttpCloseHandle( (void *) jInternet );
-
- if ( ! ok ) {
- lastError = GetLastError();
- #ifdef _DEBUG
- cout << "WinHttpClose() failed with " << lastError << endl;
- #endif
- } else {
- lastError = 0;
- }
-
- CoUninitialize();
-
- #ifdef _DEBUG
- cout << "WinHttp_closeHandle - exit" << endl;
- #endif
-
- return ok;
-}
-
-/*
- * Class: org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp
- * Method: getIEProxyConfigForCurrentUser
- * Signature: (Lorg/eclipse/core/internal/net/proxy/win32/winhttp/WinHttpCurrentUserIEProxyConfig;)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp_getIEProxyConfigForCurrentUser
- (JNIEnv * env, jclass jClass, jobject jWinHttpCurrentUserIEProxyConfig) {
-
- #ifdef _DEBUG
- cout << "WinHttp_getIEProxyConfigForCurrentUser - entered" << endl;
- #endif
-
- WINHTTP_CURRENT_USER_IE_PROXY_CONFIG proxyConfig;
- ZeroMemory( &proxyConfig, sizeof( proxyConfig ) );
-
- BOOL ok = WinHttpGetIEProxyConfigForCurrentUser( &proxyConfig );
-
- if ( ! ok ) {
- lastError = GetLastError();
- #ifdef _DEBUG
- cout << "HttpGetIEProxyConfigForCurrentUser() failed with " << lastError << endl;
- #endif
- }
-
- if ( ok ) {
-
- #ifdef _DEBUG
- cout << "proxyConfig.fAutoDetect: " << proxyConfig.fAutoDetect << endl;
- wcout << L"proxyConfig.lpszProxy: " << null( proxyConfig.lpszProxy ) << endl;
- wcout << L"proxyConfig.lpszProxyBypass: " << null( proxyConfig.lpszProxyBypass ) << endl;
- #endif
-
- lastError = 0;
- jclass jWinHttpCurrentUserIEProxyConfigClass = env->GetObjectClass( jWinHttpCurrentUserIEProxyConfig );
- setBooleanField( env,jWinHttpCurrentUserIEProxyConfigClass, jWinHttpCurrentUserIEProxyConfig, "isAutoDetect", proxyConfig.fAutoDetect );
- setStringField( env, jWinHttpCurrentUserIEProxyConfigClass, jWinHttpCurrentUserIEProxyConfig, "autoConfigUrl", proxyConfig.lpszAutoConfigUrl );
- setStringField( env, jWinHttpCurrentUserIEProxyConfigClass, jWinHttpCurrentUserIEProxyConfig, "proxy", proxyConfig.lpszProxy );
- setStringField( env, jWinHttpCurrentUserIEProxyConfigClass, jWinHttpCurrentUserIEProxyConfig, "proxyBypass", proxyConfig.lpszProxyBypass );
- }
-
-
- #ifdef _DEBUG
- cout << "WinHttp_getIEProxyConfigForCurrentUser - exit" << endl;
- #endif
-
- return ok;
-}
-
-/*
- * Class: org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp
- * Method: getProxyForUrl
- * Signature: (ILjava/lang/String;Lorg/eclipse/core/internal/net/proxy/win32/winhttp/WinHttpAutoProxyOptions;Lorg/eclipse/core/internal/net/proxy/win32/winhttp/WinHttpProxyInfo;)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp_getProxyForUrl
- (JNIEnv * env, jclass jClass, jint jInternet, jstring jUrl, jobject jWinHttpAutoProxyOptions, jobject jWinHttpProxyInfo ) {
-
- #ifdef _DEBUG
- cout << "WinHttp_getProxyForUrl - entered" << endl;
- #endif
-
- WINHTTP_AUTOPROXY_OPTIONS autoProxyOptions;
- ZeroMemory( &autoProxyOptions, sizeof( autoProxyOptions ) );
-
- jclass jWinHttpAutoProxyOptionsClass = env->GetObjectClass( jWinHttpAutoProxyOptions );
-
- autoProxyOptions.dwFlags = getIntField( env, jWinHttpAutoProxyOptionsClass, jWinHttpAutoProxyOptions, "flags" );
- autoProxyOptions.dwAutoDetectFlags = getIntField( env, jWinHttpAutoProxyOptionsClass, jWinHttpAutoProxyOptions, "autoDetectFlags" );
- jstring jAutoConfigUrl = getStringField( env, jWinHttpAutoProxyOptionsClass, jWinHttpAutoProxyOptions, "autoConfigUrl" );
- autoProxyOptions.lpszAutoConfigUrl = (LPCWSTR)getStringChars( env, jAutoConfigUrl );
-
- // The ´reserved´ fields will not be transfered!
- // - String reservedPointer
- // - int reservedInt
-
- autoProxyOptions.fAutoLogonIfChallenged = getBooleanField( env, jWinHttpAutoProxyOptionsClass, jWinHttpAutoProxyOptions, "autoLogonIfChallenged" );
-
- #ifdef _DEBUG
- cout << "autoProxyOptions.dwFlags: " << autoProxyOptions.dwFlags << endl;
- cout << "autoProxyOptions.dwAutoDetectFlags: " << autoProxyOptions.dwAutoDetectFlags << endl;
- wcout << L"autoProxyOptions.lpszAutoConfigUrl: " << null( autoProxyOptions.lpszAutoConfigUrl ) << endl;
- cout << "autoProxyOptions.fAutoLogonIfChallenged: " << autoProxyOptions.fAutoLogonIfChallenged << endl;
- #endif
-
- WINHTTP_PROXY_INFO proxyInfo;
- ZeroMemory( &proxyInfo, sizeof( proxyInfo ) );
-
- const jchar * url = getStringChars( env, jUrl );
-
- BOOL ok = WinHttpGetProxyForUrl( (void *)jInternet, (LPCWSTR)url, &autoProxyOptions, &proxyInfo );
-
- if ( ! ok ) {
- lastError = GetLastError();
- #ifdef _DEBUG
- cout << "WinHttpGetProxyForUrl() failed with " << lastError << endl;
- #endif
- }
-
- releaseStringChars( env, jUrl, url );
- releaseStringChars( env, jAutoConfigUrl, (const jchar *)autoProxyOptions.lpszAutoConfigUrl );
-
- if ( ok ) {
- lastError = 0;
- jclass jWinHttpProxyInfoClass = env->GetObjectClass( jWinHttpProxyInfo );
-
- #ifdef _DEBUG
- cout << "proxyInfo.dwAccessType: " << proxyInfo.dwAccessType << endl;
- wcout << L"proxyInfo.lpszProxy: " << null( proxyInfo.lpszProxy ) << endl;
- wcout << L"proxyInfo.lpszProxyBypass: " << null( proxyInfo.lpszProxyBypass ) << endl;
- #endif
-
- setIntField( env, jWinHttpProxyInfoClass, jWinHttpProxyInfo, "accessType", proxyInfo.dwAccessType );
- setStringField( env, jWinHttpProxyInfoClass, jWinHttpProxyInfo, "proxy", proxyInfo.lpszProxy );
- setStringField( env, jWinHttpProxyInfoClass, jWinHttpProxyInfo, "proxyBypass", proxyInfo.lpszProxyBypass );
- }
-
- #ifdef _DEBUG
- cout << "WinHttp_getProxyForUrl - exit" << endl;
- #endif
-
- return ok;
-}
-
-/*
- * Class: org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp
- * Method: detectAutoProxyConfigUrl
- * Signature: (Lorg/eclipse/core/internal/net/proxy/win32/winhttp/AutoProxyHolder;)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp_detectAutoProxyConfigUrl
- (JNIEnv * env, jclass jClass, jobject jAutoProxyHolder) {
-
- #ifdef _DEBUG
- cout << "WinHttp_detectAutoProxyConfigUrl - entered" << endl;
- #endif
-
- jclass jAutoProxyHolderClass = env->GetObjectClass( jAutoProxyHolder );
- DWORD dwAutoDetectFlags = getIntField( env, jAutoProxyHolderClass, jAutoProxyHolder, "autoDetectFlags" );
-
- #ifdef _DEBUG
- cout << "autoProxyHolder.autoDetectFlags: " << dwAutoDetectFlags << endl;
- #endif
-
- LPWSTR pwszAutoConfigUrl;
-
- BOOL ok = WinHttpDetectAutoProxyConfigUrl( dwAutoDetectFlags, &pwszAutoConfigUrl );
-
- if ( ! ok ) {
- lastError = GetLastError();
- #ifdef _DEBUG
- cout << "WinHttpDetectAutoProxyConfigUrl() failed with " << lastError << endl;
- #endif
- }
-
- if ( ok ) {
- lastError = 0;
-
- #ifdef _DEBUG
- wcout << L"autoConfigUrl: " << null( pwszAutoConfigUrl ) << endl;
- #endif
-
- setStringField( env, jAutoProxyHolderClass, jAutoProxyHolder, "autoConfigUrl", pwszAutoConfigUrl );
- }
-
- #ifdef _DEBUG
- cout << "WinHttp_detectAutoProxyConfigUrl - exit" << endl;
- #endif
-
- return ok;
-}
-
-
-/*
- * Class: org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp
- * Method: getLastError
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp_getLastError
- (JNIEnv * env, jclass jClass) {
-
- #ifdef _DEBUG
- cout << "WinHttp_getLastError - entered" << endl;
- #endif
-
- #ifdef _DEBUG
- cout << "WinHttp_getLastError - exit" << endl;
- #endif
-
- return lastError;
-}
-
-/*
- * Class: org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp
- * Method: getLastErrorMessage
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp_getLastErrorMessage
- (JNIEnv * env, jclass jClass) {
-
- #ifdef _DEBUG
- cout << "WinHttp_getLastErrorMessage - entered" << endl;
- #endif
-
- LPVOID lpMsgBuf = NULL;
- DWORD result = 0;
-
- if ( lastError >= WINHTTP_ERROR_BASE && lastError <= WINHTTP_ERROR_LAST ) {
- HMODULE hModule = GetModuleHandle( "winhttp.dll" );
-
- if ( hModule == NULL ) {
- lpMsgBuf = "Could not retrieve error message, because ´GetModuleHandle( \"winhttp.dll\" )´ failed.";
- } else {
- result = FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_HMODULE |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- hModule,
- lastError,
- MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), // Default language
- (LPTSTR) &lpMsgBuf,
- 0,
- NULL );
- }
-
- } else {
- result = FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- lastError,
- MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), // Default language
- (LPTSTR) &lpMsgBuf,
- 0,
- NULL );
- }
-
- if ( lpMsgBuf == NULL ) {
- #ifdef _DEBUG
- cout << "WinHttp_getLastErrorMessage() failed with " << GetLastError() << " for error code " << lastError << endl;
- #endif
-
- lpMsgBuf = "Could not retrieve error message.";
- }
-
- jstring string = env->NewStringUTF( (char *) lpMsgBuf );
-
- if ( result > 0 ) {
- // Free dynamically allocated buffer
- LocalFree( lpMsgBuf );
- }
-
- #ifdef _DEBUG
- cout << "WinHttp_getLastErrorMessage - exit" << endl;
- #endif
-
- return string;
-}
-
diff --git a/bundles/org.eclipse.core.net/natives/win32/jWinHttp.h b/bundles/org.eclipse.core.net/natives/win32/jWinHttp.h
deleted file mode 100644
index 5acba84..0000000
--- a/bundles/org.eclipse.core.net/natives/win32/jWinHttp.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp */
-
-#ifndef _Included_org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp
-#define _Included_org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- * Class: org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp
- * Method: open
- * Signature: (Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp_open
- (JNIEnv *, jclass, jstring, jint, jstring, jstring, jint);
-
-/*
- * Class: org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp
- * Method: closeHandle
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp_closeHandle
- (JNIEnv *, jclass, jint);
-
-/*
- * Class: org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp
- * Method: getIEProxyConfigForCurrentUser
- * Signature: (Lorg/eclipse/core/internal/net/proxy/win32/winhttp/WinHttpCurrentUserIEProxyConfig;)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp_getIEProxyConfigForCurrentUser
- (JNIEnv *, jclass, jobject);
-
-/*
- * Class: org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp
- * Method: getProxyForUrl
- * Signature: (ILjava/lang/String;Lorg/eclipse/core/internal/net/proxy/win32/winhttp/WinHttpAutoProxyOptions;Lorg/eclipse/core/internal/net/proxy/win32/winhttp/WinHttpProxyInfo;)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp_getProxyForUrl
- (JNIEnv *, jclass, jint, jstring, jobject, jobject);
-
-/*
- * Class: org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp
- * Method: detectAutoProxyConfigUrl
- * Signature: (Lorg/eclipse/core/internal/net/proxy/win32/winhttp/AutoProxyHolder;)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp_detectAutoProxyConfigUrl
- (JNIEnv *, jclass, jobject);
-
-/*
- * Class: org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp
- * Method: getLastError
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp_getLastError
- (JNIEnv *, jclass);
-
-/*
- * Class: org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp
- * Method: getLastErrorMessage
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_org_eclipse_core_internal_net_proxy_win32_winhttp_WinHttp_getLastErrorMessage
- (JNIEnv *, jclass);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/bundles/org.eclipse.core.net/natives/win32/x86/jWinHttp.vcproj b/bundles/org.eclipse.core.net/natives/win32/x86/jWinHttp.vcproj
deleted file mode 100644
index 3ed7f71..0000000
--- a/bundles/org.eclipse.core.net/natives/win32/x86/jWinHttp.vcproj
+++ /dev/null
@@ -1,234 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9,00"
- Name="jWinHttp"
- ProjectGUID="{463DB2C1-6B11-4DC9-A29D-E3AD15E5FAD1}"
- TargetFrameworkVersion="0"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory=".\Debug"
- IntermediateDirectory=".\Debug"
- ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="_DEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="1"
- TypeLibraryName=".\Debug/jWinHttp.tlb"
- HeaderFileName=""
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""C:\Program Files\Java\jdk1.6.0_10\include\win32";"C:\Program Files\Java\jdk1.6.0_10\include\";include"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;WINHTTP_EXPORTS"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- UsePrecompiledHeader="0"
- AssemblerListingLocation=".\Debug/"
- ObjectFile=".\Debug/"
- ProgramDataBaseFileName=".\Debug/"
- BrowseInformation="1"
- WarningLevel="3"
- SuppressStartupBanner="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
- Culture="1031"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="odbc32.lib odbccp32.lib winhttp.lib"
- OutputFile=".\Debug/jWinHttp-1.0.0.dll"
- LinkIncremental="2"
- SuppressStartupBanner="true"
- GenerateDebugInformation="true"
- ProgramDatabaseFile=".\Debug/jWinHttp.pdb"
- ImportLibrary=".\Debug/jWinHttp.lib"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- SuppressStartupBanner="true"
- OutputFile=".\Debug/jWinHttp.bsc"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory=".\Release"
- IntermediateDirectory=".\Release"
- ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="1"
- TypeLibraryName=".\Release/jWinHttp.tlb"
- HeaderFileName=""
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories=""C:\Program Files\Java\jdk1.6.0_10\include\win32";"C:\Program Files\Java\jdk1.6.0_10\include\";include"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;WINHTTP_EXPORTS"
- StringPooling="true"
- RuntimeLibrary="0"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- AssemblerListingLocation=".\Release/"
- ObjectFile=".\Release/"
- ProgramDataBaseFileName=".\Release/"
- WarningLevel="3"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="1031"
- AdditionalIncludeDirectories="include"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="winhttp.lib"
- OutputFile=".\Release/jWinHttp-1.0.0.dll"
- LinkIncremental="1"
- SuppressStartupBanner="true"
- ProgramDatabaseFile=".\Release/jWinHttp.pdb"
- ImportLibrary=".\Release/jWinHttp.lib"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- SuppressStartupBanner="true"
- OutputFile=".\Release/jWinHttp.bsc"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Quellcodedateien"
- Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
- >
- <File
- RelativePath="..\jWinHttp.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header-Dateien"
- Filter="h;hpp;hxx;hm;inl"
- >
- <File
- RelativePath="..\jWinHttp.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Ressourcendateien"
- Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/bundles/org.eclipse.core.net/natives/win32/x86_64/jWinHttp.vcproj b/bundles/org.eclipse.core.net/natives/win32/x86_64/jWinHttp.vcproj
deleted file mode 100644
index 8525b08..0000000
--- a/bundles/org.eclipse.core.net/natives/win32/x86_64/jWinHttp.vcproj
+++ /dev/null
@@ -1,424 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9,00"
- Name="jWinHttp"
- ProjectGUID="{463DB2C1-6B11-4DC9-A29D-E3AD15E5FAD1}"
- TargetFrameworkVersion="0"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory=".\Debug"
- IntermediateDirectory=".\Debug"
- ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="_DEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="1"
- TypeLibraryName=".\Debug/jWinHttp.tlb"
- HeaderFileName=""
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""C:\Program Files\Java\jdk1.6.0_10\include\win32";"C:\Program Files\Java\jdk1.6.0_10\include\";include"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;WINHTTP_EXPORTS"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- UsePrecompiledHeader="0"
- AssemblerListingLocation=".\Debug/"
- ObjectFile=".\Debug/"
- ProgramDataBaseFileName=".\Debug/"
- BrowseInformation="1"
- WarningLevel="3"
- SuppressStartupBanner="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
- Culture="1031"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="odbc32.lib odbccp32.lib winhttp.lib"
- OutputFile=".\Debug/jWinHttp-1.0.0.dll"
- LinkIncremental="2"
- SuppressStartupBanner="true"
- GenerateDebugInformation="true"
- ProgramDatabaseFile=".\Debug/jWinHttp.pdb"
- ImportLibrary=".\Debug/jWinHttp.lib"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- SuppressStartupBanner="true"
- OutputFile=".\Debug/jWinHttp.bsc"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory=".\Release"
- IntermediateDirectory=".\Release"
- ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="1"
- TypeLibraryName=".\Release/jWinHttp.tlb"
- HeaderFileName=""
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories=""C:\Program Files\Java\jdk1.6.0_10\include\win32";"C:\Program Files\Java\jdk1.6.0_10\include\";include"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;WINHTTP_EXPORTS"
- StringPooling="true"
- RuntimeLibrary="0"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- AssemblerListingLocation=".\Release/"
- ObjectFile=".\Release/"
- ProgramDataBaseFileName=".\Release/"
- WarningLevel="3"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="1031"
- AdditionalIncludeDirectories="include"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="winhttp.lib"
- OutputFile=".\Release/jWinHttp-1.0.0.dll"
- LinkIncremental="1"
- SuppressStartupBanner="true"
- ProgramDatabaseFile=".\Release/jWinHttp.pdb"
- ImportLibrary=".\Release/jWinHttp.lib"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- SuppressStartupBanner="true"
- OutputFile=".\Release/jWinHttp.bsc"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(PlatformName)\$(ConfigurationName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="_DEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="3"
- TypeLibraryName=".\Debug/jWinHttp.tlb"
- HeaderFileName=""
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""C:\Program Files\Java\jdk1.6.0_10\include\win32";"C:\Program Files\Java\jdk1.6.0_10\include\";include"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;WINHTTP_EXPORTS"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- UsePrecompiledHeader="0"
- AssemblerListingLocation=".\Debug/"
- ObjectFile=".\Debug/"
- ProgramDataBaseFileName=".\Debug/"
- BrowseInformation="1"
- WarningLevel="3"
- SuppressStartupBanner="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
- Culture="1031"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="odbc32.lib odbccp32.lib winhttp.lib"
- OutputFile=".\Debug/jWinHttp-1.0.0.dll"
- LinkIncremental="2"
- SuppressStartupBanner="true"
- GenerateDebugInformation="true"
- ProgramDatabaseFile=".\Debug/jWinHttp.pdb"
- ImportLibrary=".\Debug/jWinHttp.lib"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- SuppressStartupBanner="true"
- OutputFile=".\Debug/jWinHttp.bsc"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(PlatformName)\$(ConfigurationName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="3"
- TypeLibraryName=".\Release/jWinHttp.tlb"
- HeaderFileName=""
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories=""C:\Program Files\Java\jdk1.6.0_10\include\win32";"C:\Program Files\Java\jdk1.6.0_10\include\";include"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;WINHTTP_EXPORTS"
- StringPooling="true"
- RuntimeLibrary="0"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- AssemblerListingLocation=".\Release/"
- ObjectFile=".\Release/"
- ProgramDataBaseFileName=".\Release/"
- WarningLevel="3"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="1031"
- AdditionalIncludeDirectories="include"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="winhttp.lib"
- OutputFile=".\Release/jWinHttp-1.0.0.dll"
- LinkIncremental="1"
- SuppressStartupBanner="true"
- ProgramDatabaseFile=".\Release/jWinHttp.pdb"
- ImportLibrary=".\Release/jWinHttp.lib"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- SuppressStartupBanner="true"
- OutputFile=".\Release/jWinHttp.bsc"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Quellcodedateien"
- Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
- >
- <File
- RelativePath="..\jWinHttp.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header-Dateien"
- Filter="h;hpp;hxx;hm;inl"
- >
- <File
- RelativePath="..\jWinHttp.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Ressourcendateien"
- Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/bundles/org.eclipse.core.net/pom.xml b/bundles/org.eclipse.core.net/pom.xml
index 7f24122..1e296c2 100644
--- a/bundles/org.eclipse.core.net/pom.xml
+++ b/bundles/org.eclipse.core.net/pom.xml
@@ -19,6 +19,6 @@
</parent>
<groupId>org.eclipse.core</groupId>
<artifactId>org.eclipse.core.net</artifactId>
- <version>1.3.1100-SNAPSHOT</version>
+ <version>1.3.1200-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/WindowsProxyProvider.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/WindowsProxyProvider.java
deleted file mode 100644
index 06ffc0d..0000000
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/WindowsProxyProvider.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2017 compeople AG and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * compeople AG (Stefan Liebig) - initial API and implementation
- * IBM Corporation - implementation
- *******************************************************************************/
-package org.eclipse.core.internal.net;
-
-import java.net.URI;
-
-import org.eclipse.core.internal.net.proxy.win32.winhttp.WinHttpProxyProvider;
-import org.eclipse.core.net.proxy.IProxyData;
-
-public class WindowsProxyProvider extends AbstractProxyProvider {
-
- private static final String LIBRARY_NAME = "jWinHttp-1.0.0"; //$NON-NLS-1$
-
- private static boolean jWinHttpLoaded = false;
-
- static {
- try {
- System.loadLibrary(LIBRARY_NAME);
- if (Policy.DEBUG_SYSTEM_PROVIDERS)
- Policy.debug("Loaded " + LIBRARY_NAME + " library"); //$NON-NLS-1$ //$NON-NLS-2$
- jWinHttpLoaded = true;
- } catch (final UnsatisfiedLinkError e) {
- Activator.logError(
- "Could not load library: " + System.mapLibraryName(LIBRARY_NAME), e); //$NON-NLS-1$
- }
- }
-
- private WinHttpProxyProvider winHttpProxyProvider;
-
- public WindowsProxyProvider() {
- if (jWinHttpLoaded) {
- winHttpProxyProvider = new WinHttpProxyProvider();
- } else {
- winHttpProxyProvider = null;
- }
- }
-
- @Override
- public IProxyData[] select(URI uri) {
- IProxyData[] proxies = new IProxyData[0];
- if (jWinHttpLoaded) {
- proxies = winHttpProxyProvider.getProxyData(uri);
- }
- if (Policy.DEBUG) {
- Policy.debug("WindowsProxyProvider#select result for [" + uri + "]"); //$NON-NLS-1$ //$NON-NLS-2$
- for (IProxyData proxy : proxies) {
- System.out.println(" " + proxy); //$NON-NLS-1$
- }
- }
- return proxies;
- }
-
- @Override
- protected IProxyData[] getProxyData() {
- if (jWinHttpLoaded) {
- return winHttpProxyProvider.getProxyData();
- }
- return new IProxyData[0];
- }
-
- @Override
- protected String[] getNonProxiedHosts() {
- if (jWinHttpLoaded) {
- return winHttpProxyProvider.getNonProxiedHosts();
- }
- return new String[0];
- }
-
-}
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/AutoProxyHolder.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/AutoProxyHolder.java
deleted file mode 100644
index 143706b..0000000
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/AutoProxyHolder.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 compeople AG and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * compeople AG (Stefan Liebig) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.net.proxy.win32.winhttp;
-
-/**
- * This holder class just helps passing parameters into a native function and retrieve information
- * from it.
- * <p>
- * The fields will be written/read by the jni glue code.
- * </p>
- */
-public class AutoProxyHolder {
-
- public int autoDetectFlags;
-
- public String autoConfigUrl;
-
- /**
- * Set the auto detect flags.
- *
- * @param autoDetectFlags
- */
- public void setAutoDetectFlags(int autoDetectFlags) {
- this.autoDetectFlags= autoDetectFlags;
- }
-
- /**
- * Get the auto config url.
- *
- * @return the auto config url (pac file)
- */
- public String getAutoConfigUrl() {
- return autoConfigUrl;
- }
-
-}
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/WinHttp.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/WinHttp.java
deleted file mode 100644
index 8973fa3..0000000
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/WinHttp.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 compeople AG and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * compeople AG (Stefan Liebig) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.net.proxy.win32.winhttp;
-
-/**
- * This is the Win32 WinHttp wrapper.
- * <p>
- * Not complete, but offers what we currently need
- * </p>
- */
-public final class WinHttp {
-
- /**
- * The constant indicates the null proxy name parameter
- */
- static final String NO_PROXY_NAME= null;
-
- /**
- * The constant indicates the null proxy bypass parameter
- */
- static final String NO_PROXY_BYPASS= null;
-
- /**
- * WinHttpOpen - see Microsoft SDK Documentation
- *
- * @param userAgent
- * @param accessType
- * @param proxyName
- * @param proxyBypass
- * @param flags
- * @return the handle
- */
- public static native int open(String userAgent, int accessType, String proxyName, String proxyBypass, int flags);
-
- /**
- * WinHttpCloseHandle - see Microsoft SDK Documentation
- *
- * @param hInternet
- * @return true on success
- */
- public static native boolean closeHandle(int hInternet);
-
- /**
- * WinHttpGetIEProxyConfigForCurrentUser - see Microsoft SDK Documentation
- *
- * @param proxyConfig
- * @return true on success
- */
- public static native boolean getIEProxyConfigForCurrentUser(WinHttpCurrentUserIEProxyConfig proxyConfig);
-
- /**
- * WinHttpGetProxyForUrl - see Microsoft SDK Documentation
- *
- * @param hSession
- * @param url
- * @param autoProxyOptions
- * @param proxyInfo
- * @return true on success
- */
- public static native boolean getProxyForUrl(int hSession, String url, WinHttpAutoProxyOptions autoProxyOptions, WinHttpProxyInfo proxyInfo);
-
- /**
- * WinHttpDetectAutoProxyConfigUrl - see Microsoft SDK Documentation
- *
- * @param autoProxyHolder
- * @return true on success
- */
- public static native boolean detectAutoProxyConfigUrl(AutoProxyHolder autoProxyHolder);
-
- /**
- * GetLastError - see Microsoft SDK Documentation
- *
- * @return the last error code (win32)
- */
- public static native int getLastError();
-
- /**
- * GetLastErrorMessage - formats the last error
- *
- * @return the readable last error code
- */
- public static native String getLastErrorMessage();
-
-}
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/WinHttpAutoProxyOptions.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/WinHttpAutoProxyOptions.java
deleted file mode 100644
index b8d6473..0000000
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/WinHttpAutoProxyOptions.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 compeople AG and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * compeople AG (Stefan Liebig) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.net.proxy.win32.winhttp;
-
-/**
- * Wrapper for Win32 WINHTTP_AUTOPROXY_OPTIONS Structure.
- * <p>
- * The fields will be read by the jni glue code.
- * </p>
- */
-public class WinHttpAutoProxyOptions {
-
- // Flags for WINHTTP_AUTOPROXY_OPTIONS::dwFlags
- public static final int WINHTTP_AUTOPROXY_AUTO_DETECT= 0x00000001;
-
- public static final int WINHTTP_AUTOPROXY_CONFIG_URL= 0x00000002;
-
- public static final int WINHTTP_AUTOPROXY_RUN_INPROCESS= 0x00010000;
-
- public static final int WINHTTP_AUTOPROXY_RUN_OUTPROCESS_ONLY= 0x00020000;
-
- // Flags for WINHTTP_AUTOPROXY_OPTIONS::dwAutoDetectFlags
- public static final int WINHTTP_AUTO_DETECT_TYPE_DHCP= 0x00000001;
-
- public static final int WINHTTP_AUTO_DETECT_TYPE_DNS_A= 0x00000002;
-
- public int flags;
-
- public int autoDetectFlags;
-
- public String autoConfigUrl;
-
- public String reservedPointer;
-
- public int reservedInt;
-
- public boolean autoLogonIfChallenged;
-
- /**
- * @param autoConfigUrl the autoConfigUrl to set
- */
- public void setAutoConfigUrl(String autoConfigUrl) {
- this.autoConfigUrl= autoConfigUrl;
- }
-
- /**
- * @param autoDetectFlags the autoDetectFlags to set
- */
- public void setAutoDetectFlags(int autoDetectFlags) {
- this.autoDetectFlags= autoDetectFlags;
- }
-
- /**
- * @param autoLogonIfChallenged the autoLogonIfChallenged to set
- */
- public void setAutoLogonIfChallenged(boolean autoLogonIfChallenged) {
- this.autoLogonIfChallenged= autoLogonIfChallenged;
- }
-
- /**
- * @param flags the flags to set
- */
- public void setFlags(int flags) {
- this.flags= flags;
- }
-
-}
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/WinHttpCurrentUserIEProxyConfig.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/WinHttpCurrentUserIEProxyConfig.java
deleted file mode 100644
index ca63b2d..0000000
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/WinHttpCurrentUserIEProxyConfig.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 compeople AG and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * compeople AG (Stefan Liebig) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.net.proxy.win32.winhttp;
-
-import org.eclipse.core.internal.net.StringUtil;
-
-/**
- * Wrapper for Win32 WINHTTP_CURRENT_USER_IE_PROXY_CONFIG structure.<br>
- * Plus a few helper methods that enrich the plain C structure.
- * <p>
- * The fields will be written by the jni glue code.
- * </p>
- */
-public class WinHttpCurrentUserIEProxyConfig {
-
- public boolean isAutoDetect;
- public String autoConfigUrl;
- public String proxy;
- public String proxyBypass;
-
- /**
- * @return the autoConfigUrl
- */
- public String getAutoConfigUrl() {
- return autoConfigUrl;
- }
-
- /**
- * @return the proxy
- */
- public String getProxy() {
- return proxy;
- }
-
- /**
- * @return the proxyBypass
- */
- public String getProxyBypass() {
- return proxyBypass;
- }
-
- /**
- * I auto detection requested?
- *
- * @return the isAutoDetect
- */
- public boolean isAutoDetect() {
- return isAutoDetect;
- }
-
- /**
- * Is a auto config url reqested?
- *
- * @return true if there is a auto config url
- */
- public boolean isAutoConfigUrl() {
- return autoConfigUrl != null && autoConfigUrl.length() != 0;
- }
-
- /**
- * Are static proxies defined?
- *
- * @return the isStaticProxy
- */
- public boolean isStaticProxy() {
- return proxy != null && proxy.length() != 0;
- }
-
- /**
- * Did the auto-detect change?
- *
- * @param proxyConfig
- * the proxy config; maybe null
- * @return true if changed
- */
- public boolean autoDetectChanged(WinHttpCurrentUserIEProxyConfig proxyConfig) {
- if (proxyConfig == null)
- return true;
- return isAutoDetect != proxyConfig.isAutoDetect;
- }
-
- /**
- * Did the auto-config url change?
- *
- * @param proxyConfig
- * the proxy config; maybe null
- * @return true if changed
- */
- public boolean autoConfigUrlChanged(
- WinHttpCurrentUserIEProxyConfig proxyConfig) {
- if (proxyConfig == null)
- return true;
- return !StringUtil.equals(autoConfigUrl,
- proxyConfig.autoConfigUrl);
- }
-
- /**
- * Did the static proxy information change?
- *
- * @param proxyConfig
- * the proxy config; maybe null
- * @return true if changed
- */
- public boolean staticProxyChanged(
- WinHttpCurrentUserIEProxyConfig proxyConfig) {
- if (proxyConfig == null)
- return true;
- return !(StringUtil.equals(proxy, proxyConfig.proxy) && StringUtil
- .equals(proxyBypass, proxyConfig.proxyBypass));
- }
-
-}
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/WinHttpProxyInfo.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/WinHttpProxyInfo.java
deleted file mode 100644
index cbd632f..0000000
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/WinHttpProxyInfo.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 compeople AG and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * compeople AG (Stefan Liebig) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.net.proxy.win32.winhttp;
-
-/**
- * Wrapper for Win32 WINHTTP_PROXY_INFO Structure.
- * <p>
- * The fields will be written by the jni glue code.
- * </p>
- */
-public class WinHttpProxyInfo {
-
- // WinHttpOpen dwAccessType values (also for
- // WINHTTP_PROXY_INFO::dwAccessType)
- public static final int WINHTTP_ACCESS_TYPE_DEFAULT_PROXY= 0;
-
- public static final int WINHTTP_ACCESS_TYPE_NO_PROXY= 1;
-
- public static final int WINHTTP_ACCESS_TYPE_NAMED_PROXY= 3;
-
- public int accessType;
-
- public String proxy;
-
- public String proxyBypass;
-
- /**
- * @return the accessType
- */
- public int getAccessType() {
- return accessType;
- }
-
- /**
- * @return the proxy
- */
- public String getProxy() {
- return proxy;
- }
-
- /**
- * @return the proxyBypass
- */
- public String getProxyBypass() {
- return proxyBypass;
- }
-
-}
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/WinHttpProxyProvider.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/WinHttpProxyProvider.java
deleted file mode 100644
index cc8cd0e..0000000
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/WinHttpProxyProvider.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2017 compeople AG and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * compeople AG (Stefan Liebig) - initial API and implementation
- * IBM Corporation - Add proxy providers layer on the top of ProxyManager (bug 255616)
- *******************************************************************************/
-package org.eclipse.core.internal.net.proxy.win32.winhttp;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.internal.net.Activator;
-import org.eclipse.core.internal.net.ProxyData;
-import org.eclipse.core.net.proxy.IProxyData;
-
-/**
- * The <code>WinHttpProxyProvivider</code> gets its settings from the
- * "internet options >> connection settings". For this it uses the Windows
- * WinHttp API.
- *
- * @see "http://msdn2.microsoft.com/en-us/library/aa382925(VS.85).aspx"
- */
-public class WinHttpProxyProvider {
-
- private WinHttpCurrentUserIEProxyConfig proxyConfig;
- private StaticProxyConfig staticProxyConfig;
- private String wpadAutoConfigUrl;
- private boolean tryWpadGetUrl;
- private boolean tryPac;
-
- // Buffered delayed logging to avoid deadlocks. Logging itself might trigger
- // through listeners/appenders other threads to do some communication which in
- // turn uses this proxy provider.
- private String logMessage;
- private Throwable logThrowable;
-
- private static final ProxyData[] EMPTY_PROXIES = new ProxyData[0];
- private static final String MY_NAME = WinHttpProxyProvider.class.getName();
-
- /**
- * Retrieve the proxies that are suitable for the given uri. An empty array
- * of proxies indicates that no proxy should be used (direct connection).
- * This method considers already the �no proxy for� definition of the
- * internet options dialog.
- *
- * @param uri
- * @return an array of proxies
- */
- public IProxyData[] getProxyData(URI uri) {
- logMessage = null;
- IProxyData[] proxies;
- synchronized (this) {
- proxies = getProxyDataUnsynchronized(uri);
- }
- if (logMessage != null)
- Activator.logError(logMessage, logThrowable);
- return proxies;
- }
-
- public IProxyData[] getProxyData() {
- logMessage = null;
- IProxyData[] proxies;
- synchronized (this) {
- proxies = getProxyDataUnsynchronized();
- }
- if (logMessage != null)
- Activator.logError(logMessage, logThrowable);
- return proxies;
- }
-
- private IProxyData[] getProxyDataUnsynchronized() {
- WinHttpCurrentUserIEProxyConfig newProxyConfig = new WinHttpCurrentUserIEProxyConfig();
- if (!WinHttp.getIEProxyConfigForCurrentUser(newProxyConfig)) {
- logError(
- "WinHttp.GetIEProxyConfigForCurrentUser failed with error '" + WinHttp.getLastErrorMessage() + "' #" + WinHttp.getLastError() + ".", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- return EMPTY_PROXIES;
- }
-
- // Explicit proxies defined?
- if (newProxyConfig.isStaticProxy()) {
- // Yes, let�s see if we are still up-to-date
- if (newProxyConfig.staticProxyChanged(proxyConfig))
- staticProxyConfig = new StaticProxyConfig(newProxyConfig
- .getProxy(), newProxyConfig.getProxyBypass());
-
- return staticProxyConfig.getProxyData();
- }
-
- // Let�s find out if auto detect has changed.
- if (newProxyConfig.autoDetectChanged(proxyConfig)) {
- tryWpadGetUrl = newProxyConfig.isAutoDetect();
- if (!tryWpadGetUrl)
- wpadAutoConfigUrl = null;
- }
-
- // Let�s find out if pac file url has changed.
- if (newProxyConfig.autoConfigUrlChanged(proxyConfig))
- tryPac = newProxyConfig.isAutoConfigUrl();
-
- if (!tryPac && wpadAutoConfigUrl == null)
- return new IProxyData[0];
-
- ProxyData data = new ProxyData(IProxyData.HTTP_PROXY_TYPE, "", -1, //$NON-NLS-1$
- false, "WINDOWS_IE"); //$NON-NLS-1$
- data.setDynamic(true);
- return new IProxyData[] { data };
- }
-
- public String[] getNonProxiedHosts() {
- logMessage = null;
- String[] hosts;
- synchronized (this) {
- hosts = getNonProxiedHostsUnsynchronized();
- }
- if (logMessage != null)
- Activator.logError(logMessage, logThrowable);
- return hosts;
- }
-
- private String[] getNonProxiedHostsUnsynchronized() {
- WinHttpCurrentUserIEProxyConfig newProxyConfig = new WinHttpCurrentUserIEProxyConfig();
- if (!WinHttp.getIEProxyConfigForCurrentUser(newProxyConfig)) {
- logError(
- "WinHttp.GetIEProxyConfigForCurrentUser failed with error '" + WinHttp.getLastErrorMessage() + "' #" + WinHttp.getLastError() + ".", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- return new String[0];
- }
- if (newProxyConfig.isStaticProxy()) {
- // Yes, let�s see if we are still up-to-date
- if (newProxyConfig.staticProxyChanged(proxyConfig))
- staticProxyConfig = new StaticProxyConfig(newProxyConfig
- .getProxy(), newProxyConfig.getProxyBypass());
- return staticProxyConfig.getNonProxiedHosts();
- }
- return null;
- }
-
- /**
- * This method is the not synchronized counterpart of
- * <code>getProxyData</code>.
- *
- * @param uri
- * @return an array of proxies
- */
- private IProxyData[] getProxyDataUnsynchronized(URI uri) {
- WinHttpCurrentUserIEProxyConfig newProxyConfig = new WinHttpCurrentUserIEProxyConfig();
- if (!WinHttp.getIEProxyConfigForCurrentUser(newProxyConfig)) {
- logError(
- "WinHttp.GetIEProxyConfigForCurrentUser failed with error '" + WinHttp.getLastErrorMessage() + "' #" + WinHttp.getLastError() + ".", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- return EMPTY_PROXIES;
- }
-
- List<IProxyData> proxies = new ArrayList<>();
-
- // Let�s find out if auto detect has changed.
- if (newProxyConfig.autoDetectChanged(proxyConfig)) {
- tryWpadGetUrl = newProxyConfig.isAutoDetect();
- if (!tryWpadGetUrl)
- wpadAutoConfigUrl = null;
- }
-
- // Let�s find out if pac file url has changed.
- if (newProxyConfig.autoConfigUrlChanged(proxyConfig))
- tryPac = newProxyConfig.isAutoConfigUrl();
-
- // Explicit proxies defined?
- if (newProxyConfig.isStaticProxy()) {
- // Yes, let�s see if we are still up-to-date
- if (newProxyConfig.staticProxyChanged(proxyConfig))
- staticProxyConfig = new StaticProxyConfig(newProxyConfig
- .getProxy(), newProxyConfig.getProxyBypass());
-
- staticProxyConfig.select(uri, proxies);
- }
- proxyConfig = newProxyConfig;
-
- if (!tryPac && wpadAutoConfigUrl == null)
- return toArray(proxies);
-
- // Create the WinHTTP session.
- int hHttpSession = WinHttp.open(MY_NAME,
- WinHttpProxyInfo.WINHTTP_ACCESS_TYPE_NO_PROXY,
- WinHttp.NO_PROXY_NAME, WinHttp.NO_PROXY_BYPASS, 0);
- if (hHttpSession == 0) {
- logError(
- "WinHttp.Open failed with error'" + WinHttp.getLastErrorMessage() + "' #" + WinHttp.getLastError() + ".", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- return toArray(proxies);
- }
-
- try {
- pacSelect(hHttpSession, uri, proxies);
- wpadSelect(hHttpSession, uri, proxies);
- } finally {
- WinHttp.closeHandle(hHttpSession);
- }
-
- return toArray(proxies);
- }
-
- protected void pacSelect(int hHttpSession, URI uri, List<IProxyData> proxies) {
- if (!tryPac)
- return;
- List<IProxyData> pacProxies = pacSelect(hHttpSession, proxyConfig
- .getAutoConfigUrl(), uri);
- if (pacProxies == null)
- tryPac = false;
- else
- proxies.addAll(pacProxies);
-
- }
-
- protected void wpadSelect(int hHttpSession, URI uri, List<IProxyData> proxies) {
- if (tryWpadGetUrl) {
- tryWpadGetUrl = false;
- AutoProxyHolder autoProxyHolder = new AutoProxyHolder();
- autoProxyHolder
- .setAutoDetectFlags(WinHttpAutoProxyOptions.WINHTTP_AUTO_DETECT_TYPE_DHCP
- | WinHttpAutoProxyOptions.WINHTTP_AUTO_DETECT_TYPE_DNS_A);
- boolean ok = WinHttp.detectAutoProxyConfigUrl(autoProxyHolder);
- if (!ok) {
- logError(
- "WinHttp.DetectAutoProxyConfigUrl for wpad failed with error '" + WinHttp.getLastErrorMessage() + "' #" + WinHttp.getLastError() + ".", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- return;
- }
- wpadAutoConfigUrl = autoProxyHolder.getAutoConfigUrl();
- }
- if (wpadAutoConfigUrl == null)
- return;
- List<IProxyData> wpadProxies = pacSelect(hHttpSession, wpadAutoConfigUrl, uri);
- if (wpadProxies == null)
- wpadAutoConfigUrl = null;
- else
- proxies.addAll(wpadProxies);
- }
-
- /**
- * Retrieve the proxies from the specified pac file url.
- *
- * @param hHttpSession
- * @param configUrl
- * @param uri
- * @return a list of proxies (IProxyData) or null in case of an error.
- */
- protected List<IProxyData> pacSelect(int hHttpSession, String configUrl, URI uri) {
- // Don�t ask for anything else than http or https since that is not
- // supported by WinHttp pac file support:
- // ERROR_WINHTTP_UNRECOGNIZED_SCHEME
- if (!IProxyData.HTTP_PROXY_TYPE.equalsIgnoreCase(uri.getScheme())
- && !IProxyData.HTTPS_PROXY_TYPE.equalsIgnoreCase(uri
- .getScheme()))
- return Collections.emptyList();
- // Set up the autoproxy call.
- WinHttpAutoProxyOptions autoProxyOptions = new WinHttpAutoProxyOptions();
- autoProxyOptions
- .setFlags(WinHttpAutoProxyOptions.WINHTTP_AUTOPROXY_CONFIG_URL);
- autoProxyOptions.setAutoConfigUrl(configUrl);
- autoProxyOptions.setAutoLogonIfChallenged(true);
- WinHttpProxyInfo proxyInfo = new WinHttpProxyInfo();
-
- boolean ok = WinHttp.getProxyForUrl(hHttpSession, uri.toString(),
- autoProxyOptions, proxyInfo);
- if (!ok) {
- logError(
- "WinHttp.GetProxyForUrl for pac failed with error '" + WinHttp.getLastErrorMessage() + "' #" + WinHttp.getLastError() + ".", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- return null;
- }
- ProxyBypass proxyBypass = new ProxyBypass(proxyInfo.getProxyBypass());
- if (proxyBypass.bypassProxyFor(uri))
- return Collections.emptyList();
- return ProxyProviderUtil.getProxies(proxyInfo.getProxy());
- }
-
- private void logError(String message, Throwable throwable) {
- this.logMessage = message;
- this.logThrowable = throwable;
- }
-
- private static IProxyData[] toArray(List<IProxyData> proxies) {
- return proxies.toArray(new IProxyData[proxies.size()]);
- }
-
-}
diff --git a/pom.xml b/pom.xml
index 329a126..ac28736 100644
--- a/pom.xml
+++ b/pom.xml
@@ -68,6 +68,7 @@
<!-- fragments -->
<module>bundles/org.eclipse.core.net.linux</module>
+ <module>bundles/org.eclipse.core.net.win32</module>
<module>bundles/org.eclipse.core.net.win32.x86_64</module>
<module>tests</module>