Prune whitespace
Encode and retry invalid URLs