Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

TorgoX (1933)

TorgoX
  sburkeNO@SPAMcpan.org
http://search.cpan.org/~sburke/

"Il est beau comme la retractilité des serres des oiseaux rapaces [...] et surtout, comme la rencontre fortuite sur une table de dissection d'une machine à coudre et d'un parapluie !" -- Lautréamont

Journal of TorgoX (1933)

Wednesday February 13, 2002
12:54 PM

Cookie monster

[ #2838 ]
Dear Log,

I never cease to be amazed at how as simple a protocol as HTTP requires such complex code to implement correctly, and even how hard it is to decide what "correctly" means. Last night I was rooting around in LWP/UserAgent.pm trying to fix a problem that was basically this: This one web site needs certain cookies which it uses for a session ID. But if the session ID is old enough, it wants to change the cookies. So you access page X, it sees you have an old session ID, it HTTP-redirects you to page Y, the response to which is just setting a new cookie and HTTP-redirecting you to page X, which this time succeeds. LWP/UserAgent.pm thinks that's a loop, and won't obey the redirection from page Y, because why would you want to hit a URL that you were just redirected away from? So I have to add code that implements the idea that Oh, but THIS time you'll have a different cookie, so it'll be probably be okay! Sheer lunacy. But necessary.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • It seems like the loop detection code is just to simplistic.

    Instead of balking at X, Y, X, how about making it smart enough to detect something like:

    X, (...), X, $1, X

    if you get my drift.

    If you hit the same full series of pages twice in a row and _then_ ended up where you started, that sounds like a more sure loop.