1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Fixed retrieving the content type for Python 2.4.

This commit is contained in:
Jannis Leidel 2010-08-31 13:05:10 +02:00
parent 37aa31c9f9
commit 20da952052

View file

@ -485,10 +485,10 @@ class HTMLPage(object):
req = Urllib2HeadRequest(url, headers={'Host': netloc})
resp = urlopen(req)
try:
if resp.code != 200 and scheme not in ('ftp', 'ftps'):
if hasattr(resp, 'code') and resp.code != 200 and scheme not in ('ftp', 'ftps'):
## FIXME: doesn't handle redirects
return ''
return resp.info().getheader('Content-Type') or ''
return resp.info().get('content-type', '')
finally:
resp.close()