Return-Path: Delivered-To: apmail-jakarta-commons-httpclient-dev-archive@www.apache.org Received: (qmail 95914 invoked from network); 28 Feb 2004 17:57:59 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 28 Feb 2004 17:57:59 -0000 Received: (qmail 99254 invoked by uid 500); 28 Feb 2004 17:57:50 -0000 Delivered-To: apmail-jakarta-commons-httpclient-dev-archive@jakarta.apache.org Received: (qmail 99237 invoked by uid 500); 28 Feb 2004 17:57:50 -0000 Mailing-List: contact commons-httpclient-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Commons HttpClient Project" Reply-To: "Commons HttpClient Project" Delivered-To: mailing list commons-httpclient-dev@jakarta.apache.org Received: (qmail 99222 invoked from network); 28 Feb 2004 17:57:49 -0000 Received: from unknown (HELO ms-smtp-03.rdc-nyc.rr.com) (24.29.109.7) by daedalus.apache.org with SMTP; 28 Feb 2004 17:57:49 -0000 Received: from sab275 (24-193-49-27.nyc.rr.com [24.193.49.27]) by ms-smtp-03.rdc-nyc.rr.com (8.12.10/8.12.7) with SMTP id i1SHvo20007429 for ; Sat, 28 Feb 2004 12:57:51 -0500 (EST) From: "Sam Berlin" To: "Commons HttpClient Project" Subject: RE: 302 !! Date: Sat, 28 Feb 2004 12:57:50 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-reply-to: <000701c3fde7$a6d5d490$4d00a8c0@WORKDESK> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal X-Virus-Scanned: Symantec AntiVirus Scan Engine X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Emre, Take a look at the executeMethodRedirecting method in the following = class: = http://core.limewire.org/source/browse/core/com/limegroup/gnutella/http/H= ttpClientManager.java?rev=3D1.7&content-type=3Dtext/x-cvsweb-markup Thanks, Sam -----Original Message----- From: Emre Sokullu [mailto:sokullu@ultratv.net] Sent: Saturday, February 28, 2004 5:43 AM To: Commons HttpClient Project Subject: Re: 302 !! Thanx Oleg for your reply, Yes I've already tried what is written on "Redirects Tutorial page". But = the fact is that, the following procedure does not work for me : Header locationHeader =3D method.getResponseHeader("location"); Even for the redirected sites like http://www.google.com, it does return = a null value. Not just google fo every reidrected page. I've tried to solve the problem by simply commenting the following if condition from the checkValidUri() method in HttpMethodBase class: /* try { String oldHost =3D currentUri.getHost(); String newHost =3D redirectUri.getHost(); if (!oldHost.equalsIgnoreCase(newHost)) { throw new HttpException("Redirect from host " + oldHost + " to " + newHost + " is not supported"); } } catch (URIException e) { LOG.warn("Error getting URI host", e); throw new HttpException("Invalid Redirect URI from: " + currentUri.getEscapedURI() + " to: " + redirectUri.getEscapedURI() ); } */ But the main problem is that the URL to conect can't be extracted from = the location header. I hope I don't waste your time, but it sounds like a bug to me.... Thanx for your help.. ----- Original Message ----- From: "Kalnichevski, Oleg" To: "Commons HttpClient Project" = Sent: Friday, February 27, 2004 7:45 PM Subject: RE: 302 !! > org.apache.commons.httpclient.HttpException: Redirect from host www.google.com to www.google.com.tr is not supported Emre, www.google.com !=3D www.google.com.tr HttpClient 2.0 does not support cross host redirects. Period. We are = sorry. The redirect guide you have already been referred to explains why and = what can be done to work the problem around http://jakarta.apache.org/commons/httpclient/redirects.html Development (unstable) version of HttpClient can automatically handle cross-host redirects already. Oleg -----Original Message----- From: Emre Sokullu [mailto:sokullu@ultratv.net] Sent: Friday, February 27, 2004 18:26 To: Commons HttpClient Project Subject: 302 !! Hi all, I still couldn't solve my problem with http status 302 : When I try to connect Google, it redirects me to the local page : http://www.google.com.tr At this status, I want to catch the new address and try to reconnect but such a failure occurs : 27.=CCub.2004 17:48:13 org.apache.commons.httpclient.HttpMethodBase checkValidRedirect WARNING: Error getting URI host org.apache.commons.httpclient.HttpException: Redirect from host www.google.com to www.google.com.tr is not supported at org.apache.commons.httpclient.HttpMethodBase.checkValidRedirect(HttpM ethodBase.java:1243) at org.apache.commons.httpclient.HttpMethodBase.processRedirectResponse( HttpMethodBase.java:1191) at org.apache.commons.httpclient.HttpMethodBase.isRetryNeeded(HttpMethod Base.java:977) at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.j ava:1095) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav a:675) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav a:529) at WebClient.fetchHTML(WebClient.java:343) at Jetch.(Jetch.java:99) at d2.main(d2.java:26) 27.=CCub.2004 17:48:13 org.apache.commons.httpclient.HttpMethodBase processRedirectResponse WARNING: Invalid Redirect URI from: http://www.google.com:80/ to: http://www.google.com.tr/cxfer?c=3DPREF%3D:TM%3D1077896890:S%3D-1ZixmjyLN= wVsU1 6 And my code is the following : HttpMethod method; if (this.methodPost) { method =3D new PostMethod(this.url); } else { method =3D new GetMethod(this.url); } method.setStrictMode(false); // also tried true; the same result method.setFollowRedirects(true); Header locationHeader =3D method.getResponseHeader("location"); if(locationHeader !=3D null ) { String redirectLocation =3D locationHeader.getValue(); this.tryAgain(redirectLocation); return; } else {} int attempt =3D 0; while (this.statusCode =3D=3D -1 && attempt < 10) { try { this.statusCode =3D this.client.executeMethod(method); } catch (HttpRecoverableException e) { System.err.println( "A recoverable exception occurred, retrying." + e.getMessage()); } catch (IOException e) { System.err.println("Failed to download file."); e.printStackTrace(); System.exit( -1); } } this.responseBody =3D method.getResponseBodyAsString(); method.releaseConnection(); Thanx very much for your interest... *************************************************************************= *** *********************** The information in this email is confidential and may be legally = privileged. Access to this email by anyone other than the intended addressee is unauthorized. If you are not the intended recipient of this message, = any review, disclosure, copying, distribution, retention, or any action = taken or omitted to be taken in reliance on it is prohibited and may be unlawful. = If you are not the intended recipient, please reply to or forward a copy of this message to the sender and delete the message, any attachments, and = any copies thereof from your system. *************************************************************************= *** *********************** --------------------------------------------------------------------- To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: = commons-httpclient-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: = commons-httpclient-dev-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org