From: John W Higgins Date: 2009-07-15T14:48:06+09:00 Subject: Re: Can we stop internal redirects --0016e64b9ada4b35d5046eb81941 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Tue, Jul 14, 2009 at 10:17 PM, Newbie Newbie wrote: > 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 --0016e64b9ada4b35d5046eb81941--