how to get the http header in asynchronous request mode using ASIHHTTP

Posted by user262325 on Stack Overflow See other posts from Stack Overflow or by user262325
Published on 2010-04-14T01:14:40Z Indexed on 2010/04/14 1:43 UTC
Read the original article Hit count: 396

Filed under:

Hello everyone

I hope to display the download file size by reading http header.

I know there is way do this:

ASIHTTPRequest request = [ASIHTTPRequest requestWithURL:url];
[request startSynchronous]; NSString poweredBy = [[request responseHeaders] objectForKey:@"X-Powered-By"];
NSString *contentType = [[request responseHeaders] objectForKey:@"Content-Type"];

but this is Synchronous mode, in Asynchronous mode it can be done as below:

(void)requestFinished:(ASIHTTPRequest *)request { unsigned long long contentLength = [request contentLength]; }

but 'requestFinished' is at the end of download. Is there an event to get the http header info at the beginning of download?

Thank

interdev

© Stack Overflow or respective owner

Related posts about iphone