Inconsistent Handling of Invalid Urls
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 76
- Avg merge
- 8h 59m
- Merged PRs (30d)
- 24
Description
Originally opened by
@cancan101on 2021-09-01 14:33:54 in encode/httpx
If I call: httpx.get('https://😇'), an InvalidURL exception is raised. However, if I call: httpx.get('https:/google.com'), instead I get an UnsupportedProtocol exception, which seems inconsistent. I would expect the latter to raise an InvalidURL as well. For reference, requests raises a InvalidURL in both cases.
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 by reproducing the two calls shown in the issue: httpx.get('https://😇') and httpx.get('https:/google.com'), then trace the URL and protocol validation entry points that handle them. Done means both invalid URLs raise InvalidURL, with tests covering these cases and the existing behavior preserved for valid URLs.
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
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100