Wednesday, October 24, 2007

Sniffing your request-response data (how does server redirect?)

At first I was curious what are the data sent by the server to redirect the browser to the next page.

My first try is to use wireshark (it was ethereal before renamed to wireshark), unfortunately localhost traffic doesn't get sniffed. Then I try to install Microsoft loopback adapter, then again... wireshark doesn't detect the loopback adapter. I was thinking wireshark can do almost anything for me, unfortunately it didn't (or is it because of the os limitation? dunno).

Looking up for tools, then I remembered back then I used Grinder as a proxy. Going to grinder's site, downloading the latest version (3.x), setting it up, it works! However (again), the output isn't exactly what I need.
Going for the previous version of Grinder (2.x), got it, set it up, works like charm :) I analyze the data and here's what I found.

------ localhost:8080->localhost:4632 ------

HTTP/1.1 302 Moved Temporarily
Server: Apache-Coyote/1.1
Location: http://localhost:8001/loadtracker/form/project-select.shtml?cid=1&clr=true
Content-Length: 0
Date: Wed, 24 Oct 2007 05:09:27 GMT


Interesting! HTTP/1.1 302 is the answer.

I've heard that IE 7 doesn't redirect to the new location, my first guess maybe this was the cause :

If the 302 status code is received in response to a request other than GET or HEAD, the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued.



But it said that the request is a GET/HEAD and mine is POST (after login). Probably it is the security setting in IE that blocks it, not replicated in my IE.. yet.

Anyway, I'm not talking about IE here, Grinder will be quite handy for everyone who want to investigate the request-response data. FYI, having read some comments about Grinder 3, it could be an interesting tools for load testing, replacing JMeter.

No comments: