Oh, I forgot to mention: for testing cookie stuff, browsers are pretty
much useless (with the possible exception of Konqueror, which I have
managed to configure so it tells me about every new cookie *and* about
changes to existing cookies).
My preferred tool nowadays is the attached http_monitor script, which is
a simple HTTP proxy that just prints out salient details from the
request and response. Eg. if I run it like this:
$ http_monitor.py -p 9000
and then configure my browser to use localhost:9000 as an HTTP proxy, I
get a couple of lines of text for every request and response:
--[ new connection from 127.0.0.1:36818 at 15:00:10 ]--------------------
req: GET http://localhost/user/insecure_login HTTP/1.1
req: cookie: mx_userid="gward"; mx_session=""
rsp: 'HTTP/1.1 200 OK\r\n'
rsp: set-cookie: mx_session="20A449C7A053CB5B"; path=/
--[ new connection from 127.0.0.1:36821 at 15:00:14 ]--------------------
req: POST http://localhost/user/insecure_login?/my/ HTTP/1.1
req: cookie: mx_userid="gward"; mx_session="20A449C7A053CB5B"
request content:
_form_id=87AB094715469E0E&user_id=XXXXX&password=XXXXX&login=Sign+In
rsp: 'HTTP/1.1 302 Moved Temporarily\r\n'
--[ new connection from 127.0.0.1:36824 at 15:00:14 ]--------------------
req: GET http://localhost/my/ HTTP/1.1
req: cookie: mx_userid="gward"; mx_session="20A449C7A053CB5B"
rsp: 'HTTP/1.1 200 OK\r\n'
--[ new connection from 127.0.0.1:36827 at 15:00:16 ]--------------------
req: GET http://localhost/user/logout HTTP/1.1
req: cookie: mx_userid="gward"; mx_session="20A449C7A053CB5B"
rsp: 'HTTP/1.1 302 Moved Temporarily\r\n'
rsp: set-cookie: mx_session=""; path=/; max-age=0
This is *really* handy. Alternately, you could use a command-line HTTP
client (like lwp-request from libwww-perl, which is the main reason I
still have Perl installed on my machine ;-). Of course then you have to
be careful to supply the "Cookie" headers for your requests, which is a
pain -- and the reason that I wrote http_monitor!
Greg