• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSURLConnection and resumes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSURLConnection and resumes


  • Subject: Re: NSURLConnection and resumes
  • From: Frederick Cheung <email@hidden>
  • Date: Thu, 7 Oct 2004 08:32:57 +0100


On 7 Oct 2004, at 04:10, Rudi Sherry wrote:

If the server accepts byte-range requests you could add a Range header to the request; here's a sample:

[ URLRequest setValue: @"bytes=100032-433566" forHTTPHeaderField: @"Range" ];

.. assuming you know how large the file is. The first number is the byte offset from the beginning of the file and the second number is the last byte offset that you'll receive (remember that it's inclusive, so the last byte index is one less than the length of the file).

If the server allows byte-range requests, you'll probably get a multi-part message with one part; if the server doesn't support them, you'll get the entire file.

You can also specify the range "bytes=123123-" to indicate that you wish that you want to start at the specified offset and continue to the end of the file. The ability to resume may be indicated via an Accept-Ranges: bytes header (or explicitly denied with Accept-Ranges: none)
The rfc says that servers must not send multi-part message unless that client has indicated that it can receive it. (a range request with multiple parts implies this, eg bytes=123-567,789-1234), although I have on rare occasions seen software that does.
One should check the Content-Range header to verify that the server has complied with the request. I have also seen servers who refuse to use a Range header when there is not an If-Range header

Fred

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >NSURLConnection and resumes (From: John Stiles <email@hidden>)
 >Re: NSURLConnection and resumes (From: Rudi Sherry <email@hidden>)

  • Prev by Date: Re: Binding/KVC : valueForKey: and NSDictionary (was: valid accessor for framework objects. (was: implicit and explicit invocation of description method))
  • Next by Date: Crypt/Decrypt NSData
  • Previous by thread: How to "reset" Finder state
  • Next by thread: Using KQueue events to watch files
  • Index(es):
    • Date
    • Thread