You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Sushil Sureka <su...@gmail.com> on 2005/04/08 01:08:58 UTC

Switiching from https to http

Hi,
I am trying to connect to https site and post userid/password to
authenticate and then finally download a html page. The html page is
served from a http link. So basically only userid/password page is
https and rest is http. (I think also there is some redirection going
on after you login.)
The server is running on weblogic. Anyway, I am running into problem
wher I keep getting redirected to security page. For example in my
first attempt (code snippet is below)

      PostMethod post = new PostMethod("https://localhost.com");
            post.addParameter("login", "MYUSER");
            post.addParameter("password", "XXXX");
            post.addParameter("submit", "Submit");*/
            post.setFollowRedirects(true);
            post.setStrictMode(false);
            HttpClient client = new HttpClient();
            int status = client.executeMethod(post);
  
I get This document you requested has moved temporarily.</p>
<p>It's now at <a
href="https://localhost:7002/security/loginAction.do&#59;jsessionid=CV2ZJQa52JDcwgT2wX23GrW2q9c1Tbc6SL1AQ0lckxD72ToGdR5z!212976055?password=XXXX&amp;submit=Submit&amp;login=MYUSER">https://localhost:7002/security/loginAction.do&#59;jsessionid=CV2ZJQa52JDcwgT2wX23GrW2q9c1Tbc6SL1AQ0lckxD72ToGdR5z!212976055?password=XXXX&amp;submit=Submit&amp;login=MYUSER</a>.</p>
</body></html>

Then I tried to follow the redirect 
            Header locationHeader = post.getResponseHeader("location");
            if (locationHeader != null) {
                System.out.println("redirecting to " + redirectLocation);
                post = new PostMethod(redirectLocation);
               status = client.executeMethod(post);

Again I get redirected to same url
https://localhost:7002/security/loginAction.do?password=XXX&amp;submit=Submit&amp;login=MYUSER
( this time around without jsession id)

But if I disable the HTTPS on server, I can work fine. Is there any
idea why this might be happening. The server does create a cookie
after you login but I am not even getting to that point.
thanks
Sushil

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


Re: Switiching from https to http

Posted by Sushil Sureka <su...@gmail.com>.
Thanks Oleg for providing the instructions. The issue was not with the
http client but the SSL extension plug-in to struts. The plugin kept
redirecting the request to the same https:// thinking that the request
coming in had http in it.

Sorry for taking your time
Thanks. BTW I did learn a lot about http client while doing the
research to fix this issue.

Thanks
Sushil 

On Apr 8, 2005 10:33 AM, Oleg Kalnichevski <ol...@apache.org> wrote:
> Sushil,
> 
> Please take a look at the HTTP cookie guide
> <http://jakarta.apache.org/commons/httpclient/3.0/cookies.html> and
> follow the instructions presented there regarding the configuration
> settings that provide best browser compatibility.
> 
> If you fail to achieve the desired result, please post to this list two
> session logs: one without HTTPS and another one with HTTPS. I'll look at
> them over the weekend <http://jakarta.apache.org/commons/httpclient/3.0/logging.html>
> 
> Oleg
> 
> 
> On Fri, Apr 08, 2005 at 10:23:56AM -0500, Sushil Sureka wrote:
> > Thanks Mike for your suggestion. I tried that but did not have much luck.
> >
> > Sushil
> >
> > On Apr 7, 2005 9:01 PM, Michael Becke <mb...@gmail.com> wrote:
> > > Hi Sushil,
> > >
> > > I'm not sure exactly what's happening, but you might want to try
> > > responding to the first redirect with a GET.
> > >
> > > Mike
> > >
> > > On Apr 7, 2005 7:08 PM, Sushil Sureka <su...@gmail.com> wrote:
> > > > Hi,
> > > > I am trying to connect to https site and post userid/password to
> > > > authenticate and then finally download a html page. The html page is
> > > > served from a http link. So basically only userid/password page is
> > > > https and rest is http. (I think also there is some redirection going
> > > > on after you login.)
> > > > The server is running on weblogic. Anyway, I am running into problem
> > > > wher I keep getting redirected to security page. For example in my
> > > > first attempt (code snippet is below)
> > > >
> > > >       PostMethod post = new PostMethod("https://localhost.com");
> > > >             post.addParameter("login", "MYUSER");
> > > >             post.addParameter("password", "XXXX");
> > > >             post.addParameter("submit", "Submit");*/
> > > >             post.setFollowRedirects(true);
> > > >             post.setStrictMode(false);
> > > >             HttpClient client = new HttpClient();
> > > >             int status = client.executeMethod(post);
> > > >
> > > > I get This document you requested has moved temporarily.</p>
> > > > <p>It's now at <a
> > > > href="https://localhost:7002/security/loginAction.do&#59;jsessionid=CV2ZJQa52JDcwgT2wX23GrW2q9c1Tbc6SL1AQ0lckxD72ToGdR5z!212976055?password=XXXX&amp;submit=Submit&amp;login=MYUSER">https://localhost:7002/security/loginAction.do&#59;jsessionid=CV2ZJQa52JDcwgT2wX23GrW2q9c1Tbc6SL1AQ0lckxD72ToGdR5z!212976055?password=XXXX&amp;submit=Submit&amp;login=MYUSER</a>.</p>
> > > > </body></html>
> > > >
> > > > Then I tried to follow the redirect
> > > >             Header locationHeader = post.getResponseHeader("location");
> > > >             if (locationHeader != null) {
> > > >                 System.out.println("redirecting to " + redirectLocation);
> > > >                 post = new PostMethod(redirectLocation);
> > > >                status = client.executeMethod(post);
> > > >
> > > > Again I get redirected to same url
> > > > https://localhost:7002/security/loginAction.do?password=XXX&amp;submit=Submit&amp;login=MYUSER
> > > > ( this time around without jsession id)
> > > >
> > > > But if I disable the HTTPS on server, I can work fine. Is there any
> > > > idea why this might be happening. The server does create a cookie
> > > > after you login but I am not even getting to that point.
> > > > thanks
> > > > Sushil
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> > > >
> > > >
> > >
> >
> >
> > --
> > Thanks
> > Sushil
> >
> > ---------------------------------------------------------------------
> > 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
> 
> 


-- 
Thanks
Sushil

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


Re: Switiching from https to http

Posted by Oleg Kalnichevski <ol...@apache.org>.
Sushil,

Please take a look at the HTTP cookie guide
<http://jakarta.apache.org/commons/httpclient/3.0/cookies.html> and
follow the instructions presented there regarding the configuration
settings that provide best browser compatibility.

If you fail to achieve the desired result, please post to this list two
session logs: one without HTTPS and another one with HTTPS. I'll look at
them over the weekend <http://jakarta.apache.org/commons/httpclient/3.0/logging.html>

Oleg


On Fri, Apr 08, 2005 at 10:23:56AM -0500, Sushil Sureka wrote:
> Thanks Mike for your suggestion. I tried that but did not have much luck.
> 
> Sushil
> 
> On Apr 7, 2005 9:01 PM, Michael Becke <mb...@gmail.com> wrote:
> > Hi Sushil,
> > 
> > I'm not sure exactly what's happening, but you might want to try
> > responding to the first redirect with a GET.
> > 
> > Mike
> > 
> > On Apr 7, 2005 7:08 PM, Sushil Sureka <su...@gmail.com> wrote:
> > > Hi,
> > > I am trying to connect to https site and post userid/password to
> > > authenticate and then finally download a html page. The html page is
> > > served from a http link. So basically only userid/password page is
> > > https and rest is http. (I think also there is some redirection going
> > > on after you login.)
> > > The server is running on weblogic. Anyway, I am running into problem
> > > wher I keep getting redirected to security page. For example in my
> > > first attempt (code snippet is below)
> > >
> > >       PostMethod post = new PostMethod("https://localhost.com");
> > >             post.addParameter("login", "MYUSER");
> > >             post.addParameter("password", "XXXX");
> > >             post.addParameter("submit", "Submit");*/
> > >             post.setFollowRedirects(true);
> > >             post.setStrictMode(false);
> > >             HttpClient client = new HttpClient();
> > >             int status = client.executeMethod(post);
> > >
> > > I get This document you requested has moved temporarily.</p>
> > > <p>It's now at <a
> > > href="https://localhost:7002/security/loginAction.do&#59;jsessionid=CV2ZJQa52JDcwgT2wX23GrW2q9c1Tbc6SL1AQ0lckxD72ToGdR5z!212976055?password=XXXX&amp;submit=Submit&amp;login=MYUSER">https://localhost:7002/security/loginAction.do&#59;jsessionid=CV2ZJQa52JDcwgT2wX23GrW2q9c1Tbc6SL1AQ0lckxD72ToGdR5z!212976055?password=XXXX&amp;submit=Submit&amp;login=MYUSER</a>.</p>
> > > </body></html>
> > >
> > > Then I tried to follow the redirect
> > >             Header locationHeader = post.getResponseHeader("location");
> > >             if (locationHeader != null) {
> > >                 System.out.println("redirecting to " + redirectLocation);
> > >                 post = new PostMethod(redirectLocation);
> > >                status = client.executeMethod(post);
> > >
> > > Again I get redirected to same url
> > > https://localhost:7002/security/loginAction.do?password=XXX&amp;submit=Submit&amp;login=MYUSER
> > > ( this time around without jsession id)
> > >
> > > But if I disable the HTTPS on server, I can work fine. Is there any
> > > idea why this might be happening. The server does create a cookie
> > > after you login but I am not even getting to that point.
> > > thanks
> > > Sushil
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> > >
> > >
> > 
> 
> 
> -- 
> Thanks
> Sushil
> 
> ---------------------------------------------------------------------
> 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


Re: Switiching from https to http

Posted by Sushil Sureka <su...@gmail.com>.
Thanks Mike for your suggestion. I tried that but did not have much luck.

Sushil

On Apr 7, 2005 9:01 PM, Michael Becke <mb...@gmail.com> wrote:
> Hi Sushil,
> 
> I'm not sure exactly what's happening, but you might want to try
> responding to the first redirect with a GET.
> 
> Mike
> 
> On Apr 7, 2005 7:08 PM, Sushil Sureka <su...@gmail.com> wrote:
> > Hi,
> > I am trying to connect to https site and post userid/password to
> > authenticate and then finally download a html page. The html page is
> > served from a http link. So basically only userid/password page is
> > https and rest is http. (I think also there is some redirection going
> > on after you login.)
> > The server is running on weblogic. Anyway, I am running into problem
> > wher I keep getting redirected to security page. For example in my
> > first attempt (code snippet is below)
> >
> >       PostMethod post = new PostMethod("https://localhost.com");
> >             post.addParameter("login", "MYUSER");
> >             post.addParameter("password", "XXXX");
> >             post.addParameter("submit", "Submit");*/
> >             post.setFollowRedirects(true);
> >             post.setStrictMode(false);
> >             HttpClient client = new HttpClient();
> >             int status = client.executeMethod(post);
> >
> > I get This document you requested has moved temporarily.</p>
> > <p>It's now at <a
> > href="https://localhost:7002/security/loginAction.do&#59;jsessionid=CV2ZJQa52JDcwgT2wX23GrW2q9c1Tbc6SL1AQ0lckxD72ToGdR5z!212976055?password=XXXX&amp;submit=Submit&amp;login=MYUSER">https://localhost:7002/security/loginAction.do&#59;jsessionid=CV2ZJQa52JDcwgT2wX23GrW2q9c1Tbc6SL1AQ0lckxD72ToGdR5z!212976055?password=XXXX&amp;submit=Submit&amp;login=MYUSER</a>.</p>
> > </body></html>
> >
> > Then I tried to follow the redirect
> >             Header locationHeader = post.getResponseHeader("location");
> >             if (locationHeader != null) {
> >                 System.out.println("redirecting to " + redirectLocation);
> >                 post = new PostMethod(redirectLocation);
> >                status = client.executeMethod(post);
> >
> > Again I get redirected to same url
> > https://localhost:7002/security/loginAction.do?password=XXX&amp;submit=Submit&amp;login=MYUSER
> > ( this time around without jsession id)
> >
> > But if I disable the HTTPS on server, I can work fine. Is there any
> > idea why this might be happening. The server does create a cookie
> > after you login but I am not even getting to that point.
> > thanks
> > Sushil
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> >
> >
> 


-- 
Thanks
Sushil

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


Re: Switiching from https to http

Posted by Michael Becke <mb...@gmail.com>.
Hi Sushil,

I'm not sure exactly what's happening, but you might want to try
responding to the first redirect with a GET.

Mike

On Apr 7, 2005 7:08 PM, Sushil Sureka <su...@gmail.com> wrote:
> Hi,
> I am trying to connect to https site and post userid/password to
> authenticate and then finally download a html page. The html page is
> served from a http link. So basically only userid/password page is
> https and rest is http. (I think also there is some redirection going
> on after you login.)
> The server is running on weblogic. Anyway, I am running into problem
> wher I keep getting redirected to security page. For example in my
> first attempt (code snippet is below)
> 
>       PostMethod post = new PostMethod("https://localhost.com");
>             post.addParameter("login", "MYUSER");
>             post.addParameter("password", "XXXX");
>             post.addParameter("submit", "Submit");*/
>             post.setFollowRedirects(true);
>             post.setStrictMode(false);
>             HttpClient client = new HttpClient();
>             int status = client.executeMethod(post);
> 
> I get This document you requested has moved temporarily.</p>
> <p>It's now at <a
> href="https://localhost:7002/security/loginAction.do&#59;jsessionid=CV2ZJQa52JDcwgT2wX23GrW2q9c1Tbc6SL1AQ0lckxD72ToGdR5z!212976055?password=XXXX&amp;submit=Submit&amp;login=MYUSER">https://localhost:7002/security/loginAction.do&#59;jsessionid=CV2ZJQa52JDcwgT2wX23GrW2q9c1Tbc6SL1AQ0lckxD72ToGdR5z!212976055?password=XXXX&amp;submit=Submit&amp;login=MYUSER</a>.</p>
> </body></html>
> 
> Then I tried to follow the redirect
>             Header locationHeader = post.getResponseHeader("location");
>             if (locationHeader != null) {
>                 System.out.println("redirecting to " + redirectLocation);
>                 post = new PostMethod(redirectLocation);
>                status = client.executeMethod(post);
> 
> Again I get redirected to same url
> https://localhost:7002/security/loginAction.do?password=XXX&amp;submit=Submit&amp;login=MYUSER
> ( this time around without jsession id)
> 
> But if I disable the HTTPS on server, I can work fine. Is there any
> idea why this might be happening. The server does create a cookie
> after you login but I am not even getting to that point.
> thanks
> Sushil
> 
> ---------------------------------------------------------------------
> 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