I'm trying to verify that HTTP persistent connections are being used during communication with a Tomcat webserver I've got running. Currently, I can retrieve a resource on my server from a browser (e.g. Chrome) and verify using netstat that the connection is established:
# visit http://server:8080/path/to/resource in Chrome [server:/tmp]$ netstat -a ... tcp 0 0 server.mydomain:webcache client.mydomain:55502 ESTABLISHED
However, if I use curl, I never see the connection on the server in netstat.
[client:/tmp]$ curl --keepalive-time 60 --keepalive http://server:8080/path/to/resource ... [server:/tmp]$ netstat -a # no connection exists for client.mydomain
I've also tried using the following curl command:
curl -H "Keep-Alive: 60" -H "Connection: keep-alive" http://server:8080/path/to/resource
Here's my client machine's curl version:
[server:/tmp]$ curl -V curl 7.19.5 (x86_64-unknown-linux-gnu) libcurl/7.19.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 libssh2/1.1 Protocols: tftp ftp telnet dict http file https ftps scp sftp Features: IDN IPv6 Largefile NTLM SSL libz
How do I get curl to use a persistent/keepalive connection? I've done quite a bit of Googling on the subject, but with no success. It should be noted that I've also used
links on the client machine to retrieve the resource, and that does give me an
ESTABLISHED connection on the server.
Let me know if I need to provide more information.