curl / Mailing Lists / curl-library / Single Mail


Behaviour with CURLOPT_FRESH_CONNECT when libcurl performs a request internally

From: John Smith via curl-library <>
Date: Thu, 29 Nov 2018 18:11:08 +0000


curl version: v7_57_0

I'm working on a piece of software which works in two modes:
 - normal mode where we are re-using existing connections
 - degraded mode where CURLOPT_FRESH_CONNECT is enabled on every HTTP

The degraded mode is activated after a transfer fails due to a stale
connection (I've noticed this can happen because e.g. the server terminated
a connection but for some reason we didn't receive the FIN packet).

I'm having an issue in this mode when the server responds with "HTTP/1.1
401 Unauthorized" to a GET request I just performed. In that case, libcurl
is internally performing an HTTP request to send the authorization; and
that request is made using an already existing connection somehow ignoring
the FRESH_CONNECT option I passed to the original request.

Is there a way I could force libcurl to open a new connection also when it
performs a request internally (generally or at least when handling 401)?


Received on 2018-11-29