CURLOPT_WRITEFUNCTION is not guaranteed to be called only once per request and receive all data at once. Use a dynamic buffer to cope with that case. Related: https://pagure.io/freeipa/issue/7966 Reviewed-By: Christian Heimes <cheimes@redhat.com> Reviewed-By: Rob Crittenden <rcritten@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>