- Python Home
- About
- News
- Documentation
- Downloads
- Community
- Foundation
- Developer's Guide
- Issue Tracker
- Issues
- Summaries
- User
- Administration
- Help
Issue2695
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2008-04-26 08:47 by zathras, last changed 2022-04-11 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| case_insensitive_algorithm.patch | BitTorment, 2008-05-04 13:20 | Proposed patch | ||
| Messages (6) | |||
|---|---|---|---|
| msg65836 - (view) | Author: david reid (zathras) | Date: 2008-04-26 08:47 | |
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()
...
|
|||
| msg66114 - (view) | Author: Terry J. Reedy (terry.reedy) * ![]() |
Date: 2008-05-02 21:37 | |
Function is about 2/3rds down in urllib2. Note 1: hashlib checks upper and lower case versions of names. So this seems like reasonable request. Note 2: I would start hashlib.__get_builtin_constructor(name): with 'name = name.lower()' and replace first two 'name in' constructions with 'name ==' and shrink 2nd two lists. Note 3. I would do same with get_algorithm_impls(): algorithm = algorithm.lower() Instead of possibly calling .lower twice. Note 4: I consider 'name = lambda ...' inferior to 'def name...' but I am not the one who will edit this. Keyword says patch, but I do not see one. |
|||
| msg66115 - (view) | Author: david reid (zathras) | Date: 2008-05-02 21:44 | |
The patch is inline. There's not much to it :-) Agree with your suggestion to avoid calling lower() twice. |
|||
| msg66207 - (view) | Author: Martin McNickle (BitTorment) | Date: 2008-05-04 13:20 | |
RFC2617 says that the authentication scheme should be case insensitive. Included is a patch which changes the string to uppercase before comparison. |
|||
| msg66212 - (view) | Author: david reid (zathras) | Date: 2008-05-04 15:00 | |
Looks like a sensible, simple fix to me :-) |
|||
| msg66243 - (view) | Author: Georg Brandl (georg.brandl) * ![]() |
Date: 2008-05-04 21:40 | |
Applied in r62713. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:56:33 | admin | set | github: 46947 |
| 2008-05-04 21:40:52 | georg.brandl | set | status: open -> closed resolution: accepted messages: + msg66243 nosy: + georg.brandl |
| 2008-05-04 15:00:59 | zathras | set | messages: + msg66212 |
| 2008-05-04 13:20:56 | BitTorment | set | files:
+ case_insensitive_algorithm.patch keywords: + patch messages: + msg66207 nosy: + BitTorment |
| 2008-05-02 21:44:06 | zathras | set | messages: + msg66115 |
| 2008-05-02 21:37:46 | terry.reedy | set | messages: + msg66114 |
| 2008-05-02 21:34:40 | terry.reedy | set | messages: - msg66113 |
| 2008-05-02 21:34:32 | terry.reedy | set | messages: - msg66110 |
| 2008-05-02 21:32:21 | terry.reedy | set | messages: + msg66113 |
| 2008-05-02 21:07:49 | terry.reedy | set | nosy:
+ terry.reedy messages: + msg66110 |
| 2008-04-26 08:47:17 | zathras | create | |


