AFHTTPRequestOperation _totalBytesRead is Before or After deflating?

46 views Asked by At

I am connecting to my own web service that I believe is sending back a gzipped response which is decompressed under the hood by the AF Networking library. I have verified that my server is sending the data compressed when the accept encoding gzip header is present and I have verified that the library is sending this header.

However the _totalBytesRead value is the total amount of bytes after decompression. Is this because this value is after decompressing or that I am not actually getting compressed data? If the former what is the surest way to confirm on the iOS side that I am getting the data compressed?

Code below:

NSString *absolutePath = @"http://example.com/webservice";

NSMutableURLRequest * request = [self requestWithMethod:@"GET" path:absolutePath parameters:nil];

AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc]  initWithRequest:request];

operation.outputStream = [NSOutputStream outputStreamToFileAtPath:tempFilePath append:NO];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
  //_totalBytesRead here equals size of uncompressed file/data
}
1

There are 1 answers

0
David Berger On BEST ANSWER

Try installing Charles and following the instruction on Proxying an iOS device

http://www.charlesproxy.com/documentation/faqs/using-charles-from-an-iphone/

You will get the info you need and more.