[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [iaik-ssl] HttpsURLConnection



This is most likely caused by the web server failing to send an SSL closure alert before closing the TCP connection. iSaSiLk will in this situation throw an ava.io.EOFException. Although the SSL/TLS spec mandates that the side initiating the closing of the connection must send an SSL closure alert, most web servers don't. 

Personally I would like to have the ability to configure if I want a missing closure alert to raise an exception. What is available now is the SSLContext.setTerminatedSessions method. You probably want to set this to true, otherwise you will perform a full SSL handshake every time you connect to the web server (that doesn't send a closure alert).

--
Roger

-----Original Message-----
From: Ron Zhang [mailto:ronz@ecomxml.com]
Sent: den 19 januari 2000 17:51
To: iaik-ssl@iaik.at
Subject: [iaik-ssl] HttpsURLConnection


Hi, all,

Currently I am writing a HTTPs client to connect to a servlet which resides on a SSL-enabled web server.  I included all the
required JAR files and set up "java.protocol.handler.pkgs" to be "iaik.protocol", and what I am doing is:

    HttpsURLConnection con = (HttpsURLConnection) servlet.openConnection();
    con.setRequestMethod("POST");
    con.setDoInput(true);
    con.setDoOutput(true);

    PrintWriter http_out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(con.getOutputStream())));

     http_out.println(post_str);  /*post_str is a string*/
     http_out.flush();
     http_out.close();

     BufferedReader http_reponse = new BufferedReader(new InputStreamReader(con.getInputStream()));

     String str;
     StringBuffer sb = new StringBuffer();
     while((str=http_reponse.readLine()) != null) {
        sb.append(str);
        sb.append("\r\n");
     }

     http_reponse.close();

     reply_str = sb.toString();


However, it seems that the client aborts at the line: "while((str=http_reponse.readLine()) != null)",  and the exception is:

java.io.EOFException: Connection closed by remote host.
        at iaik.security.ssl.Utils.a(Compiled Code)
        at iaik.security.ssl.p.a(Unknown Source)
        at iaik.security.ssl.p.g(Unknown Source)
        at iaik.security.ssl.l.b(Unknown Source)
        at iaik.security.ssl.l.a(Unknown Source)
        at iaik.security.ssl.l.read(Unknown Source)
        at java.io.BufferedInputStream.read1(BufferedInputStream.java:227)
        at java.io.BufferedInputStream.read(Compiled Code)
        at java.io.FilterInputStream.read(FilterInputStream.java:97)
        at java.io.InputStreamReader.fill(Compiled Code)
        at java.io.InputStreamReader.read(InputStreamReader.java:239)
        at java.io.BufferedReader.fill(Compiled Code)
        at java.io.BufferedReader.readLine(Compiled Code)
        at java.io.BufferedReader.readLine(Compiled Code)

I checked the servlet, it receives the posted string, and already sends out the reply string, but somehow, the client cannot receive
it because of the connection is closed strangely?

Any help is needed at once!!!  Thanks a lot

Ron

--
Mailinglist-archive at http://jcewww.iaik.at/mailarchive/iaik-ssl/sslthreads.html

To unsubscribe send an email to listserv@iaik.at with the folowing content: UNSUBSCRIBE iaik-ssl
 

--
Mailinglist-archive at http://jcewww.iaik.at/mailarchive/iaik-ssl/sslthreads.html

To unsubscribe send an email to listserv@iaik.at with the folowing content: UNSUBSCRIBE iaik-ssl