how to keep connection open after receiving the last response?

Adrien Kunysz via curl-users <[email protected]> Wed, 15 Oct 2025 10:47:47 +0000
Newsgroups gmane.comp.web.curl.general
Message-ID <[email protected]>
Greetings curl-users,

I have come to appreciate using curl for most of my HTTP troubleshooting needs. However there is one use case where I had to fall back to netcat and writing my requests manually. To validate the HTTP/1.1 keepalive mechanism of a server, it is useful to send a request, read the response and wait "forever" until the server closes the connection. I have not found any way to do this with curl.

This is what I resorted to:

        $ printf 'GET / HTTP/1.1\r\nHost: %s\r\n\r\n' $host | /bin/time -f %E nc $host $port > /dev/null

Is there a way to do the same with curl? If not, would that be an acceptable feature request?

Regards,
Adrien Kunysz
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users
Etiquette:   https://curl.se/mail/etiquette.html