diff --git a/deluge/httpdownloader.py b/deluge/httpdownloader.py index 4e65d89cb..47d18f26c 100644 --- a/deluge/httpdownloader.py +++ b/deluge/httpdownloader.py @@ -106,6 +106,11 @@ def download_file(url, filename, callback=None, headers=None): :raises t.w.e.Error: for all other HTTP response errors (besides OK) """ url = str(url) + filename = str(filename) + if headers: + for key, value in headers.items(): + headers[str(key)] = str(value) + scheme, host, port, path = client._parse(url) factory = HTTPDownloader(url, filename, callback, headers) if scheme == "https": diff --git a/deluge/plugins/blocklist/blocklist/core.py b/deluge/plugins/blocklist/blocklist/core.py index 523d5635f..264f9f8f0 100644 --- a/deluge/plugins/blocklist/blocklist/core.py +++ b/deluge/plugins/blocklist/blocklist/core.py @@ -229,7 +229,7 @@ class Core(CorePluginBase): headers = {} if self.config["last_update"] and not self.force_download: - headers['If-Modified-Since'] = str(self.config["last_update"]) + headers['If-Modified-Since'] = self.config["last_update"] log.debug("Attempting to download blocklist %s" % url) log.debug("Sending headers: %s" % headers) diff --git a/deluge/ui/web/json_api.py b/deluge/ui/web/json_api.py index 209ae9a59..6ab6258c0 100644 --- a/deluge/ui/web/json_api.py +++ b/deluge/ui/web/json_api.py @@ -459,7 +459,7 @@ class WebApi(JSONComponent): log.debug("filename: %s", tmp_file) headers = {} if cookie: - headers["Cookie"] = str(cookie) + headers["Cookie"] = cookie log.debug("cookie: %s", cookie) return httpdownloader.download_file(url, tmp_file, headers=headers)