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

URLs with IP address as host aren't valid #76

Open
dentarg opened this issue Jan 20, 2016 · 5 comments
Open

URLs with IP address as host aren't valid #76

dentarg opened this issue Jan 20, 2016 · 5 comments

Comments

@dentarg
Copy link
Collaborator

dentarg commented Jan 20, 2016

[7] pry(main)> Twingly::URL.parse("http://127.0.0.1:57029").valid?
=> false

I think they should be valid, they are perfectly valid URLs and I think we want to use URLs like that when we test in our projects... and if the project use twingly-url, it will reject our valid test URLs :-(

They are not valid because of our PublicSuffix demands:

[11] pry(main)> PublicSuffix.parse("http://127.0.0.1:57029")
PublicSuffix::DomainInvalid: `http://127.0.0.1:57029' is not a valid domain
from /Users/dentarg/.gem/ruby/2.2.3/gems/public_suffix-1.5.3/lib/public_suffix.rb:62:in `parse'
@dentarg dentarg added the bug label Jan 20, 2016
@dentarg
Copy link
Collaborator Author

dentarg commented Jan 20, 2016

Somewhat related to #52 (and possibly others)

@dentarg
Copy link
Collaborator Author

dentarg commented Sep 14, 2016

In #90 we learned how to extend the PSL, I guess it should be possible to write a PublicSuffix rule that allow IP addresses. :-)

@dentarg
Copy link
Collaborator Author

dentarg commented Jun 22, 2017

Or, if we identify the input as an IP address, we could skip the PSL step in that case.

@dentarg
Copy link
Collaborator Author

dentarg commented Jun 22, 2017

IPAddr could probably be used.

@dentarg
Copy link
Collaborator Author

dentarg commented Jun 10, 2018

https://github.com/knu/ruby-domain_name

host = DomainName("[::1]")  # IP addresses like "192.168.1.1" and "::1" are also acceptable
host.ipaddr?        #=> true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant