hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: HttpClient redirect to https locationy
Date Wed, 24 Nov 2004 08:40:57 GMT
Yi,

HttpClient 2.0.x can't handle cross-site redirects automatically (this
limitation has already been fixed in HttpClient 3.0). However I can't
see how this can be related to the problem you have been having, since
you have explicitly disabled automatic redirects in your code. 

I may be of more help if you post the wire/context log of the HTTP
session

http://jakarta.apache.org/commons/httpclient/logging.html

Oleg

On Tue, Nov 23, 2004 at 04:09:44PM -0800, Yi Wang wrote:
> Looks like the trick is here:
> 
> [WARN] HttpMethodBase - -Redirect from protocol http to https is not
> supported.
> 
> 
> ----- Original Message -----
> From: "Yi Wang" <yiwang3@cisco.com>
> To: <httpclient-user@jakarta.apache.org>
> Sent: Monday, November 22, 2004 5:55 PM
> Subject: HttpClient redirect to https location
> 
> 
> Hi
> I have a problem using the httpclient redirect features:
>   getMethod.setFollowRedirects(false);
>   status = httpClient.executeMethod(getMethod);
>   locationHeader = getMethod.getResponseHeader("location");
>   urlResult = locationHeader.getValue();
>   if (urlResult == null)
>   System.out.println("urlString is null");
>   else
>   System.out.println("urlResult is " + urlResult);
> I always get a string :
> http://hostname:1741/nm/servlet/servlet.CsAuthServlet?cmd=loginSuccess&id=79
> DD6F6A83B89CA36CEC1BFB74845371&page=main?command=initializeAndValidate&url=/
> cwhp/cwhp.applications.do&context=/cwhp&port=443
> 
> But when using icesoft httpclient package I got the following:
> 
> https://hostname:443/nm/servlet/servlet.CsAuthServlet?cmd=loginSuccess&id=79
> DD6F6A83B89CA36CEC1BFB74845371&page=main?command=initializeAndValidate&url=/
> cwhp/cwhp.applications.do&context=/cwhp&port=443
> 
> As you can see, only the protocol name and port number are different. And
> the second string is correct.
> 
> Here is the code using icesoft:
> 
>       ice.net.HttpURLConnection.setFollowRedirects(false);
>       ice.net.HttpURLConnection uc =
> (ice.net.HttpURLConnection)url.openConnection();
>       uc.getContent();
>       status = uc.getResponseCode();
> 
>       //check if we get authenticated or get returned to the authFail page
>       urlResult = uc.getHeaderField("Location");
>       ice.net.HttpURLConnection.setFollowRedirects(true);
> 
> The second output was correct - can someone tell me how I should use the
> httpclient package to generate the right output?
> 
> Thanks
> 
> Yi
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message