On Tue, Jul 14, 2009 at 10:17 PM, Newbie Newbie
I have been trying to write a ruby script using a mechanize library.
There is an issue am not able to fix, which is internal re-directs.
My script hits a link and that link re-directs to another link. I would
like to control or stop that internal re-direct. Can this be done using
mechanize or any other library?
3 options depending on exactly what you desire
follow_redirect? = false will turn off all redirects
this patch http://geekchat.ru/node/93 shows how to limit the number of
it will follow a redirect if you are trying to stop some endless loop
use the patch above as the basis to modify the redirect concept to look
the uri to determine if it’s internal or not and stop on an internal (no
code at hand but it would appear pretty straight forward since you have
original and redirect uri’s within the function for you).