[issue2695] Ignore case when checking algorithm in urllib2

2008-04-26 Thread david reid

New submission from david reid <[EMAIL PROTECTED]>:

Small change to allow get_algorithm_impls to correctly detect when lower
case algorithm strings are passed. I recently ran into a server that
sent 'md5' and so this function failed without this small change.

def get_algorithm_impls(self, algorithm):
# lambdas assume digest modules are imported at the top level
if algorithm.lower() == 'md5':
H = lambda x: hashlib.md5(x).hexdigest()
elif algorithm.lower() == 'sha':
H = lambda x: hashlib.sha1(x).hexdigest()
...

--
components: Library (Lib)
messages: 65836
nosy: zathras
severity: normal
status: open
title: Ignore case when checking algorithm in urllib2
type: behavior
versions: Python 2.5

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2695>
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2695] Ignore case when checking algorithm in urllib2

2008-05-02 Thread david reid

david reid <[EMAIL PROTECTED]> added the comment:

The patch is inline. There's not much to it :-)

Agree with your suggestion to avoid calling lower() twice.

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2695>
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2695] Ignore case when checking algorithm in urllib2

2008-05-04 Thread david reid

david reid <[EMAIL PROTECTED]> added the comment:

Looks like a sensible, simple fix to me :-)

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2695>
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2756] urllib2 add_header fails with existing unredirected_header

2008-05-04 Thread david reid

New submission from david reid <[EMAIL PROTECTED]>:

In urllib2 when using reusing a Request calling add_header doesn't work
when an unredirected_header has been added. 

A good example (and the one that caught me out) is content-type. When
making a POST request with no content-type set the current code sets the
content-type as an unredirected_header to
'application/x-www-form-urlencoded' (line 1034 of urllib2.py) but in a
subsequent request, setting the content type via add_header will see
this ignored as unredirected_headers are appended after the headers.

A possible solution is to check whether the header being added already
exists in the requests undredirected_headers and remove it if it does.

--
components: Library (Lib)
messages: 66213
nosy: zathras
severity: normal
status: open
title: urllib2 add_header fails with existing unredirected_header
type: behavior
versions: Python 2.5

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2756>
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1368312] fix for scheme identification in urllib2?

2008-05-04 Thread david reid

david reid <[EMAIL PROTECTED]> added the comment:

I've run into this as an issue with a server that replies with both
digest and basic auth.

When parsing the keys in the header it's possible to detect the start of
a different auth method, so I'd suggest parsing the www-authenticate
line and returning a dict for each type of auth containing the
appropriate key,value pairs.

This approach should allow every auth type to be catered for.

--
nosy: +zathras

_
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1368312>
_
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com