Scrapy, a fast high-level web crawling & scraping framework for Python.
py3: fix http10 downloader - unicode host expected here
Konstantin Lopuhinc6f14a39de14
diff --git a/scrapy/core/downloader/handlers/http10.py b/scrapy/core/downloader/handlers/http10.pyindex 11b2acdae..0322bbe49 100644--- a/scrapy/core/downloader/handlers/http10.py+++ b/scrapy/core/downloader/handlers/http10.py@@ -2,6 +2,7 @@"""from twisted.internet import reactorfrom scrapy.utils.misc import load_object+from scrapy.utils.python import to_unicodeclass HTTP10DownloadHandler(object):@@ -17,8 +18,8 @@ class HTTP10DownloadHandler(object):return factory.deferreddef _connect(self, factory):- host, port = factory.host, factory.port- if factory.scheme == 'https':+ host, port = to_unicode(factory.host), factory.port+ if factory.scheme == b'https':return reactor.connectSSL(host, port, factory,self.ClientContextFactory())else:diff --git a/tests/test_downloader_handlers.py b/tests/test_downloader_handlers.pyindex c017a9eb2..780f08806 100644--- a/tests/test_downloader_handlers.py+++ b/tests/test_downloader_handlers.py@@ -223,7 +223,7 @@ class Http11TestCase(HttpTestCase):request = Request(self.getURL('file'))d = self.download_request(request, Spider('foo'))d.addCallback(lambda r: r.body)- d.addCallback(self.assertEquals, "0123456789")+ d.addCallback(self.assertEquals, b"0123456789")return d@defer.inlineCallbacks@@ -234,7 +234,7 @@ class Http11TestCase(HttpTestCase):# response body. (regardless of headers)d = self.download_request(request, Spider('foo', download_maxsize=10))d.addCallback(lambda r: r.body)- d.addCallback(self.assertEquals, "0123456789")+ d.addCallback(self.assertEquals, b"0123456789")yield dd = self.download_request(request, Spider('foo', download_maxsize=9))@@ -257,7 +257,7 @@ class Http11TestCase(HttpTestCase):request = Request(self.getURL('file'))d = self.download_request(request, Spider('foo', download_maxsize=100))d.addCallback(lambda r: r.body)- d.addCallback(self.assertEquals, "0123456789")+ d.addCallback(self.assertEquals, b"0123456789")return d