You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Ken Hall <ke...@reehergroup.com> on 2004/08/31 18:51:27 UTC
Multiple Host Redirect
If anyone could give me some help with this, I would greatly appreciate
it. I am having difficulty after successfully logging in to get the
redirected page and it appears that my issue lies with multiple hosts.
HTTPS does not seem to be the issue.
My procedure goes like this.
1) Post to page with the correct credentials.
***********
PostMethod authpost = new PostMethod("https://host1/url");
authpost.setRequestBody(data);
try {
client.executeMethod(authpost);
} catch (HttpException httpe) {
System.err.print("HttpException.");
System.err.println(httpe.getMessage());
httpe.printStackTrace();
} catch (IOException ioe) {
System.err.print("IOException.");
System.err.println(ioe.getMessage());
ioe.printStackTrace();
}
// release any connection resources used by the method
authpost.releaseConnection();
***********
2) Two additional cookies are placed in the request header. It tells me
I am logged in and I am returned a meta tag refresh in the response
body.
***********
<meta http-equiv="Refresh" content="0;URL=https://host2/url">
You should be automatically redirected back to your original page.
If you are not automatically redirected, please click <a
href="https://host2/url">here</a>
***********
3) Upon using the GetMethod to go directly to this page which is on a
different host, I am referred back to the login page.
***********
authget = new GetMethod("https://host2/url");
try {
client.executeMethod(authget);
} catch (HttpException httpe) {
System.err.print("HttpException.");
System.err.println(httpe.getMessage());
httpe.printStackTrace();
} catch (IOException ioe) {
System.err.print("IOException.");
System.err.println(ioe.getMessage());
ioe.printStackTrace();
}
responseBody = authget.getResponseBodyAsString();
authget.releaseConnection();
************
Is their something I am missing or is there a better way to debug this?
Thanks.
-Ken Hall
Re: Multiple Host Redirect
Posted by Oleg Kalnichevski <ol...@apache.org>.
> Is their something I am missing or is there a better way to
> debug this?
Ken,
There is. Please refer to the HttpClient logging guide for details:
http://jakarta.apache.org/commons/httpclient/logging.html
If you need help interpreting the wire/debug log feel free to post the
relevant bits to this list. If the log contains security sensitive
information (such as credentials) it may be a good idea to have it
obfuscated
Oleg
On Tue, 2004-08-31 at 18:51, Ken Hall wrote:
> If anyone could give me some help with this, I would greatly appreciate
> it. I am having difficulty after successfully logging in to get the
> redirected page and it appears that my issue lies with multiple hosts.
> HTTPS does not seem to be the issue.
>
>
>
> My procedure goes like this.
>
>
>
> 1) Post to page with the correct credentials.
>
>
>
>
>
> ***********
>
> PostMethod authpost = new PostMethod("https://host1/url");
>
> authpost.setRequestBody(data);
>
>
>
> try {
>
> client.executeMethod(authpost);
>
> } catch (HttpException httpe) {
>
> System.err.print("HttpException.");
>
>
> System.err.println(httpe.getMessage());
>
> httpe.printStackTrace();
>
> } catch (IOException ioe) {
>
> System.err.print("IOException.");
>
>
> System.err.println(ioe.getMessage());
>
> ioe.printStackTrace();
>
>
> }
>
>
>
> // release any connection resources used by the method
>
> authpost.releaseConnection();
>
> ***********
>
>
>
> 2) Two additional cookies are placed in the request header. It tells me
> I am logged in and I am returned a meta tag refresh in the response
> body.
>
>
>
> ***********
>
> <meta http-equiv="Refresh" content="0;URL=https://host2/url">
>
> You should be automatically redirected back to your original page.
>
> If you are not automatically redirected, please click <a
> href="https://host2/url">here</a>
>
> ***********
>
>
>
>
>
> 3) Upon using the GetMethod to go directly to this page which is on a
> different host, I am referred back to the login page.
>
>
>
> ***********
>
> authget = new GetMethod("https://host2/url");
>
>
>
> try {
>
> client.executeMethod(authget);
>
> } catch (HttpException httpe) {
>
> System.err.print("HttpException.");
>
> System.err.println(httpe.getMessage());
>
> httpe.printStackTrace();
>
> } catch (IOException ioe) {
>
> System.err.print("IOException.");
>
> System.err.println(ioe.getMessage());
>
> ioe.printStackTrace();
>
> }
>
>
>
> responseBody = authget.getResponseBodyAsString();
>
> authget.releaseConnection();
>
> ************
>
>
>
> Is their something I am missing or is there a better way to debug this?
>
>
>
> Thanks.
>
>
>
> -Ken Hall
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org