cURL / Mailing Lists / curl-library / Single Mail


curl_multi reuse connection problem

From: comain chen <>
Date: Thu, 17 Feb 2011 16:46:27 +0800


1. When using persistent connections, is there a reliable way to
detect whether the reused connection is still alive?
I think there is no way to do so. Therefore, the transfer over a
reused connection can fail at all possible stages (i.e. the reused
connection is suddenly dad)

2. If the above is true,  all states in curl_multi_runsingle should
check for this case and make sure to retry a new fresh connection to
I can see this in CURLM_STATE_DO but apparently the check is missed in
several other stages (for example in CURLM_STATE_PERFORM).

This caused my problem, I am using mutli to connect to several http
servers which does not favor persistent connection and closed the
connection immediately
after response. When a later request comes, it is possible that an old
dead connection is reused and caused failure in various stages.

Best regrads,

List admin:
Received on 2011-02-17