HTTPDigestAuth fails on non-latin credentials
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 54.3k
- Forks
- 10.4k
- Avg merge
- 16h 43m
- Merged PRs (30d)
- 3
Description
There was issue reported, which is closed with bad results.
Don't pass unicode strings in the arguments, but use UTF8 bytes instead.
self.session.get(main_url, auth=requests.auth.HTTPDigestAuth("Сергей_Ласточкин".encode('UTF-8'), '1234'))
Originally posted by @D-stefaang in https://github.com/psf/requests/issues/5089#issuecomment-763569911
But this is wrong! When i try to set user 'Ondřej' with this advice, requests send bad string:
HTTPDigestAuth('Ondřej'.encode('utf-8'), 'heslíčko')
creates header starts with wrong username!
Digest username="b'Ond\xc5\x99ej'"
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in requests/auth.py around the linked lines 59-63 and reproduce the HTTPDigestAuth calls using “Ondřej” and the Cyrillic username. Inspect how credentials are converted while constructing the Digest header; done means the header contains the intended username rather than a bytes representation, with regression coverage for the reported cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100