Ok. It's a step forward. At least we know that your JSSE setup is sane.

Try disabling stale connection check and see if that makes any difference

http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/SimpleHttpConnectionManager.html#setConnectionStaleCheckingEnabled(boolean)

Oleg

-----Original Message-----
From: Laurent Garcia [mailto:[EMAIL PROTECTED]
Sent: Monday, October 06, 2003 12:16
To: Commons HttpClient Project
Subject: Re: Why are cookies deleted?


Oleg,

I just tried the following code from Troubleshooting section:

import java.io.BufferedReader;
  import java.io.InputStreamReader;
  import java.io.OutputStreamWriter;
  import java.io.Writer;
  import java.net.Socket;

  import javax.net.ssl.SSLSocketFactory;

  public class Test {

     public static final String TARGET_HTTPS_SERVER = "www.verisign.com";
     public static final int    TARGET_HTTPS_PORT   = 443;

     public static void main(String[] args) throws Exception {

       Socket socket = SSLSocketFactory.getDefault().
         createSocket(TARGET_HTTPS_SERVER, TARGET_HTTPS_PORT);
       try {
         Writer out = new OutputStreamWriter(
            socket.getOutputStream(), "ISO-8859-1");
         out.write("GET / HTTP/1.1\r\n");
         out.write("Host: " + TARGET_HTTPS_SERVER + ":" +
             TARGET_HTTPS_PORT + "\r\n");
         out.write("Agent: SSL-TEST\r\n");
         out.write("\r\n");
         out.flush();
         BufferedReader in = new BufferedReader(
            new InputStreamReader(socket.getInputStream(), "ISO-8859-1"));
         String line = null;
         while ((line = in.readLine()) != null) {
            System.out.println(line);
         }
       } finally {
         socket.close();
       }
     }
  }


and it work fine in my servlet in WSAD 5.0 and IBM JSSE

Laurent


----- Original Message -----
From: "Kalnichevski, Oleg" <[EMAIL PROTECTED]>
To: "Commons HttpClient Project" <[EMAIL PROTECTED]>
Sent: Monday, October 06, 2003 11:59 AM
Subject: RE: Why are cookies deleted?


Ernst,

Cookies are not deleted by HttpClient unless they are expired. I am pretty
sure about it

In your particular case there's a bug in the following piece of code

   public AddReleaseTask() {
      HttpState httpState = new HttpState();
      httpState.setCookiePolicy(CookiePolicy.COMPATIBILITY);

      _httpClient = new HttpClient();
      _httpClient.setConnectionTimeout(7000); // 7 seconds
      _httpClient.setTimeout(5000);           // 5 seconds
      _httpClient.setState(httpState);
   }

There's a new instance of HttpState created every time the method is
executed. As a result the old one gets garbage collected along with all the
cookies it contains. Just keep the original HttpState instance to stop your
cookies from disappearing

HTH

Oleg


-----Original Message-----
From: Ernst de Haan [mailto:[EMAIL PROTECTED]
Sent: Monday, October 06, 2003 11:44
To: Commons HttpClient Project
Subject: Why are cookies deleted?


Hi,

Why are cookies deleted from the state registered with my HttpClient object?

I do a request (GetMethod) that returns 2 cookies. Then I do another request
(using another GetMethod) and with that I lose both cookies. Should I
recycle the original method or should I release the connection or should I
do something else?

I'm pretty sure the site does not delete the cookies self, although I'm not
100% sure. How can I determine this?

Source code:
http://people.freebsd.org/~znerd/AddReleaseTask.java


Output log:

[sfaddrelease] Using keystore file "src/certificates/sourceforge.net.cert".
[sfaddrelease] Logging in to SourceForge site as "znerd".
[sfaddrelease] Executing request "https://sourceforge.net/account/
login.php?return_to=&form_loginname=znerd&form_pw=Secret1&persistent_login=1
&login=Login
+With+SSL".
[sfaddrelease] Received 2 cookies.
[sfaddrelease] Received cookie: session_ser=4mwuT3NmTwAcip%
2BNYbMb3kufdYs1ecnResrJ4qvW64J3DO1UjOB9najRyGZHsvly%2F7%
2FApd7J6HNaZzO47tBkuaT0juKf20pqVZSSAZh2eho%
3D-9b1d4e8f9591972e74e19fee00ea1f7a
[sfaddrelease] Received cookie: persist_session=Vd18PV2KlUs%3D
[sfaddrelease] Logged in to SourceForge site as "znerd".
[sfaddrelease] Creating release "0.127-dev" for group 71598, package 71219.
[sfaddrelease] Current cookie count is 2
[sfaddrelease] Executing request "https://sourceforge.net/project/admin/
newrelease.php?group_id=71598&package_id=71219&release_name=0.127-dev&submit
=Create
+This+Release".
[sfaddrelease] Received status line: HTTP/1.1 200 OK
[sfaddrelease] Current cookie count is 0
[sfaddrelease] Created release "0.127-dev" for group 71598, package 71219.


--
Ernst


---------------------------------------------------------------------
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to