Skip to content

Commit

Permalink
HTTPResponse .lower() the domain, not internal_links() works on an al…
Browse files Browse the repository at this point in the history
…l caps domain
  • Loading branch information
matthewrobertbell committed Jan 24, 2012
1 parent 00feff2 commit 1e9f99a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions web.py
Expand Up @@ -151,10 +151,10 @@ def __init__(self, response=None, url=None, fake=False, http=None):
if fake:
self.original_url = url
self.final_url = url
self._domain = urlparse.urlparse(url).netloc
self._domain = urlparse.urlparse(url).netloc.lower()
self._data = '<html><body><p>Hello!</p></body></html>'
else:
self._domain = urlparse.urlparse(url).netloc
self._domain = urlparse.urlparse(url).netloc.lower()
self.headers = response.info()
compressed_data = response.read()
if filter(lambda (k,v): k.lower() == 'content-encoding' and v.lower() == 'gzip', self.headers.items()):
Expand Down Expand Up @@ -241,7 +241,7 @@ def single_xpath(self,expression):
return ''

def internal_links(self):
return {link for link in self.xpath('//a/@href') if urlparse.urlparse(link).netloc == self._domain}
return {link for link in self.xpath('//a/@href') if urlparse.urlparse(link).netloc.lower() == self._domain}

def external_links(self,exclude_subdomains=True):
if exclude_subdomains:
Expand Down

0 comments on commit 1e9f99a

Please sign in to comment.