]> git.ipfire.org Git - pakfire.git/commitdiff
Add support for http proxies.
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 3 Aug 2011 21:42:00 +0000 (23:42 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 3 Aug 2011 21:42:00 +0000 (23:42 +0200)
examples/pakfire.conf
pakfire/downloader.py
pakfire/repository/remote.py
po/pakfire.pot

index 79e1a8f7e1b7540b3858305cfd2f01601ea95b65..6e1b5e54ec54aff311f834dc199af142378a9b4e 100644 (file)
@@ -5,6 +5,13 @@
 
 logfile = /var/log/pakfire.log
 
+# Pakfire can use a HTTP proxy for all downloads.
+# Authentication can be used like this:
+#   http://foo:bar@192.168.180.1:800
+# If no proxy setting is configured, Pakfire will
+# use the environment settings.
+# http_proxy = http://192.168.180.1:800
+
 # You can throttle the download bandwidth with this
 # parameter. Unit: bytes per second.
 # bandwidth_throttle = 10240
index b5d61d02774a79189092167773b8a63d411e1c87..7369ddb394f0bddb90fac77a80680d9f605337fc 100644 (file)
@@ -14,15 +14,13 @@ class PakfireGrabber(URLGrabber):
        """
                Class to make some modifications on the urlgrabber configuration.
        """
-       # XXX add proxy, throttle things here
-
        def __init__(self, pakfire, *args, **kwargs):
                kwargs.update({
                        "quote" : 0,
                        "user_agent" : "pakfire/%s" % PAKFIRE_VERSION,
                })
 
-               # Get Pakfire configuration
+               # Set throttle setting.
                bandwidth_throttle = pakfire.config.get("bandwidth_throttle")
                if bandwidth_throttle:
                        try:
@@ -33,6 +31,11 @@ class PakfireGrabber(URLGrabber):
 
                        kwargs.update({ "throttle" : bandwidth_throttle })
 
+               # Configure HTTP proxy.
+               http_proxy = pakfire.config.get("http_proxy")
+               if http_proxy:
+                       kwargs.update({ "proxies" : { "http" : http_proxy }})
+
                URLGrabber.__init__(self, *args, **kwargs)
 
 
index 4805b2ecaa49e68b7a4c8e7ee68af85dc775a24e..09fd7c5afa18b4da1e16ad3abc324e2f160902f0 100644 (file)
@@ -86,6 +86,7 @@ class RepositorySolv(base.RepositoryFactory):
 
                        # Get a package grabber and add mirror download capabilities to it.
                        grabber = downloader.PackageDownloader(
+                               self.pakfire,
                                text=text + os.path.basename(filename),
                        )
                        grabber = self.mirrors.group(grabber)
index 7ef03bc774962eaa5727d0d5b6d7a1852da38986..dadf0239b441e2a67313ce396f11dfaebf9b0c21 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-08-03 23:16+0200\n"
+"POT-Creation-Date: 2011-08-03 23:34+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"