Skip to content
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

.with_port() makes a wrong url when contains IPv6 address #451

Closed
j178 opened this issue May 20, 2020 · 0 comments · Fixed by #452
Closed

.with_port() makes a wrong url when contains IPv6 address #451

j178 opened this issue May 20, 2020 · 0 comments · Fixed by #452

Comments

@j178
Copy link
Contributor

j178 commented May 20, 2020

Hi,
I noticed that methods like .with_port(), .with_user() and .with_password() return a wrong IPv6 url, example:

from yarl import URL
url = URL('http://[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:8080/')
print(url.with_port(80))

prints:

http://2001:db8:85a3::8a2e:370:7334:80/

The problem is in this line:

val.username, val.password, val.hostname, port, encode=False

We should use self._make_netloc(..., encode=True) to produce the right url.

@j178 j178 changed the title .with_port() makes a wrong url which contains IPv6 address .with_port() makes a wrong url when contains IPv6 address May 20, 2020
@helpr helpr bot added the pr-available label May 20, 2020
@helpr helpr bot added pr-merged and removed pr-available labels Jul 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant