CURLMBS Error 18 During Download

In a project that uses CURLMBS to communicate with a REST server, I am running into this error now when trying to download a bigger response. The connection will be closed with xxxxx bytes remaining.
I tried every possible combination of Timeout options but could not solve this issue. Any ideas how this issue can be fixed?

The error string is quite simply exactly what libcurl sees: since it is receiving a chunked encoding stream it knows when there is data left in a chunk to receive. When the connection is closed, libcurl knows that the last received chunk was incomplete. Then you get this error code.

There’s nothing you can do to avoid this error with the request unmodified, but you can try to work around it by issuing a HTTP 1.0 request instead (since chunked encoding won’t happen then) but the fact is that this is most likely a flaw in the server or in your network/setup somehow.

Source: StackOverflow

1 Like