Re: how to keep connection open after receiving the last response?

Daniel Stenberg via curl-users <[email protected]> Wed, 15 Oct 2025 14:03:34 +0200 (CEST)
Newsgroups gmane.comp.web.curl.general
Message-ID <[email protected]>
On Wed, 15 Oct 2025, Adrien Kunysz via curl-users wrote:

> 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.

curl does transfers. When the last transfer is done, it exits back to the 
shell.

To validate keepalive in a server, just do a second transfer on the same 
command line and ask curl to tell you how many connections it needed. Or just 
read the verbose output that tells if it reuses a connection vs creates a new.

Or make the last transfer just never end so that curl will sit waiting for the 
transfer to complete.

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

What exactly what that be useful for except for your quite particular niche 
use case? And how long would just sit there keeping the connection alive 
without doing anything?

-- 

  / daniel.haxx.se || https://rock-solid.curl.dev
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users
Etiquette:   https://curl.se/mail/etiquette.html