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

Blows up on .dev (for Pow web server) #11

Open
coreyward opened this issue Apr 14, 2011 · 3 comments
Open

Blows up on .dev (for Pow web server) #11

coreyward opened this issue Apr 14, 2011 · 3 comments

Comments

@coreyward
Copy link

Obviously this isn't a legitimate TLD, but it's in use thanks to the Pow rack server by 37 Signals. It might make sense to add support for it, or at least not throw an error when it is used with parse:

>> Domainatrix.parse('http://google.com/')
=> #<Domainatrix::Url:0x00000104a196b8 @scheme="http", @host="google.com", @url="http://google.com/", @public_suffix="com", @domain="google", @subdomain="", @path="/">
>> Domainatrix.parse('http://google.dev/')
NoMethodError: undefined method `has_key?' for nil:NilClass
  from [...]/whiny_nil.rb:48:in `method_missing'
  from [...]/domainatrix-0.0.10/lib/domainatrix/domain_parser.rb:59:in `block in parse_domains_from_host'
  from [...]/domain_parser.rb:54:in `each_index'
  from [...]/domain_parser.rb:54:in `parse_domains_from_host'
  from [...]/domain_parser.rb:40:in `parse'
@pauldix
Copy link
Owner

pauldix commented Apr 14, 2011

yeah, I think some additional error handling is probably best. If it sees something it can't parse, throw an exception for that. I don't think adding .dev is a good idea since it's not a legit tld.

@coreyward
Copy link
Author

A way of adding custom TLDs would be appreciated, too…

# for example:
Domainatrix.recognize_tld '.dev'

Then I could easily configure my app to recognize it, without putting unofficial TLDs in the gem.

@ayn
Copy link

ayn commented May 10, 2011

You can do this:

Domainatrix::DOMAIN_PARSER.public_suffixes.merge!("dev"=>{}) unless Rails.env.production?

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

3 participants