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

Fix ip-address parsing for IPv6 addresses #1670

Merged
merged 1 commit into from
Feb 24, 2024
Merged

Conversation

jeffguy
Copy link
Contributor

@jeffguy jeffguy commented Feb 24, 2024

Sometimes, the host string uses IPv6 instead of IPv4, so the address has colons. This can result in a string like

google.com:2607:f8b0:4006:80b::200e

If we then run

subdomain, addr = host.split(":")

host.split(":") returns a list of seven strings because their are six colons. Setting (subdomain, addr) to a list of seven strings doesn't work (ValueError: too many values to unpack (expected 2)). What we really want here is

subdomain, addr = host.split(":", 1)

which splits only on the first colon, so a list of two strings is returned, and the whole IPv6 address gets assigned to the addr variable.

@L1ghtn1ng
Copy link
Collaborator

Thank you for submitting this, much appreciated ☺️

@L1ghtn1ng L1ghtn1ng merged commit b87064f into laramies:master Feb 24, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants