Skip navigation.
 
mlRe: Newbie: problem with NSURL?
FROM : Becky Willrich
DATE : Mon Apr 05 19:22:20 2004

As others have commented, the server probably isn't bothering to gzip
small quantities of data.  You can confirm this absolutely, though, by
taking a packet dump.  There are products like EtherPeek available that
let you look at the packets in a more readable form, but I've always
found the simplest way is to execute the following as root from a
shell:

/usr/sbin/tcpdump -i en0 -s 0 -X host <host you are contacting>

This will dump all packets exchanged between your host and the remote
server in hex, with the ASCII equivalents shown in a column to the
right.  You'll be able to examine the outgoing HTTP headers, as well as
the HTTP response sent back by the server.  You will see that NSURL is
sending an Accept-Encoding: gzip header (this is the known NSURL bug;
it's sending this Accept-Encoding header without being prepared to
process returned gzip'ed content), and I think you will see that for
content larger than 1001 characters, the server is sending back a
Content-Encoding: gzip header.

Best workaround is to use NSURLRequest & NSURLConnection instead. 
CFNetwork is nearly as good unless you need cookies, authentication, or
caching support - these are all add-on features that NSURLConnection
provides above and beyond CFNetwork.  If you can rely on the server
always gzip'ing, you can also choose to unzip yourself on the receiving
end.

Hope that helps,
REW

_______________________________________________
MacOSX-dev mailing list
<email_removed>
http://www.omnigroup.com/mailman/listinfo/macosx-dev

Related mailsAuthorDate
mlNewbie: problem with NSURL? Philippe de Rocham… Apr 3, 20:10
mlRe: Newbie: problem with NSURL? Jon Gotow Apr 4, 05:12
mlRe: Newbie: problem with NSURL? Philippe de Rocham… Apr 4, 11:02
mlRe: Newbie: problem with NSURL? Howard Jones Apr 4, 12:30
mlRe: Newbie: problem with NSURL? Philippe de Rocham… Apr 4, 15:25
mlRe: Newbie: problem with NSURL? Mark Meyer Apr 4, 19:08
mlRe: Newbie: problem with NSURL? Shawn Erickson Apr 4, 19:10
mlRe: Newbie: problem with NSURL? Becky Willrich Apr 5, 19:22