Question

As Apple documentation says expectedContentLength of NSURLResponse may not return the value, if the protocol implementations does not report the content length as part of the response. So, is there any alternative to that, like executing javascript on UIWebView, that can return the content length?

Thanks for help.

Was it helpful?

Solution

May be I do not fully understand your problem, but if you want to have a guaranteed size of the content this is not possible because of the HTML protocol. The only way to guarantee it is to fetch the content or stop retrieving content if a certain amount is read. Please bear in mind that you could download pretty much anything, even endless streams.

You might want to go the corresponding rfc sections RFC 2616 section 14.13 and RFC 2616 section 4.4.

Only if the sender and the conditions are met, the size will be transfered but please do not code according to the existence of this information.

Did this answer your question?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top