New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore case when checking algorithm in urllib2 #46947
Comments
Small change to allow get_algorithm_impls to correctly detect when lower 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()
... |
Function is about 2/3rds down in urllib2. Note 1: hashlib checks upper and lower case versions of names. Note 2: I would start hashlib.__get_builtin_constructor(name): Note 3. I would do same with get_algorithm_impls(): Note 4: I consider 'name = lambda ...' inferior to 'def name...' Keyword says patch, but I do not see one. |
The patch is inline. There's not much to it :-) Agree with your suggestion to avoid calling lower() twice. |
RFC2617 says that the authentication scheme should be case insensitive. |
Looks like a sensible, simple fix to me :-) |
Applied in r62713. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: