I want to see the tcp communication when I make a http POST to a url.

What I am looking for is, if they send a redirect during the tcp handshake.

How can I test for this?

e.g. I make a http post to www.example.com/1/2 and then the server responds with a redirect to www10.example.com/1/2

I have to sent a http post, and the posted value has to be an xml document. (I have a sample xml file on disk that I can send if the utility allows this).


Use either tcpdump (a command-line utility) or wireshark (a GUI tool).

Wireshark is somewhat easier to use, it will capture all traffic from your network interface. You'd start a capture with wireshark, then go to your browser and do the transaction you want to do, then back in wireshark you just need to identify an http packet (they're clearly marked as such in the capture), right-click and select "follow tcp stream". This will show you the whole conversation including http headers, which should in turn include the redirects.

Tcpdump in essence does the same: it intercepts network traffic and lets you look at it, but since (AFAIK) it has no knowledge of specific protocols, it's up to you to make sense of the captured traffic.

One other option is for you to install the Live HTTP headers extension for Firefox. When you enable it, it will capture the request as sent by your browser, any responses sent by the server including redirects. It's potentially easier to use than Wireshark but it's limited to showing you headers from the browser.

| improve this answer | |
  • Great answer. Live HTTP headers will show 302 redirects, but doesn't show TCP handshakes, so if you're looking for a reset flag, stick to tcpdump. sudo tcpdump -ni eth0 host would capture on screen all packets from your eth0 interface to www.askubuntu.com for example. Write tcpdump output to a file with -w <filename>, then open the file in Wireshark for GUI analysis. – Scaine Jan 22 '12 at 8:45

Tcpdump is well known command line network analyzer, it will dump traffic on a network. However, you need good understanding of TCP/IP protocol to utilize this tool.

You can get further details from the link

| improve this answer | |

I believe that for something simple like a HTTP redirect you can use wget but for anything more complex than that you'll want to use tcpdump

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.