pegasy / python-ntlm

Automatically exported from code.google.com/p/python-ntlm
0 stars 0 forks source link

handler doesn't verify www-authenticate exists #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm at trying to authenticate with a server that uses NTLM.  However it
doesn't set the www-authenticate header.  The handler assumes this value
exists and tries set it to lower.  Since the server doesn't return that
header, python throws an exception about None not having a lower method.

Traceback (most recent call last):
  File "nyquist_scrape.py", line 24, in <module>
    response = urllib2.urlopen(url)
  File "/usr/lib/python2.5/urllib2.py", line 124, in urlopen
    return _opener.open(url, data)
  File "/usr/lib/python2.5/urllib2.py", line 387, in open
    response = meth(req, response)
  File "/usr/lib/python2.5/urllib2.py", line 498, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.5/urllib2.py", line 419, in error
    result = self._call_chain(*args)
  File "/usr/lib/python2.5/urllib2.py", line 360, in _call_chain
    result = func(*args)
  File "/home/nickte/test/moderation/ntlm/HTTPNtlmAuthHandler.py", line 92,
in http_error_401
    return self.http_error_authentication_required('www-authenticate', req,
fp, headers)
  File "/home/nickte/test/moderation/ntlm/HTTPNtlmAuthHandler.py", line 30,
in http_error_authentication_required
    if 'ntlm' in auth_header_value.lower():
AttributeError: 'NoneType' object has no attribute 'lower'

Original issue reported on code.google.com by j.nick.terry@gmail.com on 15 Jul 2009 at 9:38

GoogleCodeExporter commented 9 years ago

Original comment by Matthijs.Mullender on 16 Jul 2009 at 6:42