[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSData dataWithContentsOfURL



> Is it possible that since 10.3.3 [NSData dataWithContentsOfURL:] 
> returns gzipped content when the server supports it? I never had a 
> problem before but now there is gzipped stuff in my NSData object and 
> I think this is not correct.
>
> Its nice that the framework supports this encoding because it saves 
> some bytes of bandwidth. But how should I know that I need to 
> uncompress it or not. This should be handled by the framework (which 
> is not). I consider this a serious bug, because it breaks alot of 
> existing apps.
>
> Can anyone here confirm this?

Confirmed - on 10.3.3, [NSData dataWithContentsOfURL:] will offer the 
server the choice of gzip encoding, but will not actually unzip the 
transferred data before returning it to the client.  This is an 
unfortunate (and unexpected) change in behavior from 10.2.x.  You can 
workaround by calling +[NSURLConnection 
sendSynchronousRequest:returningResponse:error:] instead; this will 
also offer the server the choice of sending gzip'ed data, but will 
unzip the data before returning it to you if the server sends the data 
zipped.

Sorry for the inconsistency,
REW