curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: bash curl multiple requests same connection

From: Dan Fandrich via curl-users <>
Date: Thu, 12 Mar 2020 11:51:49 +0100

On Thu, Mar 12, 2020 at 06:38:40PM +0800, taylor park via curl-users wrote:
> The curl command-line tool can, however, only keep connections alive for as
> long as it runs, so as soon as it exits back to your command line it has to
> close down all currently open connections (and also free and clean up all the
> other caches it uses to decrease time of subsequent operations)
> Creating a TCP connection takes some time
> so i want send tow requests use the same connection
> The second request needs to be submitted after processing the first response。

Your example provided two requests and those two will be sent on the same
connection. But, once that second one is complete the tool will exit and any
subsequent transfer will need to establish a new connection. If you then want
a third request to use the same connection then you'll need the feature I
mention in my other message or to write your code in Python or some other
scripting language using libcurl, where it will have full control over the

Received on 2020-03-12