RE: how to keep connection open after receiving the last response?
Adrien Kunysz via curl-users <[email protected]> Wed, 15 Oct 2025 12:29:20 +0000
| Newsgroups | gmane.comp.web.curl.general |
|---|---|
| Message-ID | <[email protected]> |
Daniel Stenberg <[email protected]> wrote: > 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. I want to specifically test how long the server waits before it closes the connection after the last transfer completed. >> 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? I agree it's a niche use case and if the point of curl is to transfer file (as opposed to troubleshoot HTTP services; although that's mostly what I use it for), it might not be a suitable feature. > And how long would just sit there keeping the connection alive without doing anything? As long as necessary :) I imagine the relevant commandline option would take an argument telling it how long to wait. The default would be 0 (current behaviour). Maybe a negative number would mean "forever". It could also have a different exit code depending on whether the server or the client closed the connection first. I have no idea how much that would make sense for protocols other than HTTP/1.1. -- Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users Etiquette: https://curl.se/mail/etiquette.html