Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 97399 Details for
Bug 226462
[Proxy] Use system values for proxy settings on Linux
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Revised and tested patch
226462.txt (text/plain), 55.35 KB, created by
Francis Upton IV
on 2008-04-24 04:45:20 EDT
(
hide
)
Description:
Revised and tested patch
Filename:
MIME Type:
Creator:
Francis Upton IV
Created:
2008-04-24 04:45:20 EDT
Size:
55.35 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.core.tests.net >Index: src/org/eclipse/core/tests/net/NetTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/NetTest.java,v >retrieving revision 1.3 >diff -u -r1.3 NetTest.java >--- src/org/eclipse/core/tests/net/NetTest.java 11 Apr 2007 13:25:49 -0000 1.3 >+++ src/org/eclipse/core/tests/net/NetTest.java 24 Apr 2008 08:41:09 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007 IBM Corporation and others. >+ * Copyright (c) 2007, 2008 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -7,14 +7,18 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Oakland Software Incorporated - added proxy test > *******************************************************************************/ > package org.eclipse.core.tests.net; > >+import java.net.URI; > import java.util.*; > > import junit.framework.*; > >+import org.eclipse.core.internal.net.AbstractProxyProvider; > import org.eclipse.core.internal.net.ProxyType; >+import org.eclipse.core.internal.net.proxy.unix.UnixProxyProvider; > import org.eclipse.core.net.proxy.IProxyData; > import org.eclipse.core.net.proxy.IProxyService; > import org.eclipse.core.runtime.CoreException; >@@ -298,4 +302,102 @@ > this.getProxyManager().setNonProxiedHosts(oldHosts); > } > >+ // This test case has to be manually setup and run because it depends on >+ // whether the proxy is set in the native environment. It is here as >+ // a convenience to test the native support. >+ public void testProxyNativeLinux() throws Exception { >+ >+ // Leave this test off for the automatic test runs so we don't >+ // get confused by the settings that happen to be on the test machine >+ if (true) >+ return; >+ >+ UnixProxyProvider._debug = true; >+ >+ AbstractProxyProvider pp = new UnixProxyProvider(); >+ >+ IProxyData[] pd; >+ >+ // Test the following cases >+ // 1) No proxy set anywhere >+ // 2) http_proxy environment variable (use proxyIsSet) >+ // 3) gconf-edit proxy (use proxyIsSet and proxyAuthIsSet) >+ // 4) KDE proxy (use proxyIsSet and proxyAuthIsSet) >+ >+ // Toggle this if you have the proxy set up in the native environment >+ boolean proxyNativeIsSet = true; >+ >+ // Toggle this if you have the proxy authentication information setup >+ boolean proxyAuthIsSet = true; >+ >+ // Toggle this if you have the proxy set up in GNOME >+ boolean proxyGnomeIsSet = !true; >+ >+ String proxyHost = null; >+ String proxyUser = null; >+ String proxyPassword = null; >+ boolean proxyReqAuth = false; >+ int proxyPort = 0; >+ >+ if (proxyNativeIsSet || proxyGnomeIsSet) { >+ proxyHost = "berlioz"; >+ proxyPort = 3128; >+ if (proxyAuthIsSet) { >+ proxyUser = "user"; >+ proxyPassword = "password"; >+ proxyReqAuth = true; >+ } >+ } >+ >+ // Test HTTP >+ pd = pp.select(new URI("http://bbc.com")); >+ if (proxyNativeIsSet || proxyGnomeIsSet) { >+ assertEquals(1, pd.length); >+ assertEquals(proxyHost, pd[0].getHost()); >+ assertEquals(proxyPort, pd[0].getPort()); >+ if (proxyAuthIsSet) { >+ assertEquals(proxyUser, pd[0].getUserId()); >+ assertEquals(proxyPassword, pd[0].getPassword()); >+ assertEquals(proxyReqAuth, pd[0].isRequiresAuthentication()); >+ } >+ >+ } else { >+ assertEquals(0, pd.length); >+ } >+ >+ // Test HTTPS >+ pd = pp.select(new URI("https://bbc.com")); >+ if (proxyGnomeIsSet) { >+ assertEquals(1, pd.length); >+ assertEquals("https_" + proxyHost, pd[0].getHost()); >+ assertEquals(1 + proxyPort, pd[0].getPort()); >+ } else { >+ assertEquals(0, pd.length); >+ } >+ >+ // Test SOCKS >+ pd = pp.select(new URI("SOCKS://bbc.com")); >+ if (proxyGnomeIsSet) { >+ assertEquals(1, pd.length); >+ assertEquals("socks_" + proxyHost, pd[0].getHost()); >+ assertEquals(2 + proxyPort, pd[0].getPort()); >+ } else { >+ assertEquals(0, pd.length); >+ } >+ >+ // Test FTP >+ pd = pp.select(new URI("FTP://bbc.com")); >+ if (proxyGnomeIsSet) { >+ assertEquals(1, pd.length); >+ assertEquals("ftp_" + proxyHost, pd[0].getHost()); >+ assertEquals(3 + proxyPort, pd[0].getPort()); >+ } else { >+ assertEquals(0, pd.length); >+ } >+ >+ // Assume that localhost is a non-proxy host >+ pd = pp.select(new URI("http://localhost")); >+ assertEquals(0, pd.length); >+ } >+ > } >#P org.eclipse.core.net >Index: fragments/org.eclipse.core.net.linux.x86/build.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.net/fragments/org.eclipse.core.net.linux.x86/build.properties,v >retrieving revision 1.1 >diff -u -r1.1 build.properties >--- fragments/org.eclipse.core.net.linux.x86/build.properties 22 Apr 2008 10:07:25 -0000 1.1 >+++ fragments/org.eclipse.core.net.linux.x86/build.properties 24 Apr 2008 08:41:10 -0000 >@@ -12,7 +12,8 @@ > .,\ > META-INF/,\ > about.html,\ >- libproxysupport.so,\ >+ libproxyenv.so,\ >+ libproxygnome.so,\ > bin/ > src.includes = about.html > generateSourceBundle=false >Index: natives/unix/Debug/objects.mk >=================================================================== >RCS file: natives/unix/Debug/objects.mk >diff -N natives/unix/Debug/objects.mk >--- natives/unix/Debug/objects.mk 22 Apr 2008 10:04:18 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,7 +0,0 @@ >-################################################################################ >-# Automatically-generated file. Do not edit! >-################################################################################ >- >-USER_OBJS := >- >-LIBS := -lgconf-2 -lORBit-2 -lgthread-2.0 -lrt -lgobject-2.0 -lglib-2.0 >Index: natives/unix/Debug/sources.mk >=================================================================== >RCS file: natives/unix/Debug/sources.mk >diff -N natives/unix/Debug/sources.mk >--- natives/unix/Debug/sources.mk 22 Apr 2008 10:04:18 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,17 +0,0 @@ >-################################################################################ >-# Automatically-generated file. Do not edit! >-################################################################################ >- >-O_SRCS := >-C_SRCS := >-S_SRCS := >-OBJ_SRCS := >-ASM_SRCS := >-OBJS := >-C_DEPS := >-LIBRARIES := >- >-# Every subdirectory with source files must be described here >-SUBDIRS := \ >-. \ >- >Index: natives/unix/Debug/subdir.mk >=================================================================== >RCS file: natives/unix/Debug/subdir.mk >diff -N natives/unix/Debug/subdir.mk >--- natives/unix/Debug/subdir.mk 22 Apr 2008 10:04:17 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,24 +0,0 @@ >-################################################################################ >-# Automatically-generated file. Do not edit! >-################################################################################ >- >-# Add inputs and outputs from these tool invocations to the build variables >-C_SRCS += \ >-../getsystemproxy.c >- >-OBJS += \ >-./getsystemproxy.o >- >-C_DEPS += \ >-./getsystemproxy.d >- >- >-# Each subdirectory must supply rules for building sources it contributes >-%.o: ../%.c >- @echo 'Building file: $<' >- @echo 'Invoking: GCC C Compiler' >- gcc -I/usr/include/gconf/2 -I/usr/include/orbit-2.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include/ -O0 -fPIC -g3 -Wall -c -fmessage-length=0 -m32 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" >- @echo 'Finished building: $<' >- @echo ' ' >- >- >Index: natives/unix/Debug/makefile >=================================================================== >RCS file: natives/unix/Debug/makefile >diff -N natives/unix/Debug/makefile >--- natives/unix/Debug/makefile 22 Apr 2008 10:04:18 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,43 +0,0 @@ >-################################################################################ >-# Automatically-generated file. Do not edit! >-################################################################################ >- >--include ../makefile.init >- >-RM := rm -rf >- >-# All of the sources participating in the build are defined here >--include sources.mk >--include subdir.mk >--include objects.mk >- >-ifneq ($(MAKECMDGOALS),clean) >-ifneq ($(strip $(C_DEPS)),) >--include $(C_DEPS) >-endif >-endif >- >--include ../makefile.defs >- >-# Add inputs and outputs from these tool invocations to the build variables >- >-# All Target >-all: libproxysupport.so >- >-# Tool invocations >-libproxysupport.so: $(OBJS) $(USER_OBJS) >- @echo 'Building target: $@' >- @echo 'Invoking: GCC C Linker' >- gcc -m32 -shared -o"libproxysupport.so" $(OBJS) $(USER_OBJS) $(LIBS) >- @echo 'Finished building target: $@' >- @echo ' ' >- >-# Other Targets >-clean: >- -$(RM) $(OBJS)$(C_DEPS)$(LIBRARIES) libproxysupport.so >- -@echo ' ' >- >-.PHONY: all clean dependents >-.SECONDARY: >- >--include ../makefile.targets >Index: natives/unix/Debug/getsystemproxy.d >=================================================================== >RCS file: natives/unix/Debug/getsystemproxy.d >diff -N natives/unix/Debug/getsystemproxy.d >--- natives/unix/Debug/getsystemproxy.d 22 Apr 2008 10:04:17 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,226 +0,0 @@ >-getsystemproxy.d getsystemproxy.o: ../getsystemproxy.c \ >- /usr/include/glib-2.0/glib.h /usr/include/glib-2.0/glib/galloca.h \ >- /usr/include/glib-2.0/glib/gtypes.h \ >- /usr/lib/glib-2.0/include/glibconfig.h \ >- /usr/include/glib-2.0/glib/gmacros.h \ >- /usr/include/glib-2.0/glib/garray.h \ >- /usr/include/glib-2.0/glib/gasyncqueue.h \ >- /usr/include/glib-2.0/glib/gthread.h \ >- /usr/include/glib-2.0/glib/gerror.h /usr/include/glib-2.0/glib/gquark.h \ >- /usr/include/glib-2.0/glib/gutils.h \ >- /usr/include/glib-2.0/glib/gatomic.h \ >- /usr/include/glib-2.0/glib/gbacktrace.h \ >- /usr/include/glib-2.0/glib/gbase64.h \ >- /usr/include/glib-2.0/glib/gbookmarkfile.h \ >- /usr/include/glib-2.0/glib/gcache.h /usr/include/glib-2.0/glib/glist.h \ >- /usr/include/glib-2.0/glib/gmem.h /usr/include/glib-2.0/glib/gslice.h \ >- /usr/include/glib-2.0/glib/gcompletion.h \ >- /usr/include/glib-2.0/glib/gconvert.h \ >- /usr/include/glib-2.0/glib/gdataset.h \ >- /usr/include/glib-2.0/glib/gdate.h /usr/include/glib-2.0/glib/gdir.h \ >- /usr/include/glib-2.0/glib/gfileutils.h \ >- /usr/include/glib-2.0/glib/ghash.h /usr/include/glib-2.0/glib/ghook.h \ >- /usr/include/glib-2.0/glib/giochannel.h \ >- /usr/include/glib-2.0/glib/gmain.h /usr/include/glib-2.0/glib/gslist.h \ >- /usr/include/glib-2.0/glib/gstring.h \ >- /usr/include/glib-2.0/glib/gunicode.h \ >- /usr/include/glib-2.0/glib/gkeyfile.h \ >- /usr/include/glib-2.0/glib/gmappedfile.h \ >- /usr/include/glib-2.0/glib/gmarkup.h \ >- /usr/include/glib-2.0/glib/gmessages.h \ >- /usr/include/glib-2.0/glib/gnode.h /usr/include/glib-2.0/glib/goption.h \ >- /usr/include/glib-2.0/glib/gpattern.h \ >- /usr/include/glib-2.0/glib/gprimes.h \ >- /usr/include/glib-2.0/glib/gqsort.h /usr/include/glib-2.0/glib/gqueue.h \ >- /usr/include/glib-2.0/glib/grand.h /usr/include/glib-2.0/glib/grel.h \ >- /usr/include/glib-2.0/glib/gregex.h \ >- /usr/include/glib-2.0/glib/gscanner.h \ >- /usr/include/glib-2.0/glib/gsequence.h \ >- /usr/include/glib-2.0/glib/gshell.h /usr/include/glib-2.0/glib/gspawn.h \ >- /usr/include/glib-2.0/glib/gstrfuncs.h \ >- /usr/include/glib-2.0/glib/gthreadpool.h \ >- /usr/include/glib-2.0/glib/gtimer.h /usr/include/glib-2.0/glib/gtree.h \ >- /usr/include/gconf/2/gconf/gconf-value.h \ >- /usr/include/gconf/2/gconf/gconf-error.h \ >- /usr/include/gconf/2/gconf/gconf-client.h \ >- /usr/include/glib-2.0/glib-object.h \ >- /usr/include/glib-2.0/gobject/gboxed.h \ >- /usr/include/glib-2.0/gobject/gtype.h \ >- /usr/include/glib-2.0/gobject/genums.h \ >- /usr/include/glib-2.0/gobject/gobject.h \ >- /usr/include/glib-2.0/gobject/gvalue.h \ >- /usr/include/glib-2.0/gobject/gparam.h \ >- /usr/include/glib-2.0/gobject/gclosure.h \ >- /usr/include/glib-2.0/gobject/gsignal.h \ >- /usr/include/glib-2.0/gobject/gmarshal.h \ >- /usr/include/glib-2.0/gobject/gparamspecs.h \ >- /usr/include/glib-2.0/gobject/gsourceclosure.h \ >- /usr/include/glib-2.0/gobject/gtypemodule.h \ >- /usr/include/glib-2.0/gobject/gtypeplugin.h \ >- /usr/include/glib-2.0/gobject/gvaluearray.h \ >- /usr/include/glib-2.0/gobject/gvaluetypes.h \ >- /usr/include/gconf/2/gconf/gconf.h \ >- /usr/include/gconf/2/gconf/gconf-schema.h \ >- /usr/include/gconf/2/gconf/gconf-engine.h \ >- /usr/include/gconf/2/gconf/gconf-error.h \ >- /usr/include/gconf/2/gconf/gconf-enum-types.h \ >- /usr/include/gconf/2/gconf/gconf-listeners.h \ >- /usr/include/gconf/2/gconf/gconf-changeset.h >- >-/usr/include/glib-2.0/glib.h: >- >-/usr/include/glib-2.0/glib/galloca.h: >- >-/usr/include/glib-2.0/glib/gtypes.h: >- >-/usr/lib/glib-2.0/include/glibconfig.h: >- >-/usr/include/glib-2.0/glib/gmacros.h: >- >-/usr/include/glib-2.0/glib/garray.h: >- >-/usr/include/glib-2.0/glib/gasyncqueue.h: >- >-/usr/include/glib-2.0/glib/gthread.h: >- >-/usr/include/glib-2.0/glib/gerror.h: >- >-/usr/include/glib-2.0/glib/gquark.h: >- >-/usr/include/glib-2.0/glib/gutils.h: >- >-/usr/include/glib-2.0/glib/gatomic.h: >- >-/usr/include/glib-2.0/glib/gbacktrace.h: >- >-/usr/include/glib-2.0/glib/gbase64.h: >- >-/usr/include/glib-2.0/glib/gbookmarkfile.h: >- >-/usr/include/glib-2.0/glib/gcache.h: >- >-/usr/include/glib-2.0/glib/glist.h: >- >-/usr/include/glib-2.0/glib/gmem.h: >- >-/usr/include/glib-2.0/glib/gslice.h: >- >-/usr/include/glib-2.0/glib/gcompletion.h: >- >-/usr/include/glib-2.0/glib/gconvert.h: >- >-/usr/include/glib-2.0/glib/gdataset.h: >- >-/usr/include/glib-2.0/glib/gdate.h: >- >-/usr/include/glib-2.0/glib/gdir.h: >- >-/usr/include/glib-2.0/glib/gfileutils.h: >- >-/usr/include/glib-2.0/glib/ghash.h: >- >-/usr/include/glib-2.0/glib/ghook.h: >- >-/usr/include/glib-2.0/glib/giochannel.h: >- >-/usr/include/glib-2.0/glib/gmain.h: >- >-/usr/include/glib-2.0/glib/gslist.h: >- >-/usr/include/glib-2.0/glib/gstring.h: >- >-/usr/include/glib-2.0/glib/gunicode.h: >- >-/usr/include/glib-2.0/glib/gkeyfile.h: >- >-/usr/include/glib-2.0/glib/gmappedfile.h: >- >-/usr/include/glib-2.0/glib/gmarkup.h: >- >-/usr/include/glib-2.0/glib/gmessages.h: >- >-/usr/include/glib-2.0/glib/gnode.h: >- >-/usr/include/glib-2.0/glib/goption.h: >- >-/usr/include/glib-2.0/glib/gpattern.h: >- >-/usr/include/glib-2.0/glib/gprimes.h: >- >-/usr/include/glib-2.0/glib/gqsort.h: >- >-/usr/include/glib-2.0/glib/gqueue.h: >- >-/usr/include/glib-2.0/glib/grand.h: >- >-/usr/include/glib-2.0/glib/grel.h: >- >-/usr/include/glib-2.0/glib/gregex.h: >- >-/usr/include/glib-2.0/glib/gscanner.h: >- >-/usr/include/glib-2.0/glib/gsequence.h: >- >-/usr/include/glib-2.0/glib/gshell.h: >- >-/usr/include/glib-2.0/glib/gspawn.h: >- >-/usr/include/glib-2.0/glib/gstrfuncs.h: >- >-/usr/include/glib-2.0/glib/gthreadpool.h: >- >-/usr/include/glib-2.0/glib/gtimer.h: >- >-/usr/include/glib-2.0/glib/gtree.h: >- >-/usr/include/gconf/2/gconf/gconf-value.h: >- >-/usr/include/gconf/2/gconf/gconf-error.h: >- >-/usr/include/gconf/2/gconf/gconf-client.h: >- >-/usr/include/glib-2.0/glib-object.h: >- >-/usr/include/glib-2.0/gobject/gboxed.h: >- >-/usr/include/glib-2.0/gobject/gtype.h: >- >-/usr/include/glib-2.0/gobject/genums.h: >- >-/usr/include/glib-2.0/gobject/gobject.h: >- >-/usr/include/glib-2.0/gobject/gvalue.h: >- >-/usr/include/glib-2.0/gobject/gparam.h: >- >-/usr/include/glib-2.0/gobject/gclosure.h: >- >-/usr/include/glib-2.0/gobject/gsignal.h: >- >-/usr/include/glib-2.0/gobject/gmarshal.h: >- >-/usr/include/glib-2.0/gobject/gparamspecs.h: >- >-/usr/include/glib-2.0/gobject/gsourceclosure.h: >- >-/usr/include/glib-2.0/gobject/gtypemodule.h: >- >-/usr/include/glib-2.0/gobject/gtypeplugin.h: >- >-/usr/include/glib-2.0/gobject/gvaluearray.h: >- >-/usr/include/glib-2.0/gobject/gvaluetypes.h: >- >-/usr/include/gconf/2/gconf/gconf.h: >- >-/usr/include/gconf/2/gconf/gconf-schema.h: >- >-/usr/include/gconf/2/gconf/gconf-engine.h: >- >-/usr/include/gconf/2/gconf/gconf-error.h: >- >-/usr/include/gconf/2/gconf/gconf-enum-types.h: >- >-/usr/include/gconf/2/gconf/gconf-listeners.h: >- >-/usr/include/gconf/2/gconf/gconf-changeset.h: >Index: src/org/eclipse/core/internal/net/Activator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java,v >retrieving revision 1.5 >diff -u -r1.5 Activator.java >--- src/org/eclipse/core/internal/net/Activator.java 18 Apr 2008 10:04:49 -0000 1.5 >+++ src/org/eclipse/core/internal/net/Activator.java 24 Apr 2008 08:41:10 -0000 >@@ -85,6 +85,10 @@ > getInstance().log(new Status(IStatus.INFO, ID, 0, message, exc)); > } > >+ public static void logWarning(String message, Throwable exc) { >+ getInstance().log(new Status(IStatus.WARNING, ID, 0, message, exc)); >+ } >+ > /* > * Log the given status to the log file. If the log is not available, log > * the status to the console. >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.net/META-INF/MANIFEST.MF,v >retrieving revision 1.9 >diff -u -r1.9 MANIFEST.MF >--- META-INF/MANIFEST.MF 18 Apr 2008 10:04:49 -0000 1.9 >+++ META-INF/MANIFEST.MF 24 Apr 2008 08:41:10 -0000 >@@ -13,6 +13,7 @@ > org.eclipse.equinox.registry;bundle-version="3.4.0" > Bundle-ActivationPolicy: lazy > Export-Package: org.eclipse.core.internal.net;x-internal:=true, >+ org.eclipse.core.internal.net.proxy.unix;x-internal:=true, > org.eclipse.core.net.proxy > Bundle-RequiredExecutionEnvironment: J2SE-1.4, > CDC-1.0/Foundation-1.0, >Index: natives/unix/getsystemproxy.c >=================================================================== >RCS file: natives/unix/getsystemproxy.c >diff -N natives/unix/getsystemproxy.c >--- natives/unix/getsystemproxy.c 22 Apr 2008 10:04:18 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,237 +0,0 @@ >-/* >- * Copyright 2008 Oakland Software Incorporated and others >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * Oakland Software Incorporated - initial API and implementation >- */ >- >-#include <jni.h> >- >-#include <glib.h> >-#include <glib/gslist.h> >-#include <gconf/gconf-value.h> >-#include <gconf/gconf-client.h> >- >-#ifdef __linux__ >-#include <string.h> >-#else >-#include <strings.h> >-#endif >- >-static GConfClient *client= NULL; >- >-static jclass proxyInfoClass; >-static jclass stringClass; >-static jmethodID proxyInfoConstructor; >-static jmethodID toString; >- >-static jmethodID hostMethod; >-static jmethodID portMethod; >-static jmethodID requiresAuthenticationMethod; >-static jmethodID userMethod; >-static jmethodID passwordMethod; >- >-#define CHECK_NULL(X) { if ((X) == NULL) fprintf (stderr,"JNI error at line %d\n", __LINE__); } >- >-static void gconfInit(JNIEnv *env) { >- client = gconf_client_get_default(); >- jclass cls= NULL; >- CHECK_NULL(cls = (*env)->FindClass(env, "org/eclipse/core/internal/net/ProxyData")); >- proxyInfoClass = (*env)->NewGlobalRef(env, cls); >- >- CHECK_NULL(cls = (*env)->FindClass(env, "java/lang/String")); >- stringClass = (*env)->NewGlobalRef(env, cls); >- >- CHECK_NULL(proxyInfoConstructor = (*env)->GetMethodID(env, proxyInfoClass, "<init>", "(Ljava/lang/String;)V")); >- >- CHECK_NULL(toString = (*env)->GetMethodID(env, proxyInfoClass, "toString", "()Ljava/lang/String;")); >- >- CHECK_NULL(hostMethod = (*env)->GetMethodID(env, proxyInfoClass, "setHost", >- "(Ljava/lang/String;)V")); >- CHECK_NULL(portMethod = (*env)->GetMethodID(env, proxyInfoClass, "setPort", >- "(I)V")); >- CHECK_NULL(requiresAuthenticationMethod= (*env)->GetMethodID(env, proxyInfoClass, "setRequiresAuthentication", >- "(Z)V")); >- CHECK_NULL(userMethod = (*env)->GetMethodID(env, proxyInfoClass, "setUserid", >- "(Ljava/lang/String;)V")); >- CHECK_NULL(passwordMethod = (*env)->GetMethodID(env, proxyInfoClass, "setPassword", >- "(Ljava/lang/String;)V")); >-} >- >-/* >- * Class: org_eclipse_core_internal_net_UnixProxyProvider >- * Method: getGConfProxyInfo >- * Signature: ([Ljava/lang/String); >- */ >-JNIEXPORT jobject JNICALL Java_org_eclipse_core_internal_net_UnixProxyProvider_getGConfProxyInfo( >- JNIEnv *env, jclass clazz, jstring protocol) { >- >- jboolean isCopy; >- const char *cprotocol; >- >- jobject proxyInfo= NULL; >- >- if (client == NULL) { >- gconfInit(env); >- } >- >- CHECK_NULL(proxyInfo = (*env)->NewObject(env, proxyInfoClass, proxyInfoConstructor, protocol)); >- >- cprotocol = (*env)->GetStringUTFChars(env, protocol, &isCopy); >- if (cprotocol == NULL) >- return NULL; >- >- //printf("cprotocol: %s\n", cprotocol); >- >- if (strcasecmp(cprotocol, "http") == 0) { >- gboolean useProxy = gconf_client_get_bool(client, >- "/system/http_proxy/use_http_proxy", NULL); >- if (!useProxy) { >- proxyInfo = NULL; >- goto exit; >- } >- >- gchar *host = gconf_client_get_string(client, >- "/system/http_proxy/host", NULL); >- jobject jhost = (*env)->NewStringUTF(env, host); >- (*env)->CallVoidMethod(env, proxyInfo, hostMethod, jhost); >- >- gint port = gconf_client_get_int(client, "/system/http_proxy/port", >- NULL); >- (*env)->CallVoidMethod(env, proxyInfo, portMethod, port); >- >- gboolean reqAuth = gconf_client_get_bool(client, >- "/system/http_proxy/use_authentication", NULL); >- (*env)->CallVoidMethod(env, proxyInfo, >- requiresAuthenticationMethod, reqAuth); >- if (reqAuth) { >- >- gchar *user = gconf_client_get_string(client, >- "/system/http_proxy/authentication_user", NULL); >- jobject juser = (*env)->NewStringUTF(env, user); >- (*env)->CallVoidMethod(env, proxyInfo, userMethod, juser); >- >- gchar *password = gconf_client_get_string(client, >- "/system/http_proxy/authentication_password", NULL); >- jobject jpassword = (*env)->NewStringUTF(env, password); >- (*env)->CallVoidMethod(env, proxyInfo, passwordMethod, >- jpassword); >- } >- goto exit; >- } >- >- // Everything else applies only if the system proxy mode is manual >- gchar *mode = gconf_client_get_string(client, "/system/proxy/mode", NULL); >- if (strcasecmp(mode, "manual") != 0) { >- proxyInfo = NULL; >- goto exit; >- } >- >- char selector[100]; >- >- if (strcasecmp(cprotocol, "https") == 0) { >- strcpy(selector, "/system/proxy/secure_"); >- } else if (strcasecmp(cprotocol, "socks") == 0) { >- strcpy(selector, "/system/proxy/socks_"); >- } else if (strcasecmp(cprotocol, "ftp") == 0) { >- strcpy(selector, "/system/proxy/ftp_"); >- } else { >- proxyInfo = NULL; >- goto exit; >- } >- >- char useSelector[100]; >- strcpy(useSelector, selector); >- >- gchar *host = gconf_client_get_string(client, strcat(useSelector, "host"), >- NULL); >- jobject jhost = (*env)->NewStringUTF(env, host); >- (*env)->CallVoidMethod(env, proxyInfo, hostMethod, jhost); >- >- strcpy(useSelector, selector); >- gint port = gconf_client_get_int(client, strcat(useSelector, "port"), NULL); >- (*env)->CallVoidMethod(env, proxyInfo, portMethod, port); >- >- exit: if (isCopy == JNI_TRUE) >- (*env)->ReleaseStringUTFChars(env, protocol, cprotocol); >- return proxyInfo; >-} >- >-typedef struct { >- jobjectArray npHostArray; >- JNIEnv *env; >- int index; >-} ListProcContext; >- >-// user_data is the ListProcContext >-void listProc(gpointer data, gpointer user_data) { >- ListProcContext *lpc = user_data; >- jobject jnpHost = (*lpc->env)->NewStringUTF(lpc->env, (char *)data); >- (*lpc->env)->SetObjectArrayElement(lpc->env, lpc->npHostArray, >- lpc->index++, jnpHost); >-} >- >-/* >- * Class: org_eclipse_core_internal_net_UnixProxyProvider >- * Method: getGConfNonProxyHosts >- * Signature: ()[Ljava/lang/String; >- */ >-JNIEXPORT jobjectArray JNICALL Java_org_eclipse_core_internal_net_UnixProxyProvider_getGConfNonProxyHosts( >- JNIEnv *env, jclass clazz) { >- >- if (client == NULL) { >- gconfInit(env); >- } >- >- GSList *npHosts; >- int size; >- >- npHosts = gconf_client_get_list(client, "/system/http_proxy/ignore_hosts", >- GCONF_VALUE_STRING, NULL); >- size = g_slist_length(npHosts); >- >- // TODO - I'm not sure this is really valid, it's from the JVM implementation >- // of ProxySelector >- if (size == 0) { >- npHosts = gconf_client_get_list(client, "/system/proxy/no_proxy_for", >- GCONF_VALUE_STRING, NULL); >- } >- size = g_slist_length(npHosts); >- >- jobjectArray ret = (*env)->NewObjectArray(env, size, stringClass, NULL); >- >- ListProcContext lpc; >- lpc.env = env; >- lpc.npHostArray = ret; >- lpc.index = 0; >- >- g_slist_foreach(npHosts, listProc, &lpc); >- return ret; >-} >- >-/* >- * Class: org_eclipse_core_internal_net_UnixProxyProvider >- * Method: getKdeProxyInfo >- * Signature: ([Ljava/lang/String); >- */ >-JNIEXPORT jobject JNICALL Java_org_eclipse_core_internal_net_UnixProxyProvider_getKdeProxyInfo( >- JNIEnv *env, jclass clazz, jstring protocol) { >- //printf("getKdeProxyInfo - not implemented\n"); >- return NULL; >-} >- >-/* >- * Class: org_eclipse_core_internal_net_UnixProxyProvider >- * Method: getKdeNonProxyHosts >- * Signature: ()Ljava/lang/String; >- */ >-JNIEXPORT jobject JNICALL Java_org_eclipse_core_internal_net_UnixProxyProvider_getKdeNonProxyHosts( >- JNIEnv *env, jclass clazz) { >- //printf("getKdeNonProxyHosts - not implemented\n"); >- return NULL; >-} >- >Index: src/org/eclipse/core/internal/net/proxy/unix/UnixProxyProvider.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/unix/UnixProxyProvider.java,v >retrieving revision 1.1 >diff -u -r1.1 UnixProxyProvider.java >--- src/org/eclipse/core/internal/net/proxy/unix/UnixProxyProvider.java 22 Apr 2008 10:04:18 -0000 1.1 >+++ src/org/eclipse/core/internal/net/proxy/unix/UnixProxyProvider.java 24 Apr 2008 08:41:10 -0000 >@@ -14,19 +14,35 @@ > import java.net.URISyntaxException; > > import org.eclipse.core.internal.net.AbstractProxyProvider; >+import org.eclipse.core.internal.net.Activator; > import org.eclipse.core.internal.net.ProxyData; > import org.eclipse.core.net.proxy.IProxyData; > > public class UnixProxyProvider extends AbstractProxyProvider { > > static { >+ >+ // Load each of the libraries separately so that we get >+ // whichever ones work >+ try { >+ System.loadLibrary("proxyenv"); //$NON-NLS-1$ >+ } catch (UnsatisfiedLinkError ex) { >+ // This should never happen >+ Activator.logError("Missing native code for getenv()", ex); //$NON-NLS-1$ >+ } >+ > try { >- System.loadLibrary("libproxysupport"); //$NON-NLS-1$ >+ System.loadLibrary("proxygnome"); //$NON-NLS-1$ > } catch (UnsatisfiedLinkError ex) { >+ Activator.logInfo("Missing gconf (Gnome) libraries", ex); //$NON-NLS-1$ > // This will happen on systems that are missing Gnome libraries > } >+ >+ // TODO - don't have a library for KDE yet, put it here when we do > } > >+ public static boolean _debug = false; >+ > public UnixProxyProvider() { > // Nothing to initialize > } >@@ -45,12 +61,52 @@ > return new IProxyData[0]; > } > >+ protected String[] debugPrint(String[] strs) { >+ if (_debug) { >+ System.out.println("npHosts: "); //$NON-NLS-1$ >+ for (int i = 0; i < strs.length; i++) >+ System.out.println(i + ": " + strs[i]); //$NON-NLS-1$ >+ } >+ return strs; >+ } >+ > protected String[] getNonProxiedHosts() { >+ String[] npHosts; >+ > try { >- String[] npHosts = getGConfNonProxyHosts(); >- if (npHosts != null && npHosts.length > 0) >- return npHosts; >- return getKdeNonProxyHosts(); >+ // First try the environment variable which is a URL >+ String npEnv = null; >+ npEnv = getEnv("no_proxy"); //$NON-NLS-1$ >+ if (npEnv != null) { >+ if (_debug) >+ System.out.println("got env no_proxy: " + npEnv); //$NON-NLS-1$ >+ npHosts = npEnv.split(","); //$NON-NLS-1$ >+ for (int i = 0; i < npHosts.length; i++) >+ npHosts[i] = npHosts[i].trim(); >+ return debugPrint(npHosts); >+ } >+ } catch (UnsatisfiedLinkError ex) { >+ // This has already been reported when the native code did not load >+ } >+ >+ try { >+ npHosts = getGConfNonProxyHosts(); >+ if (npHosts != null && npHosts.length > 0) { >+ if (_debug) >+ System.out.println("got gnome no proxy"); //$NON-NLS-1$ >+ return debugPrint(npHosts); >+ } >+ } catch (UnsatisfiedLinkError ex) { >+ // This has already been reported (the native code did not load) >+ } >+ >+ try { >+ npHosts = getKdeNonProxyHosts(); >+ if (npHosts != null && npHosts.length > 0) { >+ if (_debug) >+ System.out.println("got kde no proxy"); //$NON-NLS-1$ >+ return debugPrint(npHosts); >+ } > } catch (UnsatisfiedLinkError ex) { > // This has already been reported (the native code did not load) > } >@@ -61,34 +117,67 @@ > protected ProxyData getSystemProxyInfo(String protocol) { > ProxyData pd = null; > >- // First try the environment variable which is a URL >- // TODO: native calls for system properties, since System#getenx is >- // deprecated in 1.4 >- String sysHttp = null; >- // System.getenv(protocol.toLowerCase() + "_proxy"); //$NON-NLS-1$ >- if (sysHttp != null) { >- URI uri = null; >- try { >- uri = new URI(sysHttp); >- } catch (URISyntaxException e) { >- return null; >- } >+ try { >+ // First try the environment variable which is a URL >+ String proxyEnv = null; >+ String envName = protocol + "_proxy"; //$NON-NLS-1$ >+ proxyEnv = getEnv(envName); >+ if (_debug) >+ System.out.println("got proxyEnv: " + proxyEnv); //$NON-NLS-1$ >+ if (proxyEnv != null) { >+ URI uri = null; >+ try { >+ uri = new URI(proxyEnv); >+ } catch (URISyntaxException e) { >+ Activator >+ .logWarning( >+ "Error processing URI from: " + envName + " value: " + proxyEnv, e); //$NON-NLS-1$//$NON-NLS-2$ >+ return null; >+ } >+ >+ pd = new ProxyData(protocol); >+ pd.setHost(uri.getHost()); >+ pd.setPort(uri.getPort()); >+ String userInfo = uri.getUserInfo(); >+ if (userInfo != null) { >+ String user = null; >+ String password = null; >+ int pwInd = userInfo.indexOf(':'); >+ if (pwInd >= 0) { >+ user = userInfo.substring(0, pwInd); >+ password = userInfo.substring(pwInd + 1); >+ } else { >+ user = userInfo; >+ } >+ pd.setUserid(user); >+ pd.setPassword(password); >+ } > >- pd = new ProxyData(protocol); >- pd.setHost(uri.getHost()); >- pd.setPort(uri.getPort()); >- return pd; >+ if (_debug) >+ System.out.println("env proxy data: " + pd); //$NON-NLS-1$ >+ return pd; >+ } >+ } catch (UnsatisfiedLinkError ex) { >+ // This has already been reported when the native code did not load > } > > try { > // Then ask Gnome > pd = getGConfProxyInfo(protocol); >- >+ if (_debug) >+ System.out.println("Gnome proxy data: " + pd); //$NON-NLS-1$ > if (pd != null) > return pd; > >+ } catch (UnsatisfiedLinkError ex) { >+ // This has already been reported when the native code did not load >+ } >+ >+ try { > // Then ask KDE > pd = getKdeProxyInfo(protocol); >+ if (_debug) >+ System.out.println("KDE proxy data: " + pd); //$NON-NLS-1$ > if (pd != null) > return pd; > } catch (UnsatisfiedLinkError ex) { >@@ -98,6 +187,8 @@ > return null; > } > >+ protected static native String getEnv(String protocol); >+ > protected static native ProxyData getGConfProxyInfo(String protocol); > > protected static native String[] getGConfNonProxyHosts(); >Index: natives/unix/README.txt >=================================================================== >RCS file: natives/unix/README.txt >diff -N natives/unix/README.txt >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ natives/unix/README.txt 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,12 @@ >+The source for getting the native proxy info is in the top level unix directory. If >+there are more specific compile options, makefiles, etc, then they should be moved >+to subdirectories, like in org.eclipse.core.filesystem. >+ >+The GetProxy* directories actually have the make files; this is the makefile as generated by the CDT. >+ >+To build this, go into GetProxy* directory and type "make clean", then "make", >+the library will be built in that same directory. Then you will need to copy the library to the correct org.eclipse.core.net.* >+fragment. >+ >+There is no automatic build process for building the native code, instead the binary >+shared libraries are checked in for each fragment, just like in org.eclipse.code.filesystem. >Index: natives/unix/getproxyenv.c >=================================================================== >RCS file: natives/unix/getproxyenv.c >diff -N natives/unix/getproxyenv.c >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ natives/unix/getproxyenv.c 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,52 @@ >+/* >+ * Copyright 2008 Oakland Software Incorporated and others >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Oakland Software Incorporated - initial API and implementation >+ */ >+ >+#include <jni.h> >+ >+#include <stdlib.h> >+#ifdef __linux__ >+#include <string.h> >+#else >+#include <strings.h> >+#endif >+ >+static int debug = 0; >+ >+/* >+ * Class: org_eclipse_core_internal_net_proxy_unix_UnixProxyProvider >+ * Method: getEnvProxyString >+ * Signature: ([Ljava/lang/String); >+ */ >+JNIEXPORT jstring JNICALL Java_org_eclipse_core_internal_net_proxy_unix_UnixProxyProvider_getEnv( >+ JNIEnv *env, jclass clazz, jstring variable) { >+ >+ jboolean isCopy; >+ const char *cvariable; >+ >+ cvariable = (*env)->GetStringUTFChars(env, variable, &isCopy); >+ if (cvariable == NULL) >+ return NULL; >+ >+ if (debug) >+ printf("envName: %s\n", cvariable); >+ char *envValue = getenv(cvariable); >+ if (envValue == NULL) >+ return NULL; >+ >+ if (debug) >+ printf("envValue: %s\n", envValue); >+ >+ jstring jenvValue = (*env)->NewStringUTF(env, envValue); >+ return jenvValue; >+} >+ >+ >+ >Index: natives/unix/GetProxyGnome/makefile >=================================================================== >RCS file: natives/unix/GetProxyGnome/makefile >diff -N natives/unix/GetProxyGnome/makefile >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ natives/unix/GetProxyGnome/makefile 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,43 @@ >+################################################################################ >+# Automatically-generated file. Do not edit! >+################################################################################ >+ >+-include ../makefile.init >+ >+RM := rm -rf >+ >+# All of the sources participating in the build are defined here >+-include sources.mk >+-include subdir.mk >+-include objects.mk >+ >+ifneq ($(MAKECMDGOALS),clean) >+ifneq ($(strip $(C_DEPS)),) >+-include $(C_DEPS) >+endif >+endif >+ >+-include ../makefile.defs >+ >+# Add inputs and outputs from these tool invocations to the build variables >+ >+# All Target >+all: libproxygnome.so >+ >+# Tool invocations >+libproxygnome.so: $(OBJS) $(USER_OBJS) >+ @echo 'Building target: $@' >+ @echo 'Invoking: GCC C Linker' >+ gcc -m32 -shared -o"libproxygnome.so" $(OBJS) $(USER_OBJS) $(LIBS) >+ @echo 'Finished building target: $@' >+ @echo ' ' >+ >+# Other Targets >+clean: >+ -$(RM) $(OBJS)$(C_DEPS)$(LIBRARIES) libproxygnome.so >+ -@echo ' ' >+ >+.PHONY: all clean dependents >+.SECONDARY: >+ >+-include ../makefile.targets >Index: natives/unix/getproxygnome.c >=================================================================== >RCS file: natives/unix/getproxygnome.c >diff -N natives/unix/getproxygnome.c >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ natives/unix/getproxygnome.c 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,214 @@ >+/* >+ * Copyright 2008 Oakland Software Incorporated and others >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Oakland Software Incorporated - initial API and implementation >+ */ >+ >+#include <jni.h> >+ >+#include <glib.h> >+#include <glib/gslist.h> >+#include <gconf/gconf-value.h> >+#include <gconf/gconf-client.h> >+ >+#ifdef __linux__ >+#include <string.h> >+#else >+#include <strings.h> >+#endif >+ >+static GConfClient *client= NULL; >+ >+static jclass proxyInfoClass; >+static jclass stringClass; >+static jmethodID proxyInfoConstructor; >+static jmethodID toString; >+ >+static jmethodID hostMethod; >+static jmethodID portMethod; >+static jmethodID userMethod; >+static jmethodID passwordMethod; >+ >+#define CHECK_NULL(X) { if ((X) == NULL) fprintf (stderr,"JNI error at line %d\n", __LINE__); } >+ >+static void gconfInit(JNIEnv *env) { >+ client = gconf_client_get_default(); >+ jclass cls= NULL; >+ CHECK_NULL(cls = (*env)->FindClass(env, "org/eclipse/core/internal/net/ProxyData")); >+ proxyInfoClass = (*env)->NewGlobalRef(env, cls); >+ >+ CHECK_NULL(cls = (*env)->FindClass(env, "java/lang/String")); >+ stringClass = (*env)->NewGlobalRef(env, cls); >+ >+ CHECK_NULL(proxyInfoConstructor = (*env)->GetMethodID(env, proxyInfoClass, "<init>", "(Ljava/lang/String;)V")); >+ >+ CHECK_NULL(toString = (*env)->GetMethodID(env, proxyInfoClass, "toString", "()Ljava/lang/String;")); >+ >+ CHECK_NULL(hostMethod = (*env)->GetMethodID(env, proxyInfoClass, "setHost", >+ "(Ljava/lang/String;)V")); >+ CHECK_NULL(portMethod = (*env)->GetMethodID(env, proxyInfoClass, "setPort", >+ "(I)V")); >+ CHECK_NULL(userMethod = (*env)->GetMethodID(env, proxyInfoClass, "setUserid", >+ "(Ljava/lang/String;)V")); >+ CHECK_NULL(passwordMethod = (*env)->GetMethodID(env, proxyInfoClass, "setPassword", >+ "(Ljava/lang/String;)V")); >+} >+ >+/* >+ * Class: org_eclipse_core_internal_net_UnixProxyProvider >+ * Method: getGConfProxyInfo >+ * Signature: ([Ljava/lang/String); >+ */ >+JNIEXPORT jobject JNICALL Java_org_eclipse_core_internal_net_proxy_unix_UnixProxyProvider_getGConfProxyInfo( >+ JNIEnv *env, jclass clazz, jstring protocol) { >+ >+ jboolean isCopy; >+ const char *cprotocol; >+ >+ jobject proxyInfo= NULL; >+ >+ if (client == NULL) { >+ gconfInit(env); >+ } >+ >+ CHECK_NULL(proxyInfo = (*env)->NewObject(env, proxyInfoClass, proxyInfoConstructor, protocol)); >+ >+ cprotocol = (*env)->GetStringUTFChars(env, protocol, &isCopy); >+ if (cprotocol == NULL) >+ return NULL; >+ >+ //printf("cprotocol: %s\n", cprotocol); >+ >+ // use_same_proxy means we use the http value for everything >+ gboolean useSame = gconf_client_get_bool(client, >+ "/system/http_proxy/use_same_proxy", NULL); >+ >+ if (strcasecmp(cprotocol, "http") == 0 || useSame) { >+ gboolean useProxy = gconf_client_get_bool(client, >+ "/system/http_proxy/use_http_proxy", NULL); >+ if (!useProxy) { >+ proxyInfo = NULL; >+ goto exit; >+ } >+ >+ gchar *host = gconf_client_get_string(client, >+ "/system/http_proxy/host", NULL); >+ jobject jhost = (*env)->NewStringUTF(env, host); >+ (*env)->CallVoidMethod(env, proxyInfo, hostMethod, jhost); >+ >+ gint port = gconf_client_get_int(client, "/system/http_proxy/port", >+ NULL); >+ (*env)->CallVoidMethod(env, proxyInfo, portMethod, port); >+ >+ gboolean reqAuth = gconf_client_get_bool(client, >+ "/system/http_proxy/use_authentication", NULL); >+ if (reqAuth) { >+ >+ gchar *user = gconf_client_get_string(client, >+ "/system/http_proxy/authentication_user", NULL); >+ jobject juser = (*env)->NewStringUTF(env, user); >+ (*env)->CallVoidMethod(env, proxyInfo, userMethod, juser); >+ >+ gchar *password = gconf_client_get_string(client, >+ "/system/http_proxy/authentication_password", NULL); >+ jobject jpassword = (*env)->NewStringUTF(env, password); >+ (*env)->CallVoidMethod(env, proxyInfo, passwordMethod, >+ jpassword); >+ } >+ goto exit; >+ } >+ >+ // Everything else applies only if the system proxy mode is manual >+ gchar *mode = gconf_client_get_string(client, "/system/proxy/mode", NULL); >+ if (strcasecmp(mode, "manual") != 0) { >+ proxyInfo = NULL; >+ goto exit; >+ } >+ >+ char selector[100]; >+ >+ if (strcasecmp(cprotocol, "https") == 0) { >+ strcpy(selector, "/system/proxy/secure_"); >+ } else if (strcasecmp(cprotocol, "socks") == 0) { >+ strcpy(selector, "/system/proxy/socks_"); >+ } else if (strcasecmp(cprotocol, "ftp") == 0) { >+ strcpy(selector, "/system/proxy/ftp_"); >+ } else { >+ proxyInfo = NULL; >+ goto exit; >+ } >+ >+ char useSelector[100]; >+ strcpy(useSelector, selector); >+ >+ gchar *host = gconf_client_get_string(client, strcat(useSelector, "host"), >+ NULL); >+ jobject jhost = (*env)->NewStringUTF(env, host); >+ (*env)->CallVoidMethod(env, proxyInfo, hostMethod, jhost); >+ >+ strcpy(useSelector, selector); >+ gint port = gconf_client_get_int(client, strcat(useSelector, "port"), NULL); >+ (*env)->CallVoidMethod(env, proxyInfo, portMethod, port); >+ >+ exit: if (isCopy == JNI_TRUE) >+ (*env)->ReleaseStringUTFChars(env, protocol, cprotocol); >+ return proxyInfo; >+} >+ >+typedef struct { >+ jobjectArray npHostArray; >+ JNIEnv *env; >+ int index; >+} ListProcContext; >+ >+// user_data is the ListProcContext >+void listProc(gpointer data, gpointer user_data) { >+ ListProcContext *lpc = user_data; >+ jobject jnpHost = (*lpc->env)->NewStringUTF(lpc->env, (char *)data); >+ (*lpc->env)->SetObjectArrayElement(lpc->env, lpc->npHostArray, >+ lpc->index++, jnpHost); >+} >+ >+/* >+ * Class: org_eclipse_core_internal_net_UnixProxyProvider >+ * Method: getGConfNonProxyHosts >+ * Signature: ()[Ljava/lang/String; >+ */ >+JNIEXPORT jobjectArray JNICALL Java_org_eclipse_core_internal_net_proxy_unix_UnixProxyProvider_getGConfNonProxyHosts( >+ JNIEnv *env, jclass clazz) { >+ >+ if (client == NULL) { >+ gconfInit(env); >+ } >+ >+ GSList *npHosts; >+ int size; >+ >+ npHosts = gconf_client_get_list(client, "/system/http_proxy/ignore_hosts", >+ GCONF_VALUE_STRING, NULL); >+ size = g_slist_length(npHosts); >+ >+ // TODO - I'm not sure this is really valid, it's from the JVM implementation >+ // of ProxySelector >+ if (size == 0) { >+ npHosts = gconf_client_get_list(client, "/system/proxy/no_proxy_for", >+ GCONF_VALUE_STRING, NULL); >+ } >+ size = g_slist_length(npHosts); >+ >+ jobjectArray ret = (*env)->NewObjectArray(env, size, stringClass, NULL); >+ >+ ListProcContext lpc; >+ lpc.env = env; >+ lpc.npHostArray = ret; >+ lpc.index = 0; >+ >+ g_slist_foreach(npHosts, listProc, &lpc); >+ return ret; >+} >+ >Index: natives/unix/GetProxyEnv/makefile >=================================================================== >RCS file: natives/unix/GetProxyEnv/makefile >diff -N natives/unix/GetProxyEnv/makefile >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ natives/unix/GetProxyEnv/makefile 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,43 @@ >+################################################################################ >+# Automatically-generated file. Do not edit! >+################################################################################ >+ >+-include ../makefile.init >+ >+RM := rm -rf >+ >+# All of the sources participating in the build are defined here >+-include sources.mk >+-include subdir.mk >+-include objects.mk >+ >+ifneq ($(MAKECMDGOALS),clean) >+ifneq ($(strip $(C_DEPS)),) >+-include $(C_DEPS) >+endif >+endif >+ >+-include ../makefile.defs >+ >+# Add inputs and outputs from these tool invocations to the build variables >+ >+# All Target >+all: libproxyenv.so >+ >+# Tool invocations >+libproxyenv.so: $(OBJS) $(USER_OBJS) >+ @echo 'Building target: $@' >+ @echo 'Invoking: GCC C Linker' >+ gcc -m32 -shared -o"libproxyenv.so" $(OBJS) $(USER_OBJS) $(LIBS) >+ @echo 'Finished building target: $@' >+ @echo ' ' >+ >+# Other Targets >+clean: >+ -$(RM) $(OBJS)$(C_DEPS)$(LIBRARIES) libproxyenv.so >+ -@echo ' ' >+ >+.PHONY: all clean dependents >+.SECONDARY: >+ >+-include ../makefile.targets >Index: natives/unix/GetProxyGnome/objects.mk >=================================================================== >RCS file: natives/unix/GetProxyGnome/objects.mk >diff -N natives/unix/GetProxyGnome/objects.mk >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ natives/unix/GetProxyGnome/objects.mk 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,7 @@ >+################################################################################ >+# Automatically-generated file. Do not edit! >+################################################################################ >+ >+USER_OBJS := >+ >+LIBS := -lgconf-2 -lORBit-2 -lgthread-2.0 -lrt -lgobject-2.0 -lglib-2.0 >Index: natives/unix/GetProxyGnome/sources.mk >=================================================================== >RCS file: natives/unix/GetProxyGnome/sources.mk >diff -N natives/unix/GetProxyGnome/sources.mk >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ natives/unix/GetProxyGnome/sources.mk 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,17 @@ >+################################################################################ >+# Automatically-generated file. Do not edit! >+################################################################################ >+ >+O_SRCS := >+C_SRCS := >+S_SRCS := >+OBJ_SRCS := >+ASM_SRCS := >+OBJS := >+C_DEPS := >+LIBRARIES := >+ >+# Every subdirectory with source files must be described here >+SUBDIRS := \ >+. \ >+ >Index: natives/unix/GetProxyEnv/getproxyenv.d >=================================================================== >RCS file: natives/unix/GetProxyEnv/getproxyenv.d >diff -N natives/unix/GetProxyEnv/getproxyenv.d >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ natives/unix/GetProxyEnv/getproxyenv.d 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,1 @@ >+getproxyenv.d getproxyenv.o: ../getproxyenv.c >Index: natives/unix/GetProxyGnome/getproxygnome.d >=================================================================== >RCS file: natives/unix/GetProxyGnome/getproxygnome.d >diff -N natives/unix/GetProxyGnome/getproxygnome.d >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ natives/unix/GetProxyGnome/getproxygnome.d 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,226 @@ >+getproxygnome.d getproxygnome.o: ../getproxygnome.c \ >+ /usr/include/glib-2.0/glib.h /usr/include/glib-2.0/glib/galloca.h \ >+ /usr/include/glib-2.0/glib/gtypes.h \ >+ /usr/lib/glib-2.0/include/glibconfig.h \ >+ /usr/include/glib-2.0/glib/gmacros.h \ >+ /usr/include/glib-2.0/glib/garray.h \ >+ /usr/include/glib-2.0/glib/gasyncqueue.h \ >+ /usr/include/glib-2.0/glib/gthread.h \ >+ /usr/include/glib-2.0/glib/gerror.h /usr/include/glib-2.0/glib/gquark.h \ >+ /usr/include/glib-2.0/glib/gutils.h \ >+ /usr/include/glib-2.0/glib/gatomic.h \ >+ /usr/include/glib-2.0/glib/gbacktrace.h \ >+ /usr/include/glib-2.0/glib/gbase64.h \ >+ /usr/include/glib-2.0/glib/gbookmarkfile.h \ >+ /usr/include/glib-2.0/glib/gcache.h /usr/include/glib-2.0/glib/glist.h \ >+ /usr/include/glib-2.0/glib/gmem.h /usr/include/glib-2.0/glib/gslice.h \ >+ /usr/include/glib-2.0/glib/gcompletion.h \ >+ /usr/include/glib-2.0/glib/gconvert.h \ >+ /usr/include/glib-2.0/glib/gdataset.h \ >+ /usr/include/glib-2.0/glib/gdate.h /usr/include/glib-2.0/glib/gdir.h \ >+ /usr/include/glib-2.0/glib/gfileutils.h \ >+ /usr/include/glib-2.0/glib/ghash.h /usr/include/glib-2.0/glib/ghook.h \ >+ /usr/include/glib-2.0/glib/giochannel.h \ >+ /usr/include/glib-2.0/glib/gmain.h /usr/include/glib-2.0/glib/gslist.h \ >+ /usr/include/glib-2.0/glib/gstring.h \ >+ /usr/include/glib-2.0/glib/gunicode.h \ >+ /usr/include/glib-2.0/glib/gkeyfile.h \ >+ /usr/include/glib-2.0/glib/gmappedfile.h \ >+ /usr/include/glib-2.0/glib/gmarkup.h \ >+ /usr/include/glib-2.0/glib/gmessages.h \ >+ /usr/include/glib-2.0/glib/gnode.h /usr/include/glib-2.0/glib/goption.h \ >+ /usr/include/glib-2.0/glib/gpattern.h \ >+ /usr/include/glib-2.0/glib/gprimes.h \ >+ /usr/include/glib-2.0/glib/gqsort.h /usr/include/glib-2.0/glib/gqueue.h \ >+ /usr/include/glib-2.0/glib/grand.h /usr/include/glib-2.0/glib/grel.h \ >+ /usr/include/glib-2.0/glib/gregex.h \ >+ /usr/include/glib-2.0/glib/gscanner.h \ >+ /usr/include/glib-2.0/glib/gsequence.h \ >+ /usr/include/glib-2.0/glib/gshell.h /usr/include/glib-2.0/glib/gspawn.h \ >+ /usr/include/glib-2.0/glib/gstrfuncs.h \ >+ /usr/include/glib-2.0/glib/gthreadpool.h \ >+ /usr/include/glib-2.0/glib/gtimer.h /usr/include/glib-2.0/glib/gtree.h \ >+ /usr/include/gconf/2/gconf/gconf-value.h \ >+ /usr/include/gconf/2/gconf/gconf-error.h \ >+ /usr/include/gconf/2/gconf/gconf-client.h \ >+ /usr/include/glib-2.0/glib-object.h \ >+ /usr/include/glib-2.0/gobject/gboxed.h \ >+ /usr/include/glib-2.0/gobject/gtype.h \ >+ /usr/include/glib-2.0/gobject/genums.h \ >+ /usr/include/glib-2.0/gobject/gobject.h \ >+ /usr/include/glib-2.0/gobject/gvalue.h \ >+ /usr/include/glib-2.0/gobject/gparam.h \ >+ /usr/include/glib-2.0/gobject/gclosure.h \ >+ /usr/include/glib-2.0/gobject/gsignal.h \ >+ /usr/include/glib-2.0/gobject/gmarshal.h \ >+ /usr/include/glib-2.0/gobject/gparamspecs.h \ >+ /usr/include/glib-2.0/gobject/gsourceclosure.h \ >+ /usr/include/glib-2.0/gobject/gtypemodule.h \ >+ /usr/include/glib-2.0/gobject/gtypeplugin.h \ >+ /usr/include/glib-2.0/gobject/gvaluearray.h \ >+ /usr/include/glib-2.0/gobject/gvaluetypes.h \ >+ /usr/include/gconf/2/gconf/gconf.h \ >+ /usr/include/gconf/2/gconf/gconf-schema.h \ >+ /usr/include/gconf/2/gconf/gconf-engine.h \ >+ /usr/include/gconf/2/gconf/gconf-error.h \ >+ /usr/include/gconf/2/gconf/gconf-enum-types.h \ >+ /usr/include/gconf/2/gconf/gconf-listeners.h \ >+ /usr/include/gconf/2/gconf/gconf-changeset.h >+ >+/usr/include/glib-2.0/glib.h: >+ >+/usr/include/glib-2.0/glib/galloca.h: >+ >+/usr/include/glib-2.0/glib/gtypes.h: >+ >+/usr/lib/glib-2.0/include/glibconfig.h: >+ >+/usr/include/glib-2.0/glib/gmacros.h: >+ >+/usr/include/glib-2.0/glib/garray.h: >+ >+/usr/include/glib-2.0/glib/gasyncqueue.h: >+ >+/usr/include/glib-2.0/glib/gthread.h: >+ >+/usr/include/glib-2.0/glib/gerror.h: >+ >+/usr/include/glib-2.0/glib/gquark.h: >+ >+/usr/include/glib-2.0/glib/gutils.h: >+ >+/usr/include/glib-2.0/glib/gatomic.h: >+ >+/usr/include/glib-2.0/glib/gbacktrace.h: >+ >+/usr/include/glib-2.0/glib/gbase64.h: >+ >+/usr/include/glib-2.0/glib/gbookmarkfile.h: >+ >+/usr/include/glib-2.0/glib/gcache.h: >+ >+/usr/include/glib-2.0/glib/glist.h: >+ >+/usr/include/glib-2.0/glib/gmem.h: >+ >+/usr/include/glib-2.0/glib/gslice.h: >+ >+/usr/include/glib-2.0/glib/gcompletion.h: >+ >+/usr/include/glib-2.0/glib/gconvert.h: >+ >+/usr/include/glib-2.0/glib/gdataset.h: >+ >+/usr/include/glib-2.0/glib/gdate.h: >+ >+/usr/include/glib-2.0/glib/gdir.h: >+ >+/usr/include/glib-2.0/glib/gfileutils.h: >+ >+/usr/include/glib-2.0/glib/ghash.h: >+ >+/usr/include/glib-2.0/glib/ghook.h: >+ >+/usr/include/glib-2.0/glib/giochannel.h: >+ >+/usr/include/glib-2.0/glib/gmain.h: >+ >+/usr/include/glib-2.0/glib/gslist.h: >+ >+/usr/include/glib-2.0/glib/gstring.h: >+ >+/usr/include/glib-2.0/glib/gunicode.h: >+ >+/usr/include/glib-2.0/glib/gkeyfile.h: >+ >+/usr/include/glib-2.0/glib/gmappedfile.h: >+ >+/usr/include/glib-2.0/glib/gmarkup.h: >+ >+/usr/include/glib-2.0/glib/gmessages.h: >+ >+/usr/include/glib-2.0/glib/gnode.h: >+ >+/usr/include/glib-2.0/glib/goption.h: >+ >+/usr/include/glib-2.0/glib/gpattern.h: >+ >+/usr/include/glib-2.0/glib/gprimes.h: >+ >+/usr/include/glib-2.0/glib/gqsort.h: >+ >+/usr/include/glib-2.0/glib/gqueue.h: >+ >+/usr/include/glib-2.0/glib/grand.h: >+ >+/usr/include/glib-2.0/glib/grel.h: >+ >+/usr/include/glib-2.0/glib/gregex.h: >+ >+/usr/include/glib-2.0/glib/gscanner.h: >+ >+/usr/include/glib-2.0/glib/gsequence.h: >+ >+/usr/include/glib-2.0/glib/gshell.h: >+ >+/usr/include/glib-2.0/glib/gspawn.h: >+ >+/usr/include/glib-2.0/glib/gstrfuncs.h: >+ >+/usr/include/glib-2.0/glib/gthreadpool.h: >+ >+/usr/include/glib-2.0/glib/gtimer.h: >+ >+/usr/include/glib-2.0/glib/gtree.h: >+ >+/usr/include/gconf/2/gconf/gconf-value.h: >+ >+/usr/include/gconf/2/gconf/gconf-error.h: >+ >+/usr/include/gconf/2/gconf/gconf-client.h: >+ >+/usr/include/glib-2.0/glib-object.h: >+ >+/usr/include/glib-2.0/gobject/gboxed.h: >+ >+/usr/include/glib-2.0/gobject/gtype.h: >+ >+/usr/include/glib-2.0/gobject/genums.h: >+ >+/usr/include/glib-2.0/gobject/gobject.h: >+ >+/usr/include/glib-2.0/gobject/gvalue.h: >+ >+/usr/include/glib-2.0/gobject/gparam.h: >+ >+/usr/include/glib-2.0/gobject/gclosure.h: >+ >+/usr/include/glib-2.0/gobject/gsignal.h: >+ >+/usr/include/glib-2.0/gobject/gmarshal.h: >+ >+/usr/include/glib-2.0/gobject/gparamspecs.h: >+ >+/usr/include/glib-2.0/gobject/gsourceclosure.h: >+ >+/usr/include/glib-2.0/gobject/gtypemodule.h: >+ >+/usr/include/glib-2.0/gobject/gtypeplugin.h: >+ >+/usr/include/glib-2.0/gobject/gvaluearray.h: >+ >+/usr/include/glib-2.0/gobject/gvaluetypes.h: >+ >+/usr/include/gconf/2/gconf/gconf.h: >+ >+/usr/include/gconf/2/gconf/gconf-schema.h: >+ >+/usr/include/gconf/2/gconf/gconf-engine.h: >+ >+/usr/include/gconf/2/gconf/gconf-error.h: >+ >+/usr/include/gconf/2/gconf/gconf-enum-types.h: >+ >+/usr/include/gconf/2/gconf/gconf-listeners.h: >+ >+/usr/include/gconf/2/gconf/gconf-changeset.h: >Index: natives/unix/GetProxyGnome/subdir.mk >=================================================================== >RCS file: natives/unix/GetProxyGnome/subdir.mk >diff -N natives/unix/GetProxyGnome/subdir.mk >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ natives/unix/GetProxyGnome/subdir.mk 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,24 @@ >+################################################################################ >+# Automatically-generated file. Do not edit! >+################################################################################ >+ >+# Add inputs and outputs from these tool invocations to the build variables >+C_SRCS += \ >+../getproxygnome.c >+ >+OBJS += \ >+./getproxygnome.o >+ >+C_DEPS += \ >+./getproxygnome.d >+ >+ >+# Each subdirectory must supply rules for building sources it contributes >+%.o: ../%.c >+ @echo 'Building file: $<' >+ @echo 'Invoking: GCC C Compiler' >+ gcc -I/usr/include/gconf/2 -I/usr/include/orbit-2.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include/ -O0 -fPIC -g3 -Wall -c -fmessage-length=0 -m32 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" >+ @echo 'Finished building: $<' >+ @echo ' ' >+ >+ >Index: natives/unix/GetProxyEnv/objects.mk >=================================================================== >RCS file: natives/unix/GetProxyEnv/objects.mk >diff -N natives/unix/GetProxyEnv/objects.mk >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ natives/unix/GetProxyEnv/objects.mk 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,7 @@ >+################################################################################ >+# Automatically-generated file. Do not edit! >+################################################################################ >+ >+USER_OBJS := >+ >+LIBS := -lrt >Index: fragments/org.eclipse.core.net.linux.x86/BUILD_INFO.txt >=================================================================== >RCS file: fragments/org.eclipse.core.net.linux.x86/BUILD_INFO.txt >diff -N fragments/org.eclipse.core.net.linux.x86/BUILD_INFO.txt >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ fragments/org.eclipse.core.net.linux.x86/BUILD_INFO.txt 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,10 @@ >+Native Build Info: >+------------------ >+ >+platform: linux.gtk.x86 >+built by: Francis Upton, francisu@ieee.org >+build date: 24-Apr-2008 >+OS Name: Fedora 8 >+OS Version: Linux 2.6.24.4-64.fc8 >+Compiler version: gcc (GCC) 4.1.2 20070925 (Red Hat 4.1.2-33) >+Java version: Standard Edition 1.6.0_04 >Index: natives/unix/GetProxyEnv/sources.mk >=================================================================== >RCS file: natives/unix/GetProxyEnv/sources.mk >diff -N natives/unix/GetProxyEnv/sources.mk >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ natives/unix/GetProxyEnv/sources.mk 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,17 @@ >+################################################################################ >+# Automatically-generated file. Do not edit! >+################################################################################ >+ >+O_SRCS := >+C_SRCS := >+S_SRCS := >+OBJ_SRCS := >+ASM_SRCS := >+OBJS := >+C_DEPS := >+LIBRARIES := >+ >+# Every subdirectory with source files must be described here >+SUBDIRS := \ >+. \ >+ >Index: natives/unix/GetProxyEnv/subdir.mk >=================================================================== >RCS file: natives/unix/GetProxyEnv/subdir.mk >diff -N natives/unix/GetProxyEnv/subdir.mk >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ natives/unix/GetProxyEnv/subdir.mk 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,24 @@ >+################################################################################ >+# Automatically-generated file. Do not edit! >+################################################################################ >+ >+# Add inputs and outputs from these tool invocations to the build variables >+C_SRCS += \ >+../getproxyenv.c >+ >+OBJS += \ >+./getproxyenv.o >+ >+C_DEPS += \ >+./getproxyenv.d >+ >+ >+# Each subdirectory must supply rules for building sources it contributes >+%.o: ../%.c >+ @echo 'Building file: $<' >+ @echo 'Invoking: GCC C Compiler' >+ gcc -O0 -fPIC -g3 -Wall -c -fmessage-length=0 -m32 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" >+ @echo 'Finished building: $<' >+ @echo ' ' >+ >+
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 226462
:
96832
|
96833
|
96835
|
96991
|
97178
|
97179
|
97399
|
97400
|
97566
|
97567
|
97582