Repository navigation
Commit b596e8b
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 894408e commit b596e8b
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 | |
|---|---|---|---|
| |||
1789 | 1789 | | |
1790 | 1790 | | |
1791 | 1791 | | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
1792 | 1817 | | |
1793 | 1818 | | |
1794 | 1819 | | |
| |||
1811 | 1836 | | |
1812 | 1837 | | |
1813 | 1838 | | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
1814 | 1859 | | |
1815 | 1860 | | |
1816 | 1861 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1164 | 1164 | | |
1165 | 1165 | | |
1166 | 1166 | | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
1167 | 1174 | | |
1168 | | - | |
1169 | | - | |
1170 | | - | |
| 1175 | + | |
1171 | 1176 | | |
1172 | 1177 | | |
1173 | 1178 | | |
| |||
1189 | 1194 | | |
1190 | 1195 | | |
1191 | 1196 | | |
1192 | | - | |
1193 | | - | |
| 1197 | + | |
1194 | 1198 | | |
1195 | 1199 | | |
1196 | 1200 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
0 commit comments