16
16
# You should have received a copy of the GNU General Public License
17
17
# along with Checkbox. If not, see <http://www.gnu.org/licenses/>.
19
from checkbox.lib.environ import add_variable
19
from checkbox.lib.environ import add_variable, get_variable
21
21
from checkbox.properties import String
22
22
from checkbox.plugin import Plugin
35
35
self._manager.reactor.call_on("gather", self.gather, -1000)
39
add_variable("http_proxy", self.http_proxy)
42
add_variable("https_proxy", self.https_proxy)
38
# Config has lowest precedence
39
http_proxy = self.http_proxy
40
https_proxy = self.https_proxy
42
# Gconf has higher precedence
43
gconf = self._manager.registry.gconf
44
if gconf.system.http_proxy.use_http_proxy:
45
if gconf.system.http_proxy.use_authentication:
46
http_proxy = "http://%s:%s@%s:%s" % (
47
gconf.system.http_proxy.authentication_user,
48
gconf.system.http_proxy.authentication_password,
49
gconf.system.http_proxy.host,
50
gconf.system.http_proxy.port)
51
elif gconf.system.http_proxy.host:
52
http_proxy = "http://%s:%s" % (
53
gconf.system.http_proxy.host,
54
gconf.system.http_proxy.port)
56
if gconf.system.http_proxy.use_same_proxy:
57
https_proxy = http_proxy
58
elif gconf.system.proxy.secure_host:
59
https_proxy = "https://%s:%s" % (
60
gconf.system.proxy.secure_host,
61
gconf.system.proxy.secure_port)
63
# Environment has highest precedence
64
http_proxy = get_variable("http_proxy", http_proxy)
65
https_proxy = get_variable("https_proxy", https_proxy)
67
add_variable("http_proxy", http_proxy)
68
add_variable("https_proxy", https_proxy)
45
71
factory = ProxyInfo