Binary Lion Studios

I code for fun and for food.

NSURLConnection view raw request

If you want to view the raw request that NSURLConnection is making, you can use the tcpdump command line tool that is bundled with OSX.

1
$ sudo tcpdump -l -q -A "host (Specified Host) and tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)"

Two (semi) obvious notes:

  • Replace (Specified Host) in the command above with your host (ie: binarylionstudios.com).
  • You cannot use this method to view SSL traffic (port 443).

Stolen directly from: http://www.benzado.com/blog/post/317/dont-printf-when-you-can-tcpdump