curl / Mailing Lists / curl-library / Single Mail


How to recover from 'gnutls_handshake() failed: An unexpected TLS packet was received'

From: Juan A. Rubio <>
Date: Tue, 5 Jun 2018 10:46:36 +0100


I'm using a curl_multi (using socket function) to handle a single
curl_easy handle. The easy handle is being reused
(easy_set_opt/multi_add/multi_remove) multiple times to download a
number of files, one after another. However, after a number of
successful downloads (e.g. 20 or 30 files downloaded), the connection
is closed with this error 'gnutls_handshake() failed: An unexpected
TLS packet was received'.

If I attempt to reuse the same easy handle, the ''gnutls_handshake()
failed' error repeatedly shows up. So I'm wondering would be the right
way to recover from this situation. Does this require a cleanup of the
easy session, and create (init) a new one?. Would the 'curl_multi'
need to be recycled as well?

Received on 2018-06-05