steipete/AFDownloadRequestOperation — pull request #34 by hankbao (2013-06-12 11:42:52+00:00)
Title: Make sure we don't write to output stream if any error occurs.

Hi, @steipete. I found a problem in AFDownloadRequestOperation.

If remote server returns an error e.g. 404 with a error page, the content of that page will be written to the output stream. When resuming a partial downloading, this kind of error corrupts the file.

IMO, if the intention is to download a file, saving an error page to the file system would be useless anyway. So I fixed it by check the status code & content type before writing anything to the stream.