Feature #1224

Feature #1022: RCP: X.X, proxy settings in TXM and its components

RCP: X.X, Mac OS X proxy default configuration

Ajouté par Matthieu Decorde il y a environ 4 ans. Mis à jour il y a 8 mois.

Statut:In Progress Début:08/01/2015
Priorité:Normal Echéance:
Assigné à:- % réalisé:

0%

Catégorie:Network Temps passé: -
Version cible:TXM 0.8.0

Description

There is no Eclipse plugin to manage system proxy configuration for Mac OS X (contrary to Linux and Windows).

We need to manage system proxy.

Solution 1

During the ApplicationWorkbenchAdvisor post startup, set ProxyService to "system".

Validation test

The fix does not works.

Solution 2

Set the ProxyService to "direct" and set server configuration using the OS proxy configuration (with java.net.ProxySelector).
The same method is use for R packages installation during the Mac OS X TXM installation. See #1116.

For TXM, the ProxyService is activated in the Application.activateProxyService() method during the first moments of TXM lifecycle in the run() method.

Historique

#1 Mis à jour par Matthieu Decorde il y a presque 5 ans

  • Tâche parente mis à #1022

#2 Mis à jour par Serge Heiden il y a presque 4 ans

  • Description mis à jour (diff)

#3 Mis à jour par Matthieu Decorde il y a presque 4 ans

  • Description mis à jour (diff)

#4 Mis à jour par Sebastien Jacquot il y a presque 4 ans

Any feedback for this issue ? is the solution 2 has been implemented ?

#5 Mis à jour par Sebastien Jacquot il y a presque 4 ans

  • Statut changé de New à Feedback

#6 Mis à jour par Sebastien Jacquot il y a plus de 3 ans

  • Statut changé de Feedback à In Progress

To set the Provider as "Manual" we can use:

IProxyService proxyService = (IProxyService)proxyTracker.getService();
proxyService.setProxiesEnabled(true);

I tried this in org.txm.utils.ProxyConf.ProxyConf(Object) and it well changes the provider from "Direct" to "Manual".
The potential problem is that it appears there are some HTTP connection tries BEFORE the call of org.txm.utils.ProxyConf.ProxyConf(Object).
Since we do not fetch the update at TXM first run it may finally doesn't be a problem. We could may call proxyService.setProxiesEnabled(true); only once at first run.
When TXM will quit, the configuration will be saved to org.eclipse.core.net.prefs therefore during next launches these preferences should be reloaded from this file.

proxyService.hasSystemProxies() seems to always return false on Mac OS X (maybe because there is no native implementation of org.eclipse.core.net for Mac OS X).

#7 Mis à jour par Sebastien Jacquot il y a plus de 3 ans

I propose this fix in org.txm.rcpapplication.Application.activateProxyService():

            // force active provider as "Manual" on Mac OS X
            if (Util.isMac() && System.getProperty("http.proxyHost") != null && ApplicationWorkbenchAdvisor.getWasFirstLaunch()) { 
                System.out.println("System proxy detected. Force network provider as manual.");
                proxyService.setProxiesEnabled(true); 

IMPORTANT NOTE: Log.info() etc. does NOT work at this level of starting. Therefore a lot of log messages may be skipped during start-up.

Matt, could you check that ApplicationWorkbenchAdvisor.getWasFirstLaunch() is well defined/filled at this starting step?

The purpose here is to force manual provider if a proxy system has been detected but only at first run. Then when user quits TXM the preference is saved.

#8 Mis à jour par Matthieu Decorde il y a plus de 3 ans

I used the "firstLaunchAfterInstallation" method which check if the TXM_HOME preference is set. Tested on Linux with Eclipse.

#9 Mis à jour par Sebastien Jacquot il y a plus de 3 ans

System.getProperty("http.proxyHost") returns null on Mac at this step of starting if we haven't call proxyService.setProxiesEnabled(true); before...
Maybe org.eclipse.core.net overrides these settings by loading the org.eclipse.core.net.prefs file.

#10 Mis à jour par Sebastien Jacquot il y a plus de 3 ans

I think calling the IProxyService activates it leading to a clearing of the Java proxy system properties, here is a test:

// Display the proxy host
System.err.println(System.getProperty("http.proxyHost"));

Bundle bundle = Platform.getBundle("org.eclipse.ui.ide"); //$NON-NLS-1$
IProxyService  proxyService = null;
if (bundle != null) {
    ServiceReference ref = bundle.getBundleContext().getServiceReference(IProxyService.class.getName());
    if (ref != null)
        proxyService = bundle.getBundleContext().getService(ref);
    }
}

// return null
System.err.println(System.getProperty("http.proxyHost"));

#11 Mis à jour par Sebastien Jacquot il y a plus de 3 ans

Mail FR: Pour info/trace.
proxyService.setProxiesEnabled(true);
passe bien le provider en manual sous Mac mais uniquement si on a déjà fait la manip suivante au moins une fois dans l'interface des prefs.
- passer en manual
- sauver
- passer en direct
- sauver
- redémarrer TXM avec le fix et ça store bien le "Manual"
Je pense que c'est lié à la gestion des prefs dans org.eclipse.core.net

#12 Mis à jour par Sebastien Jacquot il y a presque 3 ans

  • Version cible changé de TXM 0.7.7 à TXM 0.8.0a (split/restructuration)

#13 Mis à jour par Sebastien Jacquot il y a 8 mois

  • Version cible changé de TXM 0.8.0a (split/restructuration) à TXM 0.8.0

Formats disponibles : Atom PDF