cURL / Mailing Lists / curl-library / Single Mail


RE: Incorrect size passed to the writer function set by CURLOPT_WRITEFUNCTION

From: Patrick Monnerat <>
Date: Tue, 13 May 2014 18:10:29 +0200

Rashmi wrote:

> We have an issue with the response copied to the user buffer by the
writer function specified with the CURLOPT_WRITEFUNCTION. It appears
that the pointer passed to the writer function is offset by two bytes
from the actual start of the response but the size is not decremented.

> < HTTP/1.1 401 Unauthorized

This is the verbose output: the "< " at the start is generated by curl
to show the data direction --> it is not part of the data.

> Buffer at source :
> HTTP/1.1 401 Unauthorized
> Size : 1 nmemb: 27

25 characters + CR + LF :-)
It thus works as expected.

The reason of your problem is probably elsewhere. I tried to adapt your
program to run in my environment, but it runs without problem.

In addition, you should call curl_global_init()/curl_global_cleanup().


List admin:
Received on 2014-05-13