Closed mafonso closed 9 years ago
Thanks for reporting!
Two things regarding your patch:
\w+
by a "catch all" .*
, a [\w-]+
would be much desirableYou're right. The "catch al"l was a bit of a lazy aproach just to get me running. And it would match other possible chars that could envetualy also be present, like an underscore. Your aproach is safer.
For compleness it turns out that by at RFC 1123 (that extends RFC 952) states that the hostname has to begin with letter or digit folowed by letter digit or hyphen and end in letter or digit. No other chars are valid.
Something like [\w]+[\w-]?[\w]+
if you don't want go on pedantic mode about length restrictions.
That's even better!
Would you mind updating your commit with this new approach and adding some tests?
If you really don't feel like writing tests that's fine too.
@hangaspt ping :)
@hangaspt ping :)
PR #11 did exactly the same as here, so closing. Reopen if you feel like it.
Fixed issue that caused an entry with an hostname containing '-' (such as server-01) to result in an invalid line.