hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Petr Prokop <zwei2st...@gmail.com>
Subject Problem with https and cookies: did not recieve secure cookie
Date Fri, 08 May 2009 20:23:13 GMT

I am trying to log in into https site which sets two cookies, when
looked at in Firefox, one is "any connection" another is "secure
connection only" (that holds session id).

http client only recieves "any connection"

Another thing that caught my eye is that received cookie has field
"server" with "www.mysite.com" while not-received one has field
"domain" containing ".www.mysite.com" (starting with dot).

My code to log is is simple, no customization or anything, using
defaultHttpClient, I tried to change cookie policy to all avaiable
types without any result.

        HttpPost httpPost = new HttpPost(

        List<NameValuePair> nvps = new ArrayList<NameValuePair>();

        nvps.add(new BasicNameValuePair("username", user.getEmail()));
        nvps.add(new BasicNameValuePair("password", user.getPassword()));

        try {
            httpPost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));

            HttpResponse response = this.httpClient.execute(httpPost);
            HttpEntity entity = response.getEntity();
            String pageContent = EntityUtils.toString(entity);

            (here i recieve page that is "ok", but httpClient object
has only usecure cookie)

Any tips, any indepth cookie-https document would be welcome, google
is quite cryptic.

Thanks for help!

Petr Prokop
icq: 111360986
Life is a voyage: Many people ride thru highways, some walk footpaths.
So keep smiling while you hitchhike!

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

View raw message