Skip to content

libcurl: Failed to perform request: [61]

Published: at 10:03 PM

When making HTTP requests using tools like libcurl, you may encounter the error:

Error: Failed to perform request: [61]

Network Connection failed. Failed to per form request: [61] Unrecognized or bad HTTP Content or Transfer-Encoding (Unrecognized Content encoding type. libcurl understands deflate, gzip Content encodings.)

The solution might simply be to modify the request header to explicitly request no encoding:

Accept-Encoding: identity

The mentioned error typically indicates that the server responded with a content encoding type that the client does not support, understand or expect.

libcurl natively supports the following content encodings:

If the server uses an unsupported encoding (e.g., br for Brotli or a custom type), libcurl will fail to decode the response. In my case, I was receiving a base64 string which was not what libcurl was expecting.

The error occurs when the client sends an HTTP request with an Accept-Encoding header that allows unsupported encodings, or when the server defaults to an unsupported encoding.

Example problematic header:

Accept-Encoding: gzip, deflate, br

If the server responds with Brotli (br), libcurl cannot decode it unless explicitly configured to support it.


Previous Post
Overview of 3DS, PSD and SCA in Payment Security
Next Post
Understanding SQL Server ID Jumps