I just spent a lot of time studying the same problem. It turned out that in iOS6, the request was first made with HEAD to examine the headers, which is not abnormal.
However, it seems that the response headers from the actual GET request are ignored. As a result, if your server did not support HEAD or did not return 0 content lengths for a HEAD request for a given URL, iOS NSURLConnection will use the wrong information.
My problem was that my user server did not support HEAD requests for uploaded files and instead returned 405 (HTTP Error 405 is not allowed), which in its own response contained the length of the content that iOS6 then used to return the expected TotalBytes, and not correct from the GET answer.
To fix my problem, I first turned on HEAD for file upload requests, and then returned the correct content length. Confirmed by:
curl -v -I http://url ... < Content-Length: 23493947 Content-Length: 23493947
Not sure if this is a bug in iOS6 or just better compliance with HTTP standards. Hope that helps others.
source share