From: Mike F. <mik...@ho...> - 2005-03-01 13:03:30
|
Hi, Is there a quick workaround to this problem? And should I submit it as a bug? A redirect (302) occurs in a frame. It specifies a relative location, but HtmlUnit is truncating the address, causing the website to respond with the whole frameset. When autoredirect is on, this causes an infinite loop! I never get past webClient.getPage(url) and the log fills up with: 22:33:15,132 (HttpMethodDirector:780) INFO [main] - Redirect requested but followRedirects is disabled 22:33:17,059 (HttpMethodDirector:780) INFO [main] - Redirect requested but followRedirects is disabled etc, etc, etc. My code: final WebClient webClient = new WebClient(BrowserVersion.INTERNET_EXPLORER_6_0); webClient.setRedirectEnabled(true); final URL url = new URL("http://somewhere.com/main/"); final HtmlPage page = (HtmlPage) webClient.getPage(url); The response is 200 OK and this: <html> <head> <title>somewhere.com</title> <meta http-equiv="Content-Type" content="text/html"> </head> <frameset rows="0,*" frameborder="NO" border="0" framespacing="0"> <frame src="blank.php" name="stealthFrame" scrolling="NO" noresize > <frame src="front.php" name="frontFrame"> </frameset> <noframes> <body> </body></noframes> </html> but front.php returns 302 Found, with location: ?choice=first , which should cause this: GET /main/front.php?choice=first but instead HtmlUnit does this: GET /main/?choice=first which the website responds to by sending the first page again. Instant loop. Is there a quick workaround? How do you code to handle a redirect manually? Regards, Mike _________________________________________________________________ Dont just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/ |