[dhm] Improve _VALID_URL and add test