Skip to content

Commit

Permalink
Merge pull request scrapy#878 from andrewshir/master
Browse files Browse the repository at this point in the history
Fix bug for ".local" host name
  • Loading branch information
kmike committed Sep 20, 2014
2 parents a312ebf + e583c03 commit c543fe6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scrapy/http/cookies.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def add_cookie_header(self, request):
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]

Expand Down
6 changes: 6 additions & 0 deletions tests/test_downloadermiddleware_cookies.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

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(
Expand Down

0 comments on commit c543fe6

Please sign in to comment.