python-validators / validators

Python Data Validation for Humans™.
MIT License
977 stars 155 forks source link

Minor fix for hostname with underscores #207

Closed K3VRAL closed 2 years ago

K3VRAL commented 2 years ago

Hello! I've noticed that I had some errors when getting a URL with a hostname that has an underscore, so I thought of finding and making some changes to the code such that URLs with an underscore in the hostname will now be valid, example: https://_this_is_an.example.com

I was unable to test with the testing folder of the project, mainly because I don't really know how either because there is no documentation or I am looking in the wrong areas, or I lack experience with python testing with how this project is structured. I did use my own method of testing (using grep and the -P argument) and the results worked in the favor I was intending for, so hopefully it works in the code as well.

I was also inspired that this issue has already been hinted at but not fixed.

Closes #102 Closes #180 Maybe closes #38 And maybe something should happen to #179

K3VRAL commented 2 years ago

One issue I currently am seeing right now and might need some time to be processed before anything should happen is that subdomains don't get the correct treatment with the underscores, such as: https://_this._is._an.example.com

I'll need to do more testing before doing anything with this pull request.

h4knet commented 2 years ago

I confirm I have the same problem. I was about to open an issue.. Thanks !