curl / Mailing Lists / curl-library / Single Mail


Re: Query on HTTP(S) connection

From: Daniel Stenberg <>
Date: Sun, 4 Mar 2018 22:45:51 +0100 (CET)

On Fri, 2 Mar 2018, Ranjan Khanna wrote:

> 1. How can check using the curl handle if the connection is still
> established (the connection is not closed)?

If CURLINFO_ACTIVESOCKET returns a socket, you know it was alive when libcurl
last used it.

> 2. How can I close the underlying HTTP connection without calling
> "curl_easy_cleanup"?

You can set the CUROPT_FORBID_REUSE option, which implies that the connection
will get closed after use, but other than that there's no way to do that.

Why do you need to enforce a close?
Received on 2018-03-04