lightsaber
lightsaber

Reputation: 55

openssl s_client losing connection after each request

I'm playing around with openssl s_client and a webserver and I wonder why I'm losing the connection to the server after each GET request I send:

Handshake works fine:

openssl s_client -connect hostname:port
GET / HTTP/1.1
Host: hostname
Connection: keep-alive

Then I receive the response from the application server: HTTP/1.1 200 OK

...more http here...
<html/>closed

As you see the connection is closed, but as I used the connection header with keep-alive, isn't the connection supposed to stay established? I want to test the renegotiation feature of SSL and therefor I need to be able to keep the session alive between several requests.

Upvotes: 2

Views: 5039

Answers (1)

pfried
pfried

Reputation: 5079

Your server must reply with a Connection: Keep-Alive header as well to establish a keepalive connection.

Change your server side configuration to do this.

But be aware of the performace issues coming with keepalive connection as well as the fact that many browsers close the connection after a certain timeout.

Upvotes: 2

Related Questions