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

Validations: localhost as a valid url #105

Closed
vaughankg opened this issue Sep 10, 2014 · 10 comments
Closed

Validations: localhost as a valid url #105

vaughankg opened this issue Sep 10, 2014 · 10 comments

Comments

@vaughankg
Copy link
Contributor

rmq.validation.valid?("http://localhost", :url) #=> false

Is this a desired behavior?

Thanks all for creating rmq :)

@willrax
Copy link
Contributor

willrax commented Sep 10, 2014

I don't think the regex would consider http://localhost a legitimate url. You would need a .tld on the end of it.

@GantMan
Copy link
Member

GantMan commented Sep 10, 2014

Hrmmmm, I agree it's not really a valid URL. But I also see how it can be an issue. Consider the following suggestions for something we should add: What would be best for RMQ users?

# this would be the quick fix, to add some simple shotcircuit
rmq.validation.valid?("http://localhost", :url, localhost: true) #=> true 

# Then again... this would be interesting
rmq.validation.valid?("http://localhost", :url, white_list: ["http://localhost", "https://localhost"]) #=> true

# but then maybe whitelist should be for ANY validation?
rmq.validation.valid?("ZERO", :number, white_list: ["ZERO"]) #=> true

thoughts?

@willrax
Copy link
Contributor

willrax commented Sep 10, 2014

Whitelist, whitelist, whitelist! I like the white list idea.

@vaughankg
Copy link
Contributor Author

The white_list is definitely nice and flexible although in this case I'd really want to validate localhost + any port number -- which would be impractical.

@twerth
Copy link
Member

twerth commented Sep 10, 2014

+1 on white_list

@willrax
Copy link
Contributor

willrax commented Sep 10, 2014

Is this just while in development or is it something you'll be deploying? Would this help: #106 ?

@vaughankg
Copy link
Contributor Author

@willrax It's something that I'll be deploying, where the user gets to specify an API end point to hit. A custom validation as per #106 definitely solves for my use case.

@GantMan
Copy link
Member

GantMan commented Sep 10, 2014

added the white_list feature. We'll attack the custom regex feature next (maybe tomorrow) 👍 ❓

GantMan added a commit that referenced this issue Sep 10, 2014
Sep14 white list validation discussed in #105
@GantMan
Copy link
Member

GantMan commented Sep 10, 2014

@GantMan
Copy link
Member

GantMan commented Sep 11, 2014

closed via #107, #108, #109

@GantMan GantMan closed this as completed Sep 11, 2014
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

4 participants