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

IO::Socket::INET mishandles IPv6 #6342

Open
p6rt opened this issue Jun 10, 2017 · 2 comments
Open

IO::Socket::INET mishandles IPv6 #6342

p6rt opened this issue Jun 10, 2017 · 2 comments

Comments

@p6rt
Copy link

p6rt commented Jun 10, 2017

Migrated from rt.perl.org#131553 (status was 'new')

Searchable as RT131553$

@p6rt
Copy link
Author

p6rt commented Jun 10, 2017

From zengargoyle@gmail.com

$ perl6 -e 'say so IO​::Socket​::INET.new( :host<127.0.0.1>, :port(80));'
True

perl6 -e 'say so IO​::Socket​::INET.new( :host<127.0.0.1>, :port(80) :family(3));'
True

$ perl6 -e 'say so IO​::Socket​::INET.new( :host<​::1>, :port(80) :family(3));'
True

$ perl6 -e 'say so IO​::Socket​::INET.new( :host<​::1>, :port(80));'
Failed to resolve host name
  in block <unit> at -e line 1

The :host<> of IO​::Socket​::INET should be agnostic as to IP protocol version.
When given a hostname (or IPv*) there is no distinction between the versions.
The current behavior will cause mysterious failures and is not consistent.

@Kaiepi
Copy link

Kaiepi commented Feb 19, 2020

This happens because of how IO::Socket::INET attempts to split a port from the hostname of new sockets. Unless PF_INET6 is specified as a family, it will handle IPv6 addresses like IPv4 ones instead. Fixing this would just be a matter of writing up a regex that can handle both, I think.

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

No branches or pull requests

2 participants