Deluge, httpdownloader.py, twisted > 13.1.0, patch

George Amanakis g_amanakis at yahoo.com
Fri May 9 07:36:34 UTC 2014


The following bug exists on the port of Deluge:
Enabling the Blocklist plugin and attempting to download a list fails. The scenario was tested with deluged running as daemon on FreeBSD (built from ports) and a remote GTK-Interface on Windows (official prebuild-binaries) or on Archlinux (through the official repo). Culprit is the httpdownloader.py has not been updated to work with twisted > 13.1.0.

The following patch resolves the problem:

--- httpdownloader.py.org       2014-05-08 23:36:46.000000000 +0200
+++ httpdownloader.py   2014-05-09 00:05:43.000000000 +0200
@@ -191,8 +191,18 @@
         if not headers:
             headers = {}
         headers["accept-encoding"] = "deflate, gzip, x-gzip"
+
+# In twisted 13.1.0 the _parse() function was replaced by the _URI class
+    if hasattr(client, '_parse'):
+       scheme, host, port, path = client._parse(url)
+    else:
+       from twisted.web.client import _URI
+       uri = _URI.fromBytes(url)
+       scheme = uri.scheme
+       host = uri.host
+       port = uri.port
+       path = uri.path

-    scheme, host, port, path = client._parse(url)
     factory = HTTPDownloader(url, filename, callback, headers, force_filename, allow_compression)
     if scheme == "https":
         from twisted.internet import ssl


Greetings to all,
George


More information about the freebsd-ports-bugs mailing list