You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Jeffrey Dever <js...@sympatico.ca> on 2003/02/18 05:51:21 UTC

[Fwd: Any example on state(cookie) management across a series of connections?]

  Not sure about that chunk error, but HttpClient does not allow 
forwards across hosts.  The webpage you posted is using a form based 
login.  You should probablly look at the html source and figure out how 
to do what the browser is doing, as opposed to what the user is doing. 
 (read that twice)

Somthing like this should work:

PostMethod method = new PostMethod "https://login.hotjobs.yahoo.com/display/resume?ct_hft=merge/login");
NameValuePair[] params = new NameValuePair[]{
	new NameValuePair("yesno", "1")
	new NameValuePair("username", "xxx"),
	new NameValuePair("passwd", "xxx") };
method.addParametersBody(params);

There are also some hidden input fields that you might want to 
experiment with ... always fun ...

Jandalf.


-------- Original Message --------
Subject: Any example on state(cookie) management across a series of 
connections?
Date: Mon, 17 Feb 2003 19:37:20 -0800 (PST)
From: Yang Su <ya...@yahoo.com>
Reply-To: "Commons HttpClient Project" 
<co...@jakarta.apache.org>, inklesu@msn.com
To: commons-httpclient-dev@jakarta.apache.org



Hi,

I am new here. I am trying to have a simulated http
client whose purpose is to log onto www.hotjobs.com
using username and password, I've written a
program(which I attach) to achieve this, however, the
final step which I try to connect to
"http://my.hotjobs.yahoo.com/display/resume?xxxx", it
fails with error like this:

java.io.IOException: Bad chunk size: The document has
moved 


Re: [Fwd: Any example on state(cookie) management across a series of connections?]

Posted by Jeffrey Dever <js...@sympatico.ca>.
still no attachments ...

Yang Su wrote:

>Sorry if the attached files are missing, resend them.
>
>--- Yang Su <ya...@yahoo.com> wrote:
>  
>



Re: [Fwd: Any example on state(cookie) management across a series of connections?]

Posted by Yang Su <ya...@yahoo.com>.
Sorry if the attached files are missing, resend them.

--- Yang Su <ya...@yahoo.com> wrote:
> Please take a look at the attached files,
> 1.htm is the output of the original program, which
> looks like it can't follow a https redirection.
> 2.htm is the output of the modified program using
> post.addParameters().
> 
> Thanks.
> 
> yang
> 
> --- Oleg Kalnichevski <o....@dplanet.ch>
> wrote:
> > Hi Yang
> > 
> > Could you please execute your application with the
> > following system
> > properties
> > 
> >
>
-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
> >
>
-Dorg.apache.commons.logging.simplelog.log.httpclient.wire=debug
> > 
> >
>
-Dorg.apache.commons.logging.simplelog.log.org.apache.commons.httpclient=debug
> > 
> > and post the resulting debug trace?
> > 
> > Oleg
> > 
> > On Tue, 2003-02-18 at 06:52, Yang Su wrote:
> > > Actually my original code without your suggested
> > > changes work for that step(i.e., POST is
> > successful,
> > > you can try to run the attached class, however,
> if
> > I
> > > modify the code to adapt your suggestion, it
> turns
> > out
> > > that it doesn't work, see the modified
> attachment
> > --
> > > WONT WORK) I think the problem is that the state
> > seems
> > > not to be maintained, and it is somehow weird
> why
> > the
> > > last get method should fail.
> > > 
> > > yang
> > > 
> > > --- Jeffrey Dever <js...@sympatico.ca> wrote:
> > > >   Not sure about that chunk error, but
> > HttpClient
> > > > does not allow 
> > > > forwards across hosts.  The webpage you posted
> > is
> > > > using a form based 
> > > > login.  You should probablly look at the html
> > source
> > > > and figure out how 
> > > > to do what the browser is doing, as opposed to
> > what
> > > > the user is doing. 
> > > >  (read that twice)
> > > > 
> > > > Somthing like this should work:
> > > > 
> > > > PostMethod method = new PostMethod
> > > >
> > >
> >
>
"https://login.hotjobs.yahoo.com/display/resume?ct_hft=merge/login");
> > > > NameValuePair[] params = new NameValuePair[]{
> > > > 	new NameValuePair("yesno", "1")
> > > > 	new NameValuePair("username", "xxx"),
> > > > 	new NameValuePair("passwd", "xxx") };
> > > > method.addParametersBody(params);
> > > > 
> > > > There are also some hidden input fields that
> you
> > > > might want to 
> > > > experiment with ... always fun ...
> > > > 
> > > > Jandalf.
> > > > 
> > > > 
> > > > -------- Original Message --------
> > > > Subject: Any example on state(cookie)
> management
> > > > across a series of 
> > > > connections?
> > > > Date: Mon, 17 Feb 2003 19:37:20 -0800 (PST)
> > > > From: Yang Su <ya...@yahoo.com>
> > > > Reply-To: "Commons HttpClient Project" 
> > > > <co...@jakarta.apache.org>,
> > > > inklesu@msn.com
> > > > To: commons-httpclient-dev@jakarta.apache.org
> > > > 
> > > > 
> > > > 
> > > > Hi,
> > > > 
> > > > I am new here. I am trying to have a simulated
> > http
> > > > client whose purpose is to log onto
> > www.hotjobs.com
> > > > using username and password, I've written a
> > > > program(which I attach) to achieve this,
> > however,
> > > > the
> > > > final step which I try to connect to
> > > >
> > "http://my.hotjobs.yahoo.com/display/resume?xxxx",
> > > > it
> > > > fails with error like this:
> > > > 
> > > > java.io.IOException: Bad chunk size: The
> > document
> > > > has
> > > > moved 
> > > > 
> > > > >
> > >
> >
>
---------------------------------------------------------------------
> > > > 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
> > > 
> > >
> __________________________________________________
> > > Do you Yahoo!?
> > > Yahoo! Shopping - Send Flowers for Valentine's
> Day
> > > http://shopping.yahoo.com
> > > 
> > >
> >
>
______________________________________________________________________
> > > 
> > >
> >
>
---------------------------------------------------------------------
> > > 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
> > 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Shopping - Send Flowers for Valentine's Day
> http://shopping.yahoo.com
> >
---------------------------------------------------------------------
> To unsubscribe, e-mail:
>
commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org

__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

Re: [Fwd: Any example on state(cookie) management across a series of connections?]

Posted by Yang Su <ya...@yahoo.com>.
Please take a look at the attached files,
1.htm is the output of the original program, which
looks like it can't follow a https redirection.
2.htm is the output of the modified program using
post.addParameters().

Thanks.

yang

--- Oleg Kalnichevski <o....@dplanet.ch>
wrote:
> Hi Yang
> 
> Could you please execute your application with the
> following system
> properties
> 
>
-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
>
-Dorg.apache.commons.logging.simplelog.log.httpclient.wire=debug
> 
>
-Dorg.apache.commons.logging.simplelog.log.org.apache.commons.httpclient=debug
> 
> and post the resulting debug trace?
> 
> Oleg
> 
> On Tue, 2003-02-18 at 06:52, Yang Su wrote:
> > Actually my original code without your suggested
> > changes work for that step(i.e., POST is
> successful,
> > you can try to run the attached class, however, if
> I
> > modify the code to adapt your suggestion, it turns
> out
> > that it doesn't work, see the modified attachment
> --
> > WONT WORK) I think the problem is that the state
> seems
> > not to be maintained, and it is somehow weird why
> the
> > last get method should fail.
> > 
> > yang
> > 
> > --- Jeffrey Dever <js...@sympatico.ca> wrote:
> > >   Not sure about that chunk error, but
> HttpClient
> > > does not allow 
> > > forwards across hosts.  The webpage you posted
> is
> > > using a form based 
> > > login.  You should probablly look at the html
> source
> > > and figure out how 
> > > to do what the browser is doing, as opposed to
> what
> > > the user is doing. 
> > >  (read that twice)
> > > 
> > > Somthing like this should work:
> > > 
> > > PostMethod method = new PostMethod
> > >
> >
>
"https://login.hotjobs.yahoo.com/display/resume?ct_hft=merge/login");
> > > NameValuePair[] params = new NameValuePair[]{
> > > 	new NameValuePair("yesno", "1")
> > > 	new NameValuePair("username", "xxx"),
> > > 	new NameValuePair("passwd", "xxx") };
> > > method.addParametersBody(params);
> > > 
> > > There are also some hidden input fields that you
> > > might want to 
> > > experiment with ... always fun ...
> > > 
> > > Jandalf.
> > > 
> > > 
> > > -------- Original Message --------
> > > Subject: Any example on state(cookie) management
> > > across a series of 
> > > connections?
> > > Date: Mon, 17 Feb 2003 19:37:20 -0800 (PST)
> > > From: Yang Su <ya...@yahoo.com>
> > > Reply-To: "Commons HttpClient Project" 
> > > <co...@jakarta.apache.org>,
> > > inklesu@msn.com
> > > To: commons-httpclient-dev@jakarta.apache.org
> > > 
> > > 
> > > 
> > > Hi,
> > > 
> > > I am new here. I am trying to have a simulated
> http
> > > client whose purpose is to log onto
> www.hotjobs.com
> > > using username and password, I've written a
> > > program(which I attach) to achieve this,
> however,
> > > the
> > > final step which I try to connect to
> > >
> "http://my.hotjobs.yahoo.com/display/resume?xxxx",
> > > it
> > > fails with error like this:
> > > 
> > > java.io.IOException: Bad chunk size: The
> document
> > > has
> > > moved 
> > > 
> > > >
> >
>
---------------------------------------------------------------------
> > > 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
> > 
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Shopping - Send Flowers for Valentine's Day
> > http://shopping.yahoo.com
> > 
> >
>
______________________________________________________________________
> > 
> >
>
---------------------------------------------------------------------
> > 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
> 

__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

Re: [Fwd: Any example on state(cookie) management across a series of connections?]

Posted by Oleg Kalnichevski <o....@dplanet.ch>.
Hi Yang

Could you please execute your application with the following system
properties

-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
-Dorg.apache.commons.logging.simplelog.log.httpclient.wire=debug 
-Dorg.apache.commons.logging.simplelog.log.org.apache.commons.httpclient=debug 
and post the resulting debug trace?

Oleg

On Tue, 2003-02-18 at 06:52, Yang Su wrote:
> Actually my original code without your suggested
> changes work for that step(i.e., POST is successful,
> you can try to run the attached class, however, if I
> modify the code to adapt your suggestion, it turns out
> that it doesn't work, see the modified attachment --
> WONT WORK) I think the problem is that the state seems
> not to be maintained, and it is somehow weird why the
> last get method should fail.
> 
> yang
> 
> --- Jeffrey Dever <js...@sympatico.ca> wrote:
> >   Not sure about that chunk error, but HttpClient
> > does not allow 
> > forwards across hosts.  The webpage you posted is
> > using a form based 
> > login.  You should probablly look at the html source
> > and figure out how 
> > to do what the browser is doing, as opposed to what
> > the user is doing. 
> >  (read that twice)
> > 
> > Somthing like this should work:
> > 
> > PostMethod method = new PostMethod
> >
> "https://login.hotjobs.yahoo.com/display/resume?ct_hft=merge/login");
> > NameValuePair[] params = new NameValuePair[]{
> > 	new NameValuePair("yesno", "1")
> > 	new NameValuePair("username", "xxx"),
> > 	new NameValuePair("passwd", "xxx") };
> > method.addParametersBody(params);
> > 
> > There are also some hidden input fields that you
> > might want to 
> > experiment with ... always fun ...
> > 
> > Jandalf.
> > 
> > 
> > -------- Original Message --------
> > Subject: Any example on state(cookie) management
> > across a series of 
> > connections?
> > Date: Mon, 17 Feb 2003 19:37:20 -0800 (PST)
> > From: Yang Su <ya...@yahoo.com>
> > Reply-To: "Commons HttpClient Project" 
> > <co...@jakarta.apache.org>,
> > inklesu@msn.com
> > To: commons-httpclient-dev@jakarta.apache.org
> > 
> > 
> > 
> > Hi,
> > 
> > I am new here. I am trying to have a simulated http
> > client whose purpose is to log onto www.hotjobs.com
> > using username and password, I've written a
> > program(which I attach) to achieve this, however,
> > the
> > final step which I try to connect to
> > "http://my.hotjobs.yahoo.com/display/resume?xxxx",
> > it
> > fails with error like this:
> > 
> > java.io.IOException: Bad chunk size: The document
> > has
> > moved 
> > 
> > >
> ---------------------------------------------------------------------
> > 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
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Shopping - Send Flowers for Valentine's Day
> http://shopping.yahoo.com
> 
> ______________________________________________________________________
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org


Re: [Fwd: Any example on state(cookie) management across a series of connections?]

Posted by Yang Su <ya...@yahoo.com>.
Actually my original code without your suggested
changes work for that step(i.e., POST is successful,
you can try to run the attached class, however, if I
modify the code to adapt your suggestion, it turns out
that it doesn't work, see the modified attachment --
WONT WORK) I think the problem is that the state seems
not to be maintained, and it is somehow weird why the
last get method should fail.

yang

--- Jeffrey Dever <js...@sympatico.ca> wrote:
>   Not sure about that chunk error, but HttpClient
> does not allow 
> forwards across hosts.  The webpage you posted is
> using a form based 
> login.  You should probablly look at the html source
> and figure out how 
> to do what the browser is doing, as opposed to what
> the user is doing. 
>  (read that twice)
> 
> Somthing like this should work:
> 
> PostMethod method = new PostMethod
>
"https://login.hotjobs.yahoo.com/display/resume?ct_hft=merge/login");
> NameValuePair[] params = new NameValuePair[]{
> 	new NameValuePair("yesno", "1")
> 	new NameValuePair("username", "xxx"),
> 	new NameValuePair("passwd", "xxx") };
> method.addParametersBody(params);
> 
> There are also some hidden input fields that you
> might want to 
> experiment with ... always fun ...
> 
> Jandalf.
> 
> 
> -------- Original Message --------
> Subject: Any example on state(cookie) management
> across a series of 
> connections?
> Date: Mon, 17 Feb 2003 19:37:20 -0800 (PST)
> From: Yang Su <ya...@yahoo.com>
> Reply-To: "Commons HttpClient Project" 
> <co...@jakarta.apache.org>,
> inklesu@msn.com
> To: commons-httpclient-dev@jakarta.apache.org
> 
> 
> 
> Hi,
> 
> I am new here. I am trying to have a simulated http
> client whose purpose is to log onto www.hotjobs.com
> using username and password, I've written a
> program(which I attach) to achieve this, however,
> the
> final step which I try to connect to
> "http://my.hotjobs.yahoo.com/display/resume?xxxx",
> it
> fails with error like this:
> 
> java.io.IOException: Bad chunk size: The document
> has
> moved 
> 
> >
---------------------------------------------------------------------
> 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

__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com