Merge lp:~allsymes/software-center/http_proxy into lp:software-center

Proposed by Luke Symes
Status: Merged
Merged at revision: not available
Proposed branch: lp:~allsymes/software-center/http_proxy
Merge into: lp:software-center
Diff against target: 37 lines (+12/-2)
2 files modified
softwarecenter/backend/aptd.py (+6/-1)
softwarecenter/view/widgets/imagedialog.py (+6/-1)
To merge this branch: bzr merge lp:~allsymes/software-center/http_proxy
Reviewer Review Type Date Requested Status
Michael Vogt Approve
Review via email: mp+14575@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Luke Symes (allsymes) wrote :

Enables proxy authentication for those who need it, specifically for downloading packages and screenshots.

Revision history for this message
Michael Vogt (mvo) wrote :

Merged (with minor adjustments)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/backend/aptd.py'
2--- softwarecenter/backend/aptd.py 2009-11-04 09:51:35 +0000
3+++ softwarecenter/backend/aptd.py 2009-11-07 02:55:18 +0000
4@@ -168,7 +168,12 @@
5 if client.get_bool("/system/http_proxy/use_http_proxy"):
6 host = client.get_string("/system/http_proxy/host")
7 port = client.get_int("/system/http_proxy/port")
8- transaction.set_http_proxy("http://%s:%s/" % (host, port))
9+ authentication = ""
10+ if client.get_bool("/system/http_proxy/use_authentication"):
11+ user = client.get_string("/system/http_proxy/authentication_user")
12+ password = client.get_string("/system/http_proxy/authentication_password")
13+ authentication = "%s:%s@" % (user, password)
14+ transaction.set_http_proxy("http://%s%s:%s/" % (authentication, host, port))
15 except:
16 logging.exception("gconf http proxy failed")
17
18
19=== modified file 'softwarecenter/view/widgets/imagedialog.py'
20--- softwarecenter/view/widgets/imagedialog.py 2009-10-15 16:07:37 +0000
21+++ softwarecenter/view/widgets/imagedialog.py 2009-11-07 02:55:18 +0000
22@@ -40,9 +40,14 @@
23 client = gconf.client_get_default()
24 if client.get_bool("/system/http_proxy/use_http_proxy"):
25 try:
26+ authentication = ""
27+ if client.get_bool("/system/http_proxy/use_authentication"):
28+ user = client.get_string("/system/http_proxy/authentication_user")
29+ password = client.get_string("/system/http_proxy/authentication_password")
30+ authentication = "%s:%s@" % (user, password)
31 host = client.get_string("/system/http_proxy/host")
32 port = client.get_int("/system/http_proxy/port")
33- proxies = { "http" : "http://%s:%s/" % (host, port) }
34+ proxies = { "http" : "http://%s%s:%s/" % (authentication, host, port) }
35 except GError, e:
36 pass
37 urllib.FancyURLopener.__init__(self, proxies)