Repository navigation
Commit b78dacc
gh-53089: Send uri="/" in Digest auth for URLs with an empty path (GH-161009)
For a URL such as http://example.com, the request selector is empty.
AbstractDigestAuthHandler.get_authorization() used it as-is, sending
uri="" and hashing "GET:" while http.client sends "GET /" on the
request line, so servers rejected the request or failed the digest
check. Normalize an empty selector to '/', as http.client does, for
both the uri field and A2.
Also replace the long-standing "XXX selector: what about proxies and
full urls" note with a comment explaining that the digest-uri is the
request-target as sent (absolute-form through an HTTP proxy), which
RFC 7616 allows, and add a test pinning that behavior.
(cherry picked from commit 663e99d)
Co-authored-by: Senthil Kumaran <senthil@python.org>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 7e6b0c9 commit b78dacc
3 files changed
Lines changed: 59 additions & 5 deletions
File tree
- Lib
- test
- urllib
- Misc/NEWS.d/next/Library
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1772 | 1772 | | |
1773 | 1773 | | |
1774 | 1774 | | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
1775 | 1800 | | |
1776 | 1801 | | |
1777 | 1802 | | |
| |||
1794 | 1819 | | |
1795 | 1820 | | |
1796 | 1821 | | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
1797 | 1842 | | |
1798 | 1843 | | |
1799 | 1844 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1162 | 1162 | | |
1163 | 1163 | | |
1164 | 1164 | | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
1165 | 1172 | | |
1166 | | - | |
1167 | | - | |
1168 | | - | |
| 1173 | + | |
1169 | 1174 | | |
1170 | 1175 | | |
1171 | 1176 | | |
| |||
1187 | 1192 | | |
1188 | 1193 | | |
1189 | 1194 | | |
1190 | | - | |
1191 | | - | |
| 1195 | + | |
1192 | 1196 | | |
1193 | 1197 | | |
1194 | 1198 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
0 commit comments