Check if the response returned a correct status code

The current implementation of ```download``` first performs an HEAD requests and then if everything went fine it gets the file. However it could happen that at the second request (GET) the status code is different from the first request (HEAD), so it's better to check it again.