tags:

views:

120

answers:

2

Hello everyone

One of my project is to download several large size files using ASIHTTPRequest in asynchronous mode. I hope to read the http returned header info to get the size of files. I know [request respsonseHeaders] (requestFinished: delegate method ) can do that. I tested and found that requestFinished: is only triggered when it completed the download of a whole single file. But I hope to access the function [request respsonseHeaders] before ASIHTTPRequest starting to download files (just when ASIHTTPRequest got the returned header info).

I can not find the triggered event for this.

Welcome any comment

Thanks

interdev

A: 

You might look at the -handleBytesAvailable method. It's a callback method that reads data that streams in. You might also look at the -readResponseHeaders method, where the header is processed.

Alex Reynolds
A: 

A new delegate method was recently added to ASIHTTPRequest for this purpose:

- (void)requestReceivedResponseHeaders:(ASIHTTPRequest *)request
{
    NSLog(@"%@",[request responseHeaders]);
}

You can have the request call a different method on your delegate by setting didReceiveResponseHeadersSelector.

pokeb