[New-bugs-announce] [issue2695] Ignore case when checking algorithm in urllib2

david reid report at bugs.python.org
Sat Apr 26 10:47:18 CEST 2008

New submission from david reid <mail at david-reid.com>:

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 <report at bugs.python.org>

More information about the New-bugs-announce mailing list