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 bo <bo...@gmail.com> on 2009/02/26 03:39:33 UTC
Redirect on authentication
Hi
I'm trying to do form-based authentication. Here's what happens according to
the Firebug
1. Hit the URL (GET http://foo.com)
2. That gets response code 302 and gets redirected (GET
http://foo.com/session/new) which brings a login form
3. Login form is POST with action="https://foo.com/session" and two fields
uname and passwd
4. Submitting the form gets 302 (POST https://foo.com/session) and then GET
http://foo.com/session/new which brings index page content
I'm not clear if I need to follow both redirects and what is the best way to
do it. Test code that I have follows
DefaultHttpClient client = new DefaultHttpClient();
HttpGet get = new HttpGet("http://foo.com/");
HttpResponse response = client.execute(get);
System.out.println(response.getStatusLine());
response.getEntity().consumeContent();
// do the form post, retain all the cookies
HttpPost post = new HttpPost("https://foo.com/session/new");
List <NameValuePair> nvps = new ArrayList <NameValuePair>();
nvps.add(new BasicNameValuePair("login", "dude@gmail.com"));
nvps.add(new BasicNameValuePair("password", "Foo"));
nvps.add(new BasicNameValuePair("commit", "Sign In")); // this is
actually a submit button
post.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
HttpResponse postresponse = client.execute(post);
ResponseHandler<String> handler = new BasicResponseHandler();
String body = handler.handleResponse(postresponse);
System.out.println(body);
// still prints out login form
Thanks,
Bob S.
Re: Redirect on authentication
Posted by bo <bo...@gmail.com>.
Actually I discovered something called HttpFox - it's awesome, for example I
can see that requests are going to twate.com for the cert, etc.
On Thu, Feb 26, 2009 at 9:46 AM, sebb <se...@gmail.com> wrote:
> On 26/02/2009, bo <bo...@gmail.com> wrote:
> > sebb - in my original post I'm referring to Firebug - would you recommend
> a
> > better tool?
>
> As it happens, I use Live HTTP Headers with Firefox which works OK for me.
>
> I've never used Firebug, so cannot comment if it is better or worse.
>
> If you are happy with Firebug then there's no point switching.
>
> All you need is to be able to see the HTTP traffic.
>
> >
> > On Thu, Feb 26, 2009 at 5:34 AM, sebb <se...@gmail.com> wrote:
> >
> > > Or you can use one of the browser add-ons that show you the requests
> > > and responses.
> > >
> > > On 26/02/2009, Jeff Davis <je...@flyingdiamond.com> wrote:
> > > > Hi,
> > > >
> > > > Scripted logins are generally purposely hard to crack. There is
> quite
> > > > possibly hidden vars along with the user and pass, sometimes
> javascript
> > > > modifies a post field before it's sent and also cookies are set that
> must
> > > be
> > > > duplicated.
> > > >
> > > > I have always found a packet analyzer helpful such as wireshark to
> get a
> > > > clear understanding of how the login process looks when using a
> browser,
> > > > then comparing that to what the packets look like with the
> httpclient
> > > app.
> > > >
> > > > That should get you started in the right direction, if you look a
> little
> > > > deeper.
> > > >
> > > > Jeff
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > bo wrote:
> > > >
> > > > > Hi
> > > > >
> > > > > I'm trying to do form-based authentication. Here's what happens
> > > according
> > > > to
> > > > > the Firebug
> > > > >
> > > > > 1. Hit the URL (GET http://foo.com)
> > > > > 2. That gets response code 302 and gets redirected (GET
> > > > > http://foo.com/session/new) which brings a login form
> > > > > 3. Login form is POST with
> > > > action="https://foo.com/session" and two fields
> > > > > uname and passwd
> > > > > 4. Submitting the form gets 302 (POST https://foo.com/session)
> and
> > > then
> > > > GET
> > > > > http://foo.com/session/new which brings index page content
> > > > >
> > > > > I'm not clear if I need to follow both redirects and what is the
> best
> > > way
> > > > to
> > > > > do it. Test code that I have follows
> > > > >
> > > > > DefaultHttpClient client = new DefaultHttpClient();
> > > > > HttpGet get = new HttpGet("http://foo.com/");
> > > > > HttpResponse response = client.execute(get);
> > > > > System.out.println(response.getStatusLine());
> > > > > response.getEntity().consumeContent();
> > > > > // do the form post, retain all the cookies
> > > > > HttpPost post = new
> > > > HttpPost("https://foo.com/session/new");
> > > > > List <NameValuePair> nvps = new ArrayList
> <NameValuePair>();
> > > > > nvps.add(new BasicNameValuePair("login", "dude@gmail.com
> "));
> > > > > nvps.add(new BasicNameValuePair("password", "Foo"));
> > > > > nvps.add(new BasicNameValuePair("commit", "Sign In")); //
> this
> > > is
> > > > > actually a submit button
> > > > > post.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
> > > > > HttpResponse postresponse = client.execute(post);
> > > > > ResponseHandler<String> handler = new
> BasicResponseHandler();
> > > > > String body =
> > > > handler.handleResponse(postresponse);
> > > > > System.out.println(body);
> > > > > // still prints out login form
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Bob S.
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > > httpclient-users-unsubscribe@hc.apache.org
> > > > For additional commands, e-mail:
> > > > httpclient-users-help@hc.apache.org
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> > >
> > >
> >
> >
> >
> > --
> > _________________________
> > "Jump right ahead in my web"
> > The Rolling Stones.
> > "Out of Our Heads" 1965
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>
--
_________________________
"Jump right ahead in my web"
The Rolling Stones.
"Out of Our Heads" 1965
Re: Redirect on authentication
Posted by sebb <se...@gmail.com>.
On 26/02/2009, bo <bo...@gmail.com> wrote:
> sebb - in my original post I'm referring to Firebug - would you recommend a
> better tool?
As it happens, I use Live HTTP Headers with Firefox which works OK for me.
I've never used Firebug, so cannot comment if it is better or worse.
If you are happy with Firebug then there's no point switching.
All you need is to be able to see the HTTP traffic.
>
> On Thu, Feb 26, 2009 at 5:34 AM, sebb <se...@gmail.com> wrote:
>
> > Or you can use one of the browser add-ons that show you the requests
> > and responses.
> >
> > On 26/02/2009, Jeff Davis <je...@flyingdiamond.com> wrote:
> > > Hi,
> > >
> > > Scripted logins are generally purposely hard to crack. There is quite
> > > possibly hidden vars along with the user and pass, sometimes javascript
> > > modifies a post field before it's sent and also cookies are set that must
> > be
> > > duplicated.
> > >
> > > I have always found a packet analyzer helpful such as wireshark to get a
> > > clear understanding of how the login process looks when using a browser,
> > > then comparing that to what the packets look like with the httpclient
> > app.
> > >
> > > That should get you started in the right direction, if you look a little
> > > deeper.
> > >
> > > Jeff
> > >
> > >
> > >
> > >
> > >
> > > bo wrote:
> > >
> > > > Hi
> > > >
> > > > I'm trying to do form-based authentication. Here's what happens
> > according
> > > to
> > > > the Firebug
> > > >
> > > > 1. Hit the URL (GET http://foo.com)
> > > > 2. That gets response code 302 and gets redirected (GET
> > > > http://foo.com/session/new) which brings a login form
> > > > 3. Login form is POST with
> > > action="https://foo.com/session" and two fields
> > > > uname and passwd
> > > > 4. Submitting the form gets 302 (POST https://foo.com/session) and
> > then
> > > GET
> > > > http://foo.com/session/new which brings index page content
> > > >
> > > > I'm not clear if I need to follow both redirects and what is the best
> > way
> > > to
> > > > do it. Test code that I have follows
> > > >
> > > > DefaultHttpClient client = new DefaultHttpClient();
> > > > HttpGet get = new HttpGet("http://foo.com/");
> > > > HttpResponse response = client.execute(get);
> > > > System.out.println(response.getStatusLine());
> > > > response.getEntity().consumeContent();
> > > > // do the form post, retain all the cookies
> > > > HttpPost post = new
> > > HttpPost("https://foo.com/session/new");
> > > > List <NameValuePair> nvps = new ArrayList <NameValuePair>();
> > > > nvps.add(new BasicNameValuePair("login", "dude@gmail.com"));
> > > > nvps.add(new BasicNameValuePair("password", "Foo"));
> > > > nvps.add(new BasicNameValuePair("commit", "Sign In")); // this
> > is
> > > > actually a submit button
> > > > post.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
> > > > HttpResponse postresponse = client.execute(post);
> > > > ResponseHandler<String> handler = new BasicResponseHandler();
> > > > String body =
> > > handler.handleResponse(postresponse);
> > > > System.out.println(body);
> > > > // still prints out login form
> > > >
> > > > Thanks,
> > > >
> > > > Bob S.
> > > >
> > > >
> > > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > httpclient-users-unsubscribe@hc.apache.org
> > > For additional commands, e-mail:
> > > httpclient-users-help@hc.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> >
> >
>
>
>
> --
> _________________________
> "Jump right ahead in my web"
> The Rolling Stones.
> "Out of Our Heads" 1965
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
Re: Redirect on authentication
Posted by Christine Karman <ch...@christine.nl>.
On Thu, 2009-02-26 at 07:26 -0800, bo wrote:
> sebb - in my original post I'm referring to Firebug - would you recommend a
> better tool?
I like Wireshark, saves me a lot of time when I do things similar to
what you are doing. I use it a lot.
Christine
>
> On Thu, Feb 26, 2009 at 5:34 AM, sebb <se...@gmail.com> wrote:
>
> > Or you can use one of the browser add-ons that show you the requests
> > and responses.
> >
> > On 26/02/2009, Jeff Davis <je...@flyingdiamond.com> wrote:
> > > Hi,
> > >
> > > Scripted logins are generally purposely hard to crack. There is quite
> > > possibly hidden vars along with the user and pass, sometimes javascript
> > > modifies a post field before it's sent and also cookies are set that must
> > be
> > > duplicated.
> > >
> > > I have always found a packet analyzer helpful such as wireshark to get a
> > > clear understanding of how the login process looks when using a browser,
> > > then comparing that to what the packets look like with the httpclient
> > app.
> > >
> > > That should get you started in the right direction, if you look a little
> > > deeper.
> > >
> > > Jeff
> > >
> > >
> > >
> > >
> > >
> > > bo wrote:
> > >
> > > > Hi
> > > >
> > > > I'm trying to do form-based authentication. Here's what happens
> > according
> > > to
> > > > the Firebug
> > > >
> > > > 1. Hit the URL (GET http://foo.com)
> > > > 2. That gets response code 302 and gets redirected (GET
> > > > http://foo.com/session/new) which brings a login form
> > > > 3. Login form is POST with
> > > action="https://foo.com/session" and two fields
> > > > uname and passwd
> > > > 4. Submitting the form gets 302 (POST https://foo.com/session) and
> > then
> > > GET
> > > > http://foo.com/session/new which brings index page content
> > > >
> > > > I'm not clear if I need to follow both redirects and what is the best
> > way
> > > to
> > > > do it. Test code that I have follows
> > > >
> > > > DefaultHttpClient client = new DefaultHttpClient();
> > > > HttpGet get = new HttpGet("http://foo.com/");
> > > > HttpResponse response = client.execute(get);
> > > > System.out.println(response.getStatusLine());
> > > > response.getEntity().consumeContent();
> > > > // do the form post, retain all the cookies
> > > > HttpPost post = new
> > > HttpPost("https://foo.com/session/new");
> > > > List <NameValuePair> nvps = new ArrayList <NameValuePair>();
> > > > nvps.add(new BasicNameValuePair("login", "dude@gmail.com"));
> > > > nvps.add(new BasicNameValuePair("password", "Foo"));
> > > > nvps.add(new BasicNameValuePair("commit", "Sign In")); // this
> > is
> > > > actually a submit button
> > > > post.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
> > > > HttpResponse postresponse = client.execute(post);
> > > > ResponseHandler<String> handler = new BasicResponseHandler();
> > > > String body =
> > > handler.handleResponse(postresponse);
> > > > System.out.println(body);
> > > > // still prints out login form
> > > >
> > > > Thanks,
> > > >
> > > > Bob S.
> > > >
> > > >
> > > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > httpclient-users-unsubscribe@hc.apache.org
> > > For additional commands, e-mail:
> > > httpclient-users-help@hc.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> >
> >
>
>
--
dagdag is just a two-character rotation of byebye...
Re: Redirect on authentication
Posted by bo <bo...@gmail.com>.
sebb - in my original post I'm referring to Firebug - would you recommend a
better tool?
On Thu, Feb 26, 2009 at 5:34 AM, sebb <se...@gmail.com> wrote:
> Or you can use one of the browser add-ons that show you the requests
> and responses.
>
> On 26/02/2009, Jeff Davis <je...@flyingdiamond.com> wrote:
> > Hi,
> >
> > Scripted logins are generally purposely hard to crack. There is quite
> > possibly hidden vars along with the user and pass, sometimes javascript
> > modifies a post field before it's sent and also cookies are set that must
> be
> > duplicated.
> >
> > I have always found a packet analyzer helpful such as wireshark to get a
> > clear understanding of how the login process looks when using a browser,
> > then comparing that to what the packets look like with the httpclient
> app.
> >
> > That should get you started in the right direction, if you look a little
> > deeper.
> >
> > Jeff
> >
> >
> >
> >
> >
> > bo wrote:
> >
> > > Hi
> > >
> > > I'm trying to do form-based authentication. Here's what happens
> according
> > to
> > > the Firebug
> > >
> > > 1. Hit the URL (GET http://foo.com)
> > > 2. That gets response code 302 and gets redirected (GET
> > > http://foo.com/session/new) which brings a login form
> > > 3. Login form is POST with
> > action="https://foo.com/session" and two fields
> > > uname and passwd
> > > 4. Submitting the form gets 302 (POST https://foo.com/session) and
> then
> > GET
> > > http://foo.com/session/new which brings index page content
> > >
> > > I'm not clear if I need to follow both redirects and what is the best
> way
> > to
> > > do it. Test code that I have follows
> > >
> > > DefaultHttpClient client = new DefaultHttpClient();
> > > HttpGet get = new HttpGet("http://foo.com/");
> > > HttpResponse response = client.execute(get);
> > > System.out.println(response.getStatusLine());
> > > response.getEntity().consumeContent();
> > > // do the form post, retain all the cookies
> > > HttpPost post = new
> > HttpPost("https://foo.com/session/new");
> > > List <NameValuePair> nvps = new ArrayList <NameValuePair>();
> > > nvps.add(new BasicNameValuePair("login", "dude@gmail.com"));
> > > nvps.add(new BasicNameValuePair("password", "Foo"));
> > > nvps.add(new BasicNameValuePair("commit", "Sign In")); // this
> is
> > > actually a submit button
> > > post.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
> > > HttpResponse postresponse = client.execute(post);
> > > ResponseHandler<String> handler = new BasicResponseHandler();
> > > String body =
> > handler.handleResponse(postresponse);
> > > System.out.println(body);
> > > // still prints out login form
> > >
> > > Thanks,
> > >
> > > Bob S.
> > >
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail:
> > httpclient-users-help@hc.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>
--
_________________________
"Jump right ahead in my web"
The Rolling Stones.
"Out of Our Heads" 1965
Re: Redirect on authentication
Posted by sebb <se...@gmail.com>.
Or you can use one of the browser add-ons that show you the requests
and responses.
On 26/02/2009, Jeff Davis <je...@flyingdiamond.com> wrote:
> Hi,
>
> Scripted logins are generally purposely hard to crack. There is quite
> possibly hidden vars along with the user and pass, sometimes javascript
> modifies a post field before it's sent and also cookies are set that must be
> duplicated.
>
> I have always found a packet analyzer helpful such as wireshark to get a
> clear understanding of how the login process looks when using a browser,
> then comparing that to what the packets look like with the httpclient app.
>
> That should get you started in the right direction, if you look a little
> deeper.
>
> Jeff
>
>
>
>
>
> bo wrote:
>
> > Hi
> >
> > I'm trying to do form-based authentication. Here's what happens according
> to
> > the Firebug
> >
> > 1. Hit the URL (GET http://foo.com)
> > 2. That gets response code 302 and gets redirected (GET
> > http://foo.com/session/new) which brings a login form
> > 3. Login form is POST with
> action="https://foo.com/session" and two fields
> > uname and passwd
> > 4. Submitting the form gets 302 (POST https://foo.com/session) and then
> GET
> > http://foo.com/session/new which brings index page content
> >
> > I'm not clear if I need to follow both redirects and what is the best way
> to
> > do it. Test code that I have follows
> >
> > DefaultHttpClient client = new DefaultHttpClient();
> > HttpGet get = new HttpGet("http://foo.com/");
> > HttpResponse response = client.execute(get);
> > System.out.println(response.getStatusLine());
> > response.getEntity().consumeContent();
> > // do the form post, retain all the cookies
> > HttpPost post = new
> HttpPost("https://foo.com/session/new");
> > List <NameValuePair> nvps = new ArrayList <NameValuePair>();
> > nvps.add(new BasicNameValuePair("login", "dude@gmail.com"));
> > nvps.add(new BasicNameValuePair("password", "Foo"));
> > nvps.add(new BasicNameValuePair("commit", "Sign In")); // this is
> > actually a submit button
> > post.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
> > HttpResponse postresponse = client.execute(post);
> > ResponseHandler<String> handler = new BasicResponseHandler();
> > String body =
> handler.handleResponse(postresponse);
> > System.out.println(body);
> > // still prints out login form
> >
> > Thanks,
> >
> > Bob S.
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail:
> httpclient-users-help@hc.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
Re: Redirect on authentication
Posted by bo <bo...@gmail.com>.
Thanks Jeff,
I have not use packet analyzers for such purpose before. Using NET portion
of Firebug, I can clearly see all headers, responses, cookies, etc. I will
try wireshark, any pointers on what to look for? And mainly - do I need
manually follow redirects or should HttpClient follow these, especially 302?
Bob
On Wed, Feb 25, 2009 at 11:09 PM, Jeff Davis <je...@flyingdiamond.com> wrote:
> Hi,
>
> Scripted logins are generally purposely hard to crack. There is quite
> possibly hidden vars along with the user and pass, sometimes javascript
> modifies a post field before it's sent and also cookies are set that must be
> duplicated.
>
> I have always found a packet analyzer helpful such as wireshark to get a
> clear understanding of how the login process looks when using a browser,
> then comparing that to what the packets look like with the httpclient app.
>
> That should get you started in the right direction, if you look a little
> deeper.
>
> Jeff
>
>
>
>
>
> bo wrote:
>
>> Hi
>>
>> I'm trying to do form-based authentication. Here's what happens according
>> to
>> the Firebug
>>
>> 1. Hit the URL (GET http://foo.com)
>> 2. That gets response code 302 and gets redirected (GET
>> http://foo.com/session/new) which brings a login form
>> 3. Login form is POST with action="https://foo.com/session" and two
>> fields
>> uname and passwd
>> 4. Submitting the form gets 302 (POST https://foo.com/session) and then
>> GET
>> http://foo.com/session/new which brings index page content
>>
>> I'm not clear if I need to follow both redirects and what is the best way
>> to
>> do it. Test code that I have follows
>>
>> DefaultHttpClient client = new DefaultHttpClient();
>> HttpGet get = new HttpGet("http://foo.com/");
>> HttpResponse response = client.execute(get);
>> System.out.println(response.getStatusLine());
>> response.getEntity().consumeContent();
>> // do the form post, retain all the cookies
>> HttpPost post = new HttpPost("https://foo.com/session/new");
>> List <NameValuePair> nvps = new ArrayList <NameValuePair>();
>> nvps.add(new BasicNameValuePair("login", "dude@gmail.com"));
>> nvps.add(new BasicNameValuePair("password", "Foo"));
>> nvps.add(new BasicNameValuePair("commit", "Sign In")); // this is
>> actually a submit button
>> post.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
>> HttpResponse postresponse = client.execute(post);
>> ResponseHandler<String> handler = new BasicResponseHandler();
>> String body = handler.handleResponse(postresponse);
>> System.out.println(body);
>> // still prints out login form
>>
>> Thanks,
>>
>> Bob S.
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>
--
_________________________
"Jump right ahead in my web"
The Rolling Stones.
"Out of Our Heads" 1965
Re: Redirect on authentication
Posted by Jeff Davis <je...@FlyingDiamond.com>.
Hi,
Scripted logins are generally purposely hard to crack. There is quite
possibly hidden vars along with the user and pass, sometimes javascript
modifies a post field before it's sent and also cookies are set that
must be duplicated.
I have always found a packet analyzer helpful such as wireshark to get a
clear understanding of how the login process looks when using a browser,
then comparing that to what the packets look like with the httpclient app.
That should get you started in the right direction, if you look a little
deeper.
Jeff
bo wrote:
> Hi
>
> I'm trying to do form-based authentication. Here's what happens according to
> the Firebug
>
> 1. Hit the URL (GET http://foo.com)
> 2. That gets response code 302 and gets redirected (GET
> http://foo.com/session/new) which brings a login form
> 3. Login form is POST with action="https://foo.com/session" and two fields
> uname and passwd
> 4. Submitting the form gets 302 (POST https://foo.com/session) and then GET
> http://foo.com/session/new which brings index page content
>
> I'm not clear if I need to follow both redirects and what is the best way to
> do it. Test code that I have follows
>
> DefaultHttpClient client = new DefaultHttpClient();
> HttpGet get = new HttpGet("http://foo.com/");
> HttpResponse response = client.execute(get);
> System.out.println(response.getStatusLine());
> response.getEntity().consumeContent();
> // do the form post, retain all the cookies
> HttpPost post = new HttpPost("https://foo.com/session/new");
> List <NameValuePair> nvps = new ArrayList <NameValuePair>();
> nvps.add(new BasicNameValuePair("login", "dude@gmail.com"));
> nvps.add(new BasicNameValuePair("password", "Foo"));
> nvps.add(new BasicNameValuePair("commit", "Sign In")); // this is
> actually a submit button
> post.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
> HttpResponse postresponse = client.execute(post);
> ResponseHandler<String> handler = new BasicResponseHandler();
> String body = handler.handleResponse(postresponse);
> System.out.println(body);
> // still prints out login form
>
> Thanks,
>
> Bob S.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org