Throw more specific exceptions
Remove TODO -- if your url scheme contains %-encoded bytes, you'll get what's coming to you.