PuerkitoBio / purell

tiny Go library to normalize URLs
BSD 3-Clause "New" or "Revised" License
473 stars 58 forks source link

NormalizeURL does not perform IDNA normalization #27

Open eliaslevy opened 5 years ago

eliaslevy commented 5 years ago

IDNA normalization is only performed in NormalizeURLString, but that function returns a string. If you need a url.URL, you must then parse the result of NormalizeURLString, which means you are parsing the URL yet again, which is wasteful.

As NormalizeURLString calls NormalizeURL, the IDNA normalization in the former should be moved to the later, resulting in the URL passed to NormalizeURL having its host field IDNA normalized.

mna commented 5 years ago

Hello Elias,

I think you're right, makes sense to me. I don't plan on working on purell in the near future, but happy to assist getting a PR merged that would address this.

Thanks, Martin