Ensure that the whole file was downloaded.

On unstable connections, a ACK/FIN packet might be fired in the middle of the download.
To get around this, we compare the content-length (if present) to the total number of downloaded bytes.

Check https://github.com/joyent/node/issues/6143 for more information.

Fixes #792 #824 and probably #830.