NSURLCache ignores byte range request headers

Originator:marcus.kida
Number:rdar://20001985 Date Originated:02.03.2015
Status:Open Resolved:
Product:OS X Product Version:10.10
Classification:Serious Bug Reproducible:Always
 
Summary:
When doing HTTP requests using range headers e.g. "Range: bytes=0-65535", if the request is successful (206, partial content) it's response get's cached. When performing a second request for the rest of the data e.g. "Range: bytes=65536-" the first chunk will be returned by NSURLCache, effectively the user will end up with malformed data. When having a server which sends request id's in the response header, this can be tracked down easily.

Steps to Reproduce:
1. Make http range request to a server which supports byte range requests, e.g. Amazon S3.
2. Make a second request with a different range.
3. The second response yields the the same results like the first response due to NSURLCache ignoring the byte range headers

Expected Results:
NSURLCache should check for the byte range headers and only return the specific range and, if necessary, request the new range from the server if it has not been yet cached

Actual Results:
When doing a second http range request for a different range, the wrong response is returned if a previous request to the same request (even with a different range) has been made

Version:
OS X 10.10, Xcode 6.1.1 (6A2008a)

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!