-
Notifications
You must be signed in to change notification settings - Fork 106
Encode hostname directly instead of netloc #174
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ef9c5c5
Encode hostname directly instead netloc
Laerte 5ed3204
simplify logic
Laerte 23348bd
Attend PR comments
Laerte 17fbd6c
we don't need else
Laerte d8695b7
Add more tests, encode username and password properly
Laerte 9cd7510
run black
Laerte 263455d
empty password test
Laerte a0cb80b
Merge branch 'scrapy:master' into fix/encode-idna-domain-with-port
Laerte 2525ca3
safe_url_string: encode | and % in userinfo
Gallaecio ff8338c
Merge pull request #1 from Gallaecio/174
Laerte File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1104,6 +1104,18 @@ def test_scheme_case_insensitive(self): | |
| result = parse_data_uri("DaTa:,A%20brief%20note") | ||
| self.assertEqual(result.data, b"A brief note") | ||
|
|
||
| def test_safe_url_string_encode_idna_domain_with_port(self): | ||
| self.assertEqual(safe_url_string('http://新华网.中国:80'), | ||
| 'http://xn--xkrr14bows.xn--fiqs8s:80') | ||
|
|
||
| def test_safe_url_string_encode_idna_domain_with_username_password_and_port_number(self): | ||
| self.assertEqual(safe_url_string('ftp://admin:admin@新华网.中国:21'), | ||
| 'ftp://admin:[email protected]:21') | ||
|
|
||
| def test_safe_url_string_encode_idna_domain_with_username_without_password_and_port_number(self): | ||
| self.assertEqual(safe_url_string('ftp://admin:@新华网.中国:21'), | ||
| 'ftp://admin:@xn--xkrr14bows.xn--fiqs8s:21') | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| unittest.main() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.