basho / cuttlefish

never lose your childlike sense of wonder baby cuttlefish, promise me?
Apache License 2.0
205 stars 124 forks source link

Added ip address validation to cuttlefish_datatypes:from_string(String, ip) function. #190

Closed dyp2000 closed 9 years ago

dyp2000 commented 9 years ago

Fixed issue #189

macintux commented 9 years ago

My apologies for the much-too-long delay in looking at this. I think this is a great idea.

I have two concerns, however:

3> cuttlefish_datatypes:from_string("0:127.127.127.127:80", ip).
{"0:127.127.127.127",80}

Because IP is passed to inet but BackwardsIP is used in the return value, the 0: is not validated but is also not dropped.

macintux commented 9 years ago

By the way: if enough time has passed that you'd rather not revisit this, I'm fine making a new PR to address the concerns I raised.

Thanks again.

macintux commented 9 years ago

Also realized this doesn't work properly for IPv6 addresses.

I'm going to close this, but I'm working on the functionality and hope to have a PR soon. Thanks for raising the issue, this is definitely a good idea.

macintux commented 9 years ago

(to clarify, it has problems with collapsed addresses like ::1, or 2001:db8::ff00:42:8329, which we don't currently test for)