-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
gh-128192: support HTTP sha-256 digest authentication as per RFC-7617 #128193
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
Changes from all commits
eb7fe23
06cd409
1d9d1af
aea1b4e
5c21402
10b25ad
fa80be1
3c2ac12
d9e3c44
47c0148
28866f9
7f9dc2f
9292180
2e2367d
5381ff4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1962,10 +1962,29 @@ def test_parse_proxy(self): | |
|
|
||
| self.assertRaises(ValueError, _parse_proxy, 'file:/ftp.example.com'), | ||
|
|
||
| def test_unsupported_algorithm(self): | ||
| handler = AbstractDigestAuthHandler() | ||
|
|
||
| class TestDigestAlgorithms(unittest.TestCase): | ||
| def setUp(self): | ||
| self.handler = AbstractDigestAuthHandler() | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In a follow-up PR (or this one), if you want/can, we can add tests for a full communication round where we request HTTP digest authentication. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yep, next time! |
||
|
|
||
| def test_md5_algorithm(self): | ||
| H, KD = self.handler.get_algorithm_impls('MD5') | ||
| self.assertEqual(H("foo"), "acbd18db4cc2f85cedef654fccc4a4d8") | ||
| self.assertEqual(KD("foo", "bar"), "4e99e8c12de7e01535248d2bac85e732") | ||
|
|
||
| def test_sha_algorithm(self): | ||
| H, KD = self.handler.get_algorithm_impls('SHA') | ||
| self.assertEqual(H("foo"), "0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33") | ||
| self.assertEqual(KD("foo", "bar"), "54dcbe67d21d5eb39493d46d89ae1f412d3bd6de") | ||
|
|
||
| def test_sha256_algorithm(self): | ||
| H, KD = self.handler.get_algorithm_impls('SHA-256') | ||
| self.assertEqual(H("foo"), "2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae") | ||
| self.assertEqual(KD("foo", "bar"), "a765a8beaa9d561d4c5cbed29d8f4e30870297fdfa9cb7d6e9848a95fec9f937") | ||
|
|
||
| def test_invalid_algorithm(self): | ||
| with self.assertRaises(ValueError) as exc: | ||
| handler.get_algorithm_impls('invalid') | ||
| self.handler.get_algorithm_impls('invalid') | ||
| self.assertEqual( | ||
| str(exc.exception), | ||
| "Unsupported digest authentication algorithm 'invalid'" | ||
|
|
||
calvinbui marked this conversation as resolved.
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Upgrade HTTP digest authentication algorithm for :mod:`urllib.request` by | ||
| supporting SHA-256 digest authentication as specified in :rfc:`7616`. |
Uh oh!
There was an error while loading. Please reload this page.