Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: LWP::Simple and redirects

by arhuman (Vicar)
on Feb 26, 2002 at 08:05 UTC ( #147504=note: print w/replies, xml ) Need Help??

in reply to LWP::Simple and redirects

Are you GETting the page or POSTing.
If you use POST your problem may come from strict RFC compliance.
From memory :
  • RFC : If you get a 30x on a POST you shouldn't follow the redirection
  • BUT some (most) browsers follow the redirection in such case but GET the redirected page...
Try to play with redirect_ok() ...

"Only Bad Coders Code Badly In Perl" (OBC2BIP)

Replies are listed 'Best First'.
•Re: Re: LWP::Simple and redirects
by merlyn (Sage) on Feb 26, 2002 at 08:47 UTC
Re: LWP::Simple and redirects
by gregorovius (Friar) on Feb 26, 2002 at 16:33 UTC
    Yes. I have written a subclass of LWP::UserAgent that replicates Netscape's behavior (ie. it will follow POST redirects but it will turn them into GETs before doing so). A lot of web applications rely on this non-standard behavior in browsers, making it a de-facto standard, so I think it would be a good idea to integrate such a class to LWP. I have just posted the code for it here

    By the way, overriding redirect_ok() to make UserAgent follow POST redirects is not enough, because redirects won't be converted into GETs, as browsers do. More on the subject at Redirect after POST behavior in LWP::UserAgent differs from Netscape's.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://147504]
[glasswalk3r]: why do you say that?

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2017-03-25 22:00 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (313 votes). Check out past polls.