Submitted By:            Igor Živković <contact@igor-zivkovic.from.hr>
Date:                    2014-01-13
Initial Package Version: 1.3.6
Upstream Status:         Fixed
Origin:                  Upstream
Description:             Fixes running with Twisted >= 13.1

diff -Naur deluge-1.3.6.orig/deluge/httpdownloader.py deluge-1.3.6/deluge/httpdownloader.py
--- deluge-1.3.6.orig/deluge/httpdownloader.py	2013-02-25 18:01:07.000000000 +0100
+++ deluge-1.3.6/deluge/httpdownloader.py	2014-01-13 21:54:17.155043954 +0100
@@ -192,7 +192,17 @@
             headers = {}
         headers["accept-encoding"] = "deflate, gzip, x-gzip"
 
-    scheme, host, port, path = client._parse(url)
+    # 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
+
     factory = HTTPDownloader(url, filename, callback, headers, force_filename, allow_compression)
     if scheme == "https":
         from twisted.internet import ssl
