Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error status Code 416 #64

Open
vuongfunny opened this issue Nov 6, 2015 · 3 comments
Open

Error status Code 416 #64

vuongfunny opened this issue Nov 6, 2015 · 3 comments

Comments

@vuongfunny
Copy link

I can't download with url from a file of Google Drive. Can you help me ?
Error Domain=com.thibaultcha.tcblobdownload Code=1 "Erroneous HTTP status code 416 (requested range not satisfiable)" UserInfo={NSLocalizedDescription=Erroneous HTTP status code 416 (requested range not satisfiable), TCBlobDownloadErrorHTTPStatusKey=416}

@thibaultcha
Copy link
Owner

See #31 for more details on the 416 response code and what TCBlobDownload does with the Range header.

@crespoxiao
Copy link

@thibaultcha so this problem hasn't been fixed ,right ? maybe the server has some problem.

@jpoag
Copy link

jpoag commented Oct 25, 2017

I was able to reproduce this error by initializing two (simultaneous) downloads of the same file. This resulted in both downloaders filling the same file on disk (file size is exactly twice the expected size).

Without the user handling the download error by deleting the cache file it will continue to always hit this corrupted file with the wrong size and continuously ask the server for the wrong range.

Also, sometimes the server file will change (such as with Facebook profile image) and the new file will be smaller than old file, also causing 416.

Proposed remedy: Direct the user to always move or remove the download file in the complete handler. Also, don't attempt to download the same file concurrently.

complete:^(BOOL downloadFinished, NSString* pathToFile){
  if(downloadFinished){
    [[NSFileManager defaultManager] removeItemAtPath:theNSLocalPath error:NULL]; // in case is directory
    [[NSFileManager defaultManager] moveItemAtPath:pathToFile toPath:theNSLocalPath error:NULL]; // move to user location
  }
  else{
    [[NSFileManager defaultManager] removeItemAtPath:pathToFile error:NULL]; // remove corrupted download
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants