Some more information and thoughts.

I can replicate the server behaviour using openssl s_client, sending the
HTTP request, and then shutting down the client with a "Q".

I'm wondering if the problem is that, once the HTTP request is received
by my server, then it has no read interest in the socket (as it now
wants to write the HTTP response).  So it will put the response whatever
the state of the socket.  Then maybe the put affects the state of the
socket, so that the shutdown state is no longer present.

So should I always have a read interest in the socket, in case of
shutdown?

Or should I check for a shutdown before actually doing the put?

But I would still have thought that the put should return an error if
the socket has been shutdown.

Thanks again,

G.
 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Shaw Graham George
Sent: 15 August 2007 11:38
To: openssl-users@openssl.org
Subject: Problem handling unexpected SSL shutdown

Hi,

We have an application that provides HTTPS, either as client or server,
for our customers.  At the moment I am doing some testing between our
client and our server, as a result of a problem with one of our
customers, and there is a particular sequence of events, that involves
an unexpected SSL shutdown, that is giving an unexpected behaviour (at
least to me).

The sequence of events goes like this:

1.  The SSL handshake proceeds as normal.
2.  The client puts an HTTP request
3.  The server gets the HTTP request
4.  The client then executes an (unexpected) SSL shutdown 5.  The server
puts the HTTP response

Here I might expect the put to fail, but all appears normal.

6.  As an HTTP Keep-Alive request has been made, the server enters a
wait for the next read event.
7.  The read event occurs (presumably due to the SSL shutdown), and now
the get fails.

SSL_get_error() returns SSL_ERROR_SYSCALL (I would expect
SSL_ERROR_ZERO_RETURN for an SSL shutdown).
ERR_get_error() returns 0.
(SSL_get_shutdown() & SSL_RECEIVED_SHUTDOWN) returns 0.

Is this the expected behaviour?

What I am looking for is a way of identifying the shutdown at the
server, so that I can close the connection softly.

The version is 0.9.8e.  All sockets are non-blocking.  The test platform
is Windows - but our application runs on many platforms, I can test on
those as well if required.

Thanks in advance,

G.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to