Can we stop internal redirects

Hi,
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?

Thanks

On Tue, Jul 14, 2009 at 10:17 PM, Newbie Newbie
[email protected]ain.invalidwrote:

Hi,
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
times
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
at
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
the
original and redirect uri’s within the function for you).

John

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs