Can we stop internal redirects

N

Newbie Newbie

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
 
J

John W Higgins

[Note: parts of this message were removed to make it a legal post.]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top