mirror of
https://github.com/scrapy/scrapy.git
synced 2025-02-26 00:43:41 +00:00
Merge pull request #878 from andrewshir/master
Fix bug for ".local" host name
This commit is contained in:
commit
c543fe6e4c
@ -29,7 +29,7 @@ class CookieJar(object):
|
||||
if not IPV4_RE.search(req_host):
|
||||
hosts = potential_domain_matches(req_host)
|
||||
if req_host.find(".") == -1:
|
||||
hosts += req_host + ".local"
|
||||
hosts += [req_host + ".local"]
|
||||
else:
|
||||
hosts = [req_host]
|
||||
|
||||
|
@ -8,6 +8,12 @@ from scrapy.contrib.downloadermiddleware.cookies import CookiesMiddleware
|
||||
|
||||
class CookiesMiddlewareTest(TestCase):
|
||||
|
||||
def test_local_domain(self):
|
||||
request = Request("http://example-host/", cookies={'currencyCookie': 'USD'})
|
||||
assert self.mw.process_request(request, self.spider) is None
|
||||
assert 'Cookie' in request.headers
|
||||
assert 'currencyCookie' in request.headers['Cookie']
|
||||
|
||||
def assertCookieValEqual(self, first, second, msg=None):
|
||||
cookievaleq = lambda cv: re.split(';\s*', cv)
|
||||
return self.assertEqual(
|
||||
|
Loading…
x
Reference in New Issue
Block a user